Move optionalExpectationIncorrectUse from MPP integration to diagnostics tests
This commit is contained in:
committed by
Space Team
parent
93124ee98c
commit
dc1f1fe979
+6
@@ -241,6 +241,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
|||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt");
|
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
|
@Test
|
||||||
@TestMetadata("privateTopLevelDeclarations.kt")
|
@TestMetadata("privateTopLevelDeclarations.kt")
|
||||||
public void testPrivateTopLevelDeclarations() throws Exception {
|
public void testPrivateTopLevelDeclarations() throws Exception {
|
||||||
|
|||||||
+6
@@ -241,6 +241,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
|||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt");
|
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
|
@Test
|
||||||
@TestMetadata("privateTopLevelDeclarations.kt")
|
@TestMetadata("privateTopLevelDeclarations.kt")
|
||||||
public void testPrivateTopLevelDeclarations() throws Exception {
|
public void testPrivateTopLevelDeclarations() throws Exception {
|
||||||
|
|||||||
+41
@@ -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()
|
||||||
|
|
||||||
|
<!NO_ACTUAL_FOR_EXPECT{JVM}!><!WRONG_ANNOTATION_TARGET!>@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
|
||||||
|
}
|
||||||
+41
@@ -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: <!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY{JVM}!>A<!>) = a.toString()
|
||||||
|
|
||||||
|
<!WRONG_ANNOTATION_TARGET, WRONG_ANNOTATION_TARGET{JVM}!>@OptionalExpectation<!>
|
||||||
|
expect class <!NO_ACTUAL_FOR_EXPECT{JVM}!>NotAnAnnotationClass<!>
|
||||||
|
|
||||||
|
<!OPTIONAL_EXPECTATION_NOT_ON_EXPECTED, OPTIONAL_EXPECTATION_NOT_ON_EXPECTED{JVM}!>@OptionalExpectation<!>
|
||||||
|
annotation class NotAnExpectedClass
|
||||||
|
|
||||||
|
annotation class InOtherAnnotation(val a: <!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY{JVM}!>A<!>)
|
||||||
|
|
||||||
|
@InOtherAnnotation(<!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY{JVM}!>A<!>())
|
||||||
|
fun useInOtherAnnotation() {}
|
||||||
|
|
||||||
|
expect class C {
|
||||||
|
@OptionalExpectation
|
||||||
|
annotation class Nested
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: platform()()(common)
|
||||||
|
// FILE: platform.kt
|
||||||
|
|
||||||
|
fun useInReturnType(): <!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE!>A<!>? = null
|
||||||
|
|
||||||
|
annotation class AnotherAnnotation(val a: <!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE!>A<!>)
|
||||||
|
|
||||||
|
@AnotherAnnotation(<!OPTIONAL_DECLARATION_OUTSIDE_OF_ANNOTATION_ENTRY, OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE!>A<!>())
|
||||||
|
fun useInAnotherAnnotation() {}
|
||||||
|
|
||||||
|
actual class C {
|
||||||
|
actual annotation class Nested
|
||||||
|
}
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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
|
|
||||||
}
|
|
||||||
@@ -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 <main> 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())
|
|
||||||
^
|
|
||||||
Generated
+6
@@ -22920,6 +22920,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/namedArguments.kt");
|
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
|
@Test
|
||||||
@TestMetadata("privateTopLevelDeclarations.kt")
|
@TestMetadata("privateTopLevelDeclarations.kt")
|
||||||
public void testPrivateTopLevelDeclarations() throws Exception {
|
public void testPrivateTopLevelDeclarations() throws Exception {
|
||||||
|
|||||||
Generated
-18
@@ -119,11 +119,6 @@ public class MultiPlatformIntegrationTestGenerated extends AbstractMultiPlatform
|
|||||||
runTest("compiler/testData/multiplatform/optionalExpectation/");
|
runTest("compiler/testData/multiplatform/optionalExpectation/");
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("optionalExpectationIncorrectUse")
|
|
||||||
public void testOptionalExpectationIncorrectUse() throws Exception {
|
|
||||||
runTest("compiler/testData/multiplatform/optionalExpectationIncorrectUse/");
|
|
||||||
}
|
|
||||||
|
|
||||||
@TestMetadata("simple")
|
@TestMetadata("simple")
|
||||||
public void testSimple() throws Exception {
|
public void testSimple() throws Exception {
|
||||||
runTest("compiler/testData/multiplatform/simple/");
|
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")
|
@TestMetadata("compiler/testData/multiplatform/regressions")
|
||||||
@TestDataPath("$PROJECT_ROOT")
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
@RunWith(JUnit3RunnerWithInners.class)
|
@RunWith(JUnit3RunnerWithInners.class)
|
||||||
|
|||||||
Reference in New Issue
Block a user