diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java index 0e49236cb84..bb6cef776e2 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated.java @@ -241,6 +241,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt"); } + @Test + @TestMetadata("optionalExpectationDiagnostics.kt") + public void testOptionalExpectationDiagnostics() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt"); + } + @Test @TestMetadata("privateTopLevelDeclarations.kt") public void testPrivateTopLevelDeclarations() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java index 415a89590bf..bd638ca3a4b 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendMPPDiagnosticsWithPsiTestGenerated.java @@ -241,6 +241,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt"); } + @Test + @TestMetadata("optionalExpectationDiagnostics.kt") + public void testOptionalExpectationDiagnostics() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt"); + } + @Test @TestMetadata("privateTopLevelDeclarations.kt") public void testPrivateTopLevelDeclarations() throws Exception { diff --git a/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.fir.kt new file mode 100644 index 00000000000..1508c50ee28 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.fir.kt @@ -0,0 +1,41 @@ +// WITH_STDLIB +// !OPT_IN: kotlin.ExperimentalMultiplatform + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +@OptionalExpectation +expect annotation class A() + +fun useInSignature(a: A) = a.toString() + +@OptionalExpectation +expect class NotAnAnnotationClass + +@OptionalExpectation +annotation class NotAnExpectedClass + +annotation class InOtherAnnotation(val a: A) + +@InOtherAnnotation(A()) +fun useInOtherAnnotation() {} + +expect class C { + @OptionalExpectation + annotation class Nested +} + +// MODULE: platform()()(common) +// FILE: platform.kt + +fun useInReturnType(): A? = null + +annotation class AnotherAnnotation(val a: A) + +@AnotherAnnotation(A()) +fun useInAnotherAnnotation() {} + +actual class C { + actual annotation class Nested +} diff --git a/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt b/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt new file mode 100644 index 00000000000..16c14c6c26d --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt @@ -0,0 +1,41 @@ +// WITH_STDLIB +// !OPT_IN: kotlin.ExperimentalMultiplatform + +// MODULE: common +// TARGET_PLATFORM: Common +// FILE: common.kt + +@OptionalExpectation +expect annotation class A() + +fun useInSignature(a: A) = a.toString() + +@OptionalExpectation +expect class NotAnAnnotationClass + +@OptionalExpectation +annotation class NotAnExpectedClass + +annotation class InOtherAnnotation(val a: A) + +@InOtherAnnotation(A()) +fun useInOtherAnnotation() {} + +expect class C { + @OptionalExpectation + annotation class Nested +} + +// MODULE: platform()()(common) +// FILE: platform.kt + +fun useInReturnType(): A? = null + +annotation class AnotherAnnotation(val a: A) + +@AnotherAnnotation(A()) +fun useInAnotherAnnotation() {} + +actual class C { + actual annotation class Nested +} diff --git a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt b/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt deleted file mode 100644 index 1f0557b4212..00000000000 --- a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_STDLIB -// ADDITIONAL_COMPILER_ARGUMENTS: -opt-in=kotlin.ExperimentalMultiplatform - -@OptionalExpectation -expect annotation class A() - -fun useInSignature(a: A) = a.toString() - -@OptionalExpectation -expect class NotAnAnnotationClass - -@OptionalExpectation -annotation class NotAnExpectedClass - - - -annotation class InOtherAnnotation(val a: A) - -@InOtherAnnotation(A()) -fun useInOtherAnnotation() {} - - -expect class C { - @OptionalExpectation - annotation class Nested -} diff --git a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt b/compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt deleted file mode 100644 index b9e13920d44..00000000000 --- a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt +++ /dev/null @@ -1,10 +0,0 @@ -fun useInReturnType(): A? = null - -annotation class AnotherAnnotation(val a: A) - -@AnotherAnnotation(A()) -fun useInAnotherAnnotation() {} - -actual class C { - actual annotation class Nested -} diff --git a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/output.txt b/compiler/testData/multiplatform/optionalExpectationIncorrectUse/output.txt deleted file mode 100644 index d3f482bea17..00000000000 --- a/compiler/testData/multiplatform/optionalExpectationIncorrectUse/output.txt +++ /dev/null @@ -1,58 +0,0 @@ --- Common -- -Exit code: COMPILATION_ERROR -Output: -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:7:23: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -fun useInSignature(a: A) = a.toString() - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:9:1: error: this annotation is not applicable to target 'class' -@OptionalExpectation -^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:12:1: error: '@OptionalExpectation' can only be used on an expected annotation class -@OptionalExpectation -^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:17:43: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -annotation class InOtherAnnotation(val a: A) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:19:20: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -@InOtherAnnotation(A()) - ^ - --- JVM -- -Exit code: COMPILATION_ERROR -Output: -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:7:23: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -fun useInSignature(a: A) = a.toString() - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:9:1: error: this annotation is not applicable to target 'class' -@OptionalExpectation -^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:10:14: error: expected class 'NotAnAnnotationClass' has no actual declaration in module
for JVM -expect class NotAnAnnotationClass - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:12:1: error: '@OptionalExpectation' can only be used on an expected annotation class -@OptionalExpectation -^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:17:43: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -annotation class InOtherAnnotation(val a: A) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/common.kt:19:20: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -@InOtherAnnotation(A()) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:1:24: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -fun useInReturnType(): A? = null - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:1:24: error: declaration annotated with '@OptionalExpectation' can only be used in common module sources -fun useInReturnType(): A? = null - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:3:43: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -annotation class AnotherAnnotation(val a: A) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:3:43: error: declaration annotated with '@OptionalExpectation' can only be used in common module sources -annotation class AnotherAnnotation(val a: A) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:5:20: error: declaration annotated with '@OptionalExpectation' can only be used inside an annotation entry -@AnotherAnnotation(A()) - ^ -compiler/testData/multiplatform/optionalExpectationIncorrectUse/jvm.kt:5:20: error: declaration annotated with '@OptionalExpectation' can only be used in common module sources -@AnotherAnnotation(A()) - ^ diff --git a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java index 10d9ae27c6e..cd4518a5d60 100644 --- a/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java +++ b/compiler/tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java @@ -22920,6 +22920,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt"); } + @Test + @TestMetadata("optionalExpectationDiagnostics.kt") + public void testOptionalExpectationDiagnostics() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/optionalExpectationDiagnostics.kt"); + } + @Test @TestMetadata("privateTopLevelDeclarations.kt") public void testPrivateTopLevelDeclarations() throws Exception { diff --git a/compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java index 4b7312bfa59..9089b3f0000 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/multiplatform/MultiPlatformIntegrationTestGenerated.java @@ -119,11 +119,6 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform runTest("compiler/testData/multiplatform/optionalExpectation/"); } - @TestMetadata("optionalExpectationIncorrectUse") - public void testOptionalExpectationIncorrectUse() throws Exception { - runTest("compiler/testData/multiplatform/optionalExpectationIncorrectUse/"); - } - @TestMetadata("simple") public void testSimple() throws Exception { runTest("compiler/testData/multiplatform/simple/"); @@ -700,19 +695,6 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform } } - @TestMetadata("compiler/testData/multiplatform/optionalExpectationIncorrectUse") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class OptionalExpectationIncorrectUse extends AbstractMultiPlatformIntegrationTest { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInOptionalExpectationIncorrectUse() throws Exception { - KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/multiplatform/optionalExpectationIncorrectUse"), Pattern.compile("^([^\\.]+)$"), null, true); - } - } - @TestMetadata("compiler/testData/multiplatform/regressions") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)