From d5987fd7f394a01203860d6abf393e85dd353d93 Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Wed, 12 Feb 2020 14:21:55 +0100 Subject: [PATCH] Minor, move wrongAnnotationArgumentInCtor.kt to CLI tests The fact that this was a codegen box test was probably an abuse of the testing infrastructure. It was never meant to pass, since it checks presence of an error, and diagnostic tests aren't enough since they might not check the full compiler execution. --- .../jvm/wrongAnnotationArgumentInCtor.args | 3 +++ .../cli/jvm/wrongAnnotationArgumentInCtor.kt | 11 ++++++++++ .../cli/jvm/wrongAnnotationArgumentInCtor.out | 4 ++++ .../wrongAnnotationArgumentInCtor.kt | 20 ------------------- .../kotlin/cli/CliTestGenerated.java | 5 +++++ .../codegen/BlackBoxCodegenTestGenerated.java | 5 ----- .../LightAnalysisModeTestGenerated.java | 5 ----- .../ir/FirBlackBoxCodegenTestGenerated.java | 5 ----- .../ir/IrBlackBoxCodegenTestGenerated.java | 5 ----- .../IrJsCodegenBoxTestGenerated.java | 5 ----- .../semantics/JsCodegenBoxTestGenerated.java | 5 ----- 11 files changed, 23 insertions(+), 50 deletions(-) create mode 100644 compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.args create mode 100644 compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt create mode 100644 compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.out delete mode 100644 compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt diff --git a/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.args b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.args new file mode 100644 index 00000000000..1b9301573a0 --- /dev/null +++ b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.args @@ -0,0 +1,3 @@ +$TESTDATA_DIR$/wrongAnnotationArgumentInCtor.kt +-d +$TEMP_DIR$ diff --git a/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt new file mode 100644 index 00000000000..51ae39fe192 --- /dev/null +++ b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt @@ -0,0 +1,11 @@ +@Target(AnnotationTarget.FIELD, AnnotationTarget.CLASS) +annotation class Anno + +class UnresolvedArgument(@Anno(BLA) val s: Int) + +class WithoutArguments(@Deprecated val s: Int) + +fun test() { + UnresolvedArgument(3) + WithoutArguments(0) +} diff --git a/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.out b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.out new file mode 100644 index 00000000000..14a73ecdbbd --- /dev/null +++ b/compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.out @@ -0,0 +1,4 @@ +compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.kt:6:25: error: no value passed for parameter 'message' +class WithoutArguments(@Deprecated val s: Int) + ^ +COMPILATION_ERROR diff --git a/compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt b/compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt deleted file mode 100644 index 8cc35322c85..00000000000 --- a/compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt +++ /dev/null @@ -1,20 +0,0 @@ -// IGNORE_BACKEND_FIR: JVM_IR -// IGNORE_BACKEND: JVM_IR -// IGNORE_BACKEND: JS_IR -// IGNORE_BACKEND: JVM, JS, NATIVE - -// Here we check that there is compilation error, so ignore_backend directive is actual - -@Target(AnnotationTarget.FIELD, AnnotationTarget.CLASS) -annotation class Anno - -class UnresolvedArgument(@Anno(BLA) val s: Int) - -class WithoutArguments(@Deprecated val s: Int) - -fun box(): String { - UnresolvedArgument(3) - WithoutArguments(0) - - return "OK" -} diff --git a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java index 931bd48e17b..8130ab2bda6 100644 --- a/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -735,6 +735,11 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/wrongAbiVersion.args"); } + @TestMetadata("wrongAnnotationArgumentInCtor.args") + public void testWrongAnnotationArgumentInCtor() throws Exception { + runTest("compiler/testData/cli/jvm/wrongAnnotationArgumentInCtor.args"); + } + @TestMetadata("wrongArgument.args") public void testWrongArgument() throws Exception { runTest("compiler/testData/cli/jvm/wrongArgument.args"); diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java index 3f2693abcbd..94802f6462d 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestGenerated.java @@ -216,11 +216,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest { runTest("compiler/testData/codegen/box/annotations/varargInAnnotationParameter.kt"); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java index 402f4979589..433238bb3fe 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/LightAnalysisModeTestGenerated.java @@ -33,11 +33,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) public static class Annotations extends AbstractLightAnalysisModeTest { - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void ignoreWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - private void runTest(String testDataFilePath) throws Exception { KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath); } diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java index 305b3708bab..a02ba0fe33b 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/FirBlackBoxCodegenTestGenerated.java @@ -216,11 +216,6 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT runTest("compiler/testData/codegen/box/annotations/varargInAnnotationParameter.kt"); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java index f80ef5b4761..9b09b63d8d8 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxCodegenTestGenerated.java @@ -216,11 +216,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes runTest("compiler/testData/codegen/box/annotations/varargInAnnotationParameter.kt"); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java index 5e077a5a494..6e832061441 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenBoxTestGenerated.java @@ -61,11 +61,6 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest { runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java index fefd47d9a51..f966b8bcfb6 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenBoxTestGenerated.java @@ -61,11 +61,6 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest { runTest("compiler/testData/codegen/box/annotations/resolveWithLowPriorityAnnotation.kt"); } - @TestMetadata("wrongAnnotationArgumentInCtor.kt") - public void testWrongAnnotationArgumentInCtor() throws Exception { - runTest("compiler/testData/codegen/box/annotations/wrongAnnotationArgumentInCtor.kt"); - } - @TestMetadata("compiler/testData/codegen/box/annotations/annotatedLambda") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)