Check for repeated annotations in type alias declaration.
This commit is contained in:
@@ -46,6 +46,9 @@ class AnnotationChecker(private val additionalCheckers: Iterable<AdditionalAnnot
|
|||||||
annotated.typeReference?.let { check(it, trace) }
|
annotated.typeReference?.let { check(it, trace) }
|
||||||
annotated.receiverTypeReference?.let { check(it, trace) }
|
annotated.receiverTypeReference?.let { check(it, trace) }
|
||||||
}
|
}
|
||||||
|
if (annotated is KtTypeAlias) {
|
||||||
|
annotated.getTypeReference()?.let { check(it, trace) }
|
||||||
|
}
|
||||||
if (annotated is KtTypeParameterListOwner && annotated is KtCallableDeclaration) {
|
if (annotated is KtTypeParameterListOwner && annotated is KtCallableDeclaration) {
|
||||||
// TODO: support type parameter annotations for type parameters on classes and properties
|
// TODO: support type parameter annotations for type parameters on classes and properties
|
||||||
annotated.typeParameters.forEach { check(it, trace) }
|
annotated.typeParameters.forEach { check(it, trace) }
|
||||||
|
|||||||
+4
@@ -0,0 +1,4 @@
|
|||||||
|
@Target(AnnotationTarget.TYPE)
|
||||||
|
annotation class A
|
||||||
|
|
||||||
|
typealias Test1 = @A <!REPEATED_ANNOTATION!>@A<!> Int
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package
|
||||||
|
|
||||||
|
@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class A : kotlin.Annotation {
|
||||||
|
public constructor A()
|
||||||
|
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||||
|
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||||
|
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||||
|
}
|
||||||
|
public typealias Test1 = @A @A kotlin.Int
|
||||||
@@ -20910,6 +20910,12 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
|||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("typealiasRhsRepeatedAnnotations.kt")
|
||||||
|
public void testTypealiasRhsRepeatedAnnotations() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/typealiasRhsRepeatedAnnotations.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("unsupportedTypeAlias.kt")
|
@TestMetadata("unsupportedTypeAlias.kt")
|
||||||
public void testUnsupportedTypeAlias() throws Exception {
|
public void testUnsupportedTypeAlias() throws Exception {
|
||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/unsupportedTypeAlias.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/typealias/unsupportedTypeAlias.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user