[Test] Add test for ugly K2 reporting of annotation arguments
...in `ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT` diagnostic message. ^KT-62585
This commit is contained in:
committed by
Space Team
parent
67ac985be7
commit
b3467353b2
+6
@@ -770,6 +770,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/annotationMatching"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgRendering.kt")
|
||||
public void testAnnotationArgRendering() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentsConstExpressions.kt")
|
||||
public void testAnnotationArgumentsConstExpressions() throws Exception {
|
||||
|
||||
+6
@@ -770,6 +770,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/annotationMatching"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgRendering.kt")
|
||||
public void testAnnotationArgRendering() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentsConstExpressions.kt")
|
||||
public void testAnnotationArgumentsConstExpressions() throws Exception {
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)
|
||||
expect annotation class Ann
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
|
||||
annotation class Ann2(val s: String)
|
||||
|
||||
@Ann2("1" + "2")
|
||||
expect fun stringConcat()
|
||||
|
||||
expect fun onType(): @Ann2("") Any?
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual annotation class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("annotation class Ann : Annotation; annotation class Ann : Annotation; Annotation `@Target(allowedTargets = vararg(Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.FUNCTION|, Q|kotlin/annotation/AnnotationTarget|.R|kotlin/annotation/AnnotationTarget.CLASS|))` is missing on actual declaration")!>Ann<!><!>
|
||||
|
||||
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun stringConcat(): Unit; fun stringConcat(): Unit; Annotation `@Ann2(s = String(1).R|kotlin/String.plus|(String(2)))` is missing on actual declaration")!>stringConcat<!>() {}<!>
|
||||
|
||||
// Not reported in K1, because supported starting from K2
|
||||
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun onType(): @R|Ann2|(s = String()) Any?; fun onType(): Any?; Annotation `@Ann2(s = String())` is missing on actual declaration")!>onType<!>(): Any? = null<!>
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// WITH_STDLIB
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.CLASS)
|
||||
expect annotation class Ann
|
||||
|
||||
@Target(AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
|
||||
annotation class Ann2(val s: String)
|
||||
|
||||
@Ann2("1" + "2")
|
||||
expect fun stringConcat()
|
||||
|
||||
expect fun onType(): @Ann2("") Any?
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
actual annotation class <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("annotation class Ann : Annotation defined in root package in file common.kt; annotation class Ann : Annotation defined in root package in file jvm.kt; Annotation `@Target(allowedTargets = {AnnotationTarget.FUNCTION, AnnotationTarget.CLASS})` is missing on actual declaration")!>Ann<!>
|
||||
|
||||
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT("fun stringConcat(): Unit defined in root package in file common.kt; fun stringConcat(): Unit defined in root package in file jvm.kt; Annotation `@Ann2(s = "12")` is missing on actual declaration")!>stringConcat<!>() {}
|
||||
|
||||
// Not reported in K1, because supported starting from K2
|
||||
actual fun onType(): Any? = null
|
||||
Generated
+6
@@ -23999,6 +23999,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/annotationMatching"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgRendering.kt")
|
||||
public void testAnnotationArgRendering() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationArgRendering.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationArgumentsConstExpressions.kt")
|
||||
public void testAnnotationArgumentsConstExpressions() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user