[FIR] Support typealiases to java Repeatable

This commit is contained in:
Nikolay Lunyak
2023-01-13 12:01:09 +02:00
committed by Space Team
parent 2e8b177262
commit d105ce8681
7 changed files with 63 additions and 2 deletions
@@ -2371,6 +2371,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/containerTarget_1_6.kt");
}
@Test
@TestMetadata("javaRepeatableInKotlin.kt")
public void testJavaRepeatableInKotlin() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/javaRepeatableInKotlin.kt");
}
@Test
@TestMetadata("javaRepeatableJvmTarget6.kt")
public void testJavaRepeatableJvmTarget6() throws Exception {
@@ -2377,6 +2377,12 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/containerTarget_1_6.kt");
}
@Test
@TestMetadata("javaRepeatableInKotlin.kt")
public void testJavaRepeatableInKotlin() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/javaRepeatableInKotlin.kt");
}
@Test
@TestMetadata("javaRepeatableJvmTarget6.kt")
public void testJavaRepeatableJvmTarget6() throws Exception {
@@ -2371,6 +2371,12 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/containerTarget_1_6.kt");
}
@Test
@TestMetadata("javaRepeatableInKotlin.kt")
public void testJavaRepeatableInKotlin() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/javaRepeatableInKotlin.kt");
}
@Test
@TestMetadata("javaRepeatableJvmTarget6.kt")
public void testJavaRepeatableJvmTarget6() throws Exception {
@@ -87,11 +87,11 @@ object FirRepeatableAnnotationChecker : FirBasicDeclarationChecker() {
}
if (declaration is FirRegularClass) {
val javaRepeatable = annotations.find { it.unexpandedClassId == StandardClassIds.Annotations.Java.Repeatable }
val javaRepeatable = annotations.getAnnotationByClassId(StandardClassIds.Annotations.Java.Repeatable, session)
if (javaRepeatable != null) {
checkJavaRepeatableAnnotationDeclaration(javaRepeatable, declaration, context, reporter)
} else {
val kotlinRepeatable = annotations.find { it.toAnnotationClassId(session) == StandardClassIds.Annotations.Repeatable }
val kotlinRepeatable = annotations.getAnnotationByClassId(StandardClassIds.Annotations.Repeatable, session)
if (kotlinRepeatable != null) {
checkKotlinRepeatableAnnotationDeclaration(kotlinRepeatable, declaration, context, reporter)
}
@@ -0,0 +1,13 @@
// FIR_IDENTICAL
// FULL_JDK
// !LANGUAGE: +RepeatableAnnotations
//import java.lang.annotation.*
typealias Rep = java.lang.annotation.Repeatable
<!REPEATABLE_CONTAINER_MUST_HAVE_VALUE_ARRAY_ERROR!>@Rep(RepeatableAnnotationContainer::class)<!>
annotation class RepeatableAnnotation
annotation class RepeatableAnnotationContainer
@RepeatableAnnotation class Annotated
@@ -0,0 +1,24 @@
package
@RepeatableAnnotation public final class Annotated {
public constructor Annotated()
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
}
@Rep /* = java.lang.annotation.Repeatable */(value = RepeatableAnnotationContainer::class) public final annotation class RepeatableAnnotation : kotlin.Annotation {
public constructor RepeatableAnnotation()
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 final annotation class RepeatableAnnotationContainer : kotlin.Annotation {
public constructor RepeatableAnnotationContainer()
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 Rep = java.lang.annotation.Repeatable
@@ -2377,6 +2377,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/containerTarget_1_6.kt");
}
@Test
@TestMetadata("javaRepeatableInKotlin.kt")
public void testJavaRepeatableInKotlin() throws Exception {
runTest("compiler/testData/diagnostics/tests/annotations/repeatable/javaRepeatableInKotlin.kt");
}
@Test
@TestMetadata("javaRepeatableJvmTarget6.kt")
public void testJavaRepeatableJvmTarget6() throws Exception {