From 050db6d454c1a43335a126b5cdfeacc3c22c28ee Mon Sep 17 00:00:00 2001 From: Roman Artemev Date: Thu, 11 Mar 2021 13:18:54 +0300 Subject: [PATCH] [KLIB] Add box test for generic annotations --- .../FirBlackBoxCodegenTestGenerated.java | 6 +++ .../box/annotations/genericAnnotations.kt | 50 +++++++++++++++++++ .../codegen/BlackBoxCodegenTestGenerated.java | 6 +++ .../IrBlackBoxCodegenTestGenerated.java | 6 +++ .../LightAnalysisModeTestGenerated.java | 5 ++ .../IrJsCodegenBoxES6TestGenerated.java | 5 ++ .../IrJsCodegenBoxTestGenerated.java | 5 ++ .../semantics/JsCodegenBoxTestGenerated.java | 5 ++ .../IrCodegenBoxWasmTestGenerated.java | 5 ++ 9 files changed, 93 insertions(+) create mode 100644 compiler/testData/codegen/box/annotations/genericAnnotations.kt diff --git a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java index adcf3c5c73d..e034fb2f921 100644 --- a/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/fir/fir2ir/tests-gen/org/jetbrains/kotlin/test/runners/codegen/FirBlackBoxCodegenTestGenerated.java @@ -136,6 +136,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @Test + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @Test @TestMetadata("javaAnnotationArrayValueDefault.kt") public void testJavaAnnotationArrayValueDefault() throws Exception { diff --git a/compiler/testData/codegen/box/annotations/genericAnnotations.kt b/compiler/testData/codegen/box/annotations/genericAnnotations.kt new file mode 100644 index 00000000000..5413135149a --- /dev/null +++ b/compiler/testData/codegen/box/annotations/genericAnnotations.kt @@ -0,0 +1,50 @@ +// IGNORE_BACKEND_FIR: JVM_IR + +// MODULE: lib +// FILE: l1.kt +package ann + +annotation class Test1(val x: Int) + +annotation class Test2(val x: Int = 0) + +interface I + +annotation class Test3>(val x: Test1>) + +class C : I + +annotation class Test4(val x: Array>>) + +class ARG + +annotation class Test5(vararg val xs: Test3>) + +// FILE: l2.kt + +import ann.* + +@Test1(42) +@Test2(38) +@Test3>(Test1(39)) +@Test4([Test3(Test1(40)), Test3(Test1(50)), Test3(Test1(60))]) +//@Test5(*arrayOf(Test3(Test1(70))), *arrayOf(Test3(Test1(80)))) <-- KT-45414 +class O { + fun test(): String = "O" +} + +// MODULE: main(lib) +// FILE: main.kt + +import ann.* + +@Test1(24) +@Test2(83) +@Test3>(Test1(93)) +@Test4([Test3(Test1(44)), Test3(Test1(55)), Test3(Test1(66))]) +//@Test5(*arrayOf(Test3(Test1(77))), *arrayOf(Test3(Test1(88)))) <-- KT-45414 +class K { + fun test(): String = "K" +} + +fun box(): String = O().test() + K().test() \ No newline at end of file diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java index a457d16c748..5b747375c2b 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/BlackBoxCodegenTestGenerated.java @@ -136,6 +136,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @Test + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @Test @TestMetadata("javaAnnotationArrayValueDefault.kt") public void testJavaAnnotationArrayValueDefault() throws Exception { diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java index f4f0f6c2b7d..f4518a0374a 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/codegen/IrBlackBoxCodegenTestGenerated.java @@ -136,6 +136,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @Test + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @Test @TestMetadata("javaAnnotationArrayValueDefault.kt") public void testJavaAnnotationArrayValueDefault() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index a21992f49ea..dc967907f94 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -127,6 +127,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes runTest("compiler/testData/codegen/box/annotations/fileClassWithFileAnnotation.kt"); } + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @TestMetadata("javaAnnotationArrayValueDefault.kt") public void testJavaAnnotationArrayValueDefault() throws Exception { runTest("compiler/testData/codegen/box/annotations/javaAnnotationArrayValueDefault.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java index ed13db9eda1..8be41d5aed9 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java @@ -42,6 +42,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR_ES6, true); } + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @TestMetadata("nestedAnnotation.kt") public void testNestedAnnotation() throws Exception { runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index e3fe07105d5..cd45ea501f5 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -42,6 +42,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true); } + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @TestMetadata("nestedAnnotation.kt") public void testNestedAnnotation() throws Exception { runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index fc2b251625f..4c35b7177e0 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -42,6 +42,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true); } + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @TestMetadata("nestedAnnotation.kt") public void testNestedAnnotation() throws Exception { runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt"); diff --git a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java index cff81972b95..fdf6b197ff2 100644 --- a/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java +++ b/js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/wasm/semantics/IrCodegenBoxWasmTestGenerated.java @@ -42,6 +42,11 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/annotations"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true); } + @TestMetadata("genericAnnotations.kt") + public void testGenericAnnotations() throws Exception { + runTest("compiler/testData/codegen/box/annotations/genericAnnotations.kt"); + } + @TestMetadata("nestedAnnotation.kt") public void testNestedAnnotation() throws Exception { runTest("compiler/testData/codegen/box/annotations/nestedAnnotation.kt");