[Test] Add test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic

...when annotations arguments are lazily resolved.

MR: KT-MR-12245

^KT-60671
This commit is contained in:
Roman Efremov
2023-10-05 14:32:40 +02:00
committed by Space Team
parent 423f4ca5f0
commit 4c75fb108f
8 changed files with 139 additions and 0 deletions
@@ -22814,6 +22814,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/multimodule/dependsOnModule.kt");
}
@Test
@TestMetadata("expectActualAnnotationsWithLazyResolve.kt")
public void testExpectActualAnnotationsWithLazyResolve() throws Exception {
runTest("compiler/testData/diagnostics/tests/multimodule/expectActualAnnotationsWithLazyResolve.kt");
}
@Test
@TestMetadata("friendModule.kt")
public void testFriendModule() throws Exception {
@@ -22814,6 +22814,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/multimodule/dependsOnModule.kt");
}
@Test
@TestMetadata("expectActualAnnotationsWithLazyResolve.kt")
public void testExpectActualAnnotationsWithLazyResolve() throws Exception {
runTest("compiler/testData/diagnostics/tests/multimodule/expectActualAnnotationsWithLazyResolve.kt");
}
@Test
@TestMetadata("friendModule.kt")
public void testFriendModule() throws Exception {
@@ -22814,6 +22814,12 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/multimodule/dependsOnModule.kt");
}
@Test
@TestMetadata("expectActualAnnotationsWithLazyResolve.kt")
public void testExpectActualAnnotationsWithLazyResolve() throws Exception {
runTest("compiler/testData/diagnostics/tests/multimodule/expectActualAnnotationsWithLazyResolve.kt");
}
@Test
@TestMetadata("friendModule.kt")
public void testFriendModule() throws Exception {
@@ -22820,6 +22820,12 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/multimodule/dependsOnModule.kt");
}
@Test
@TestMetadata("expectActualAnnotationsWithLazyResolve.kt")
public void testExpectActualAnnotationsWithLazyResolve() throws Exception {
runTest("compiler/testData/diagnostics/tests/multimodule/expectActualAnnotationsWithLazyResolve.kt");
}
@Test
@TestMetadata("friendModule.kt")
public void testFriendModule() throws Exception {
@@ -0,0 +1,35 @@
// Test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic when annotations arguments are lazily resolved.
// LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
@Target(AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
annotation class Ann(val s: String = "default")
expect fun onType_negative(): @Ann("") Any
expect fun onType_positive(): @Ann("") Any
@Ann("")
expect fun onFunction_negative()
@Ann("")
expect fun onFunction_positive()
@Ann
expect fun withEmptyArguments_negative()
@Ann
expect fun withEmptyArguments_positive()
// MODULE: main()()(common)
// TARGET_PLATFORM: JVM
actual fun onType_negative(): @Ann("") Any = Any()
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onType_positive<!>(): @Ann("incorrect") Any = Any()
@Ann("")
actual fun onFunction_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onFunction_positive<!>() {}
@Ann
actual fun withEmptyArguments_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>withEmptyArguments_positive<!>() {}
@@ -0,0 +1,35 @@
// Test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic when annotations arguments are lazily resolved.
// LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
@Target(AnnotationTarget.TYPE, AnnotationTarget.FUNCTION)
annotation class Ann(val s: String = "default")
expect fun onType_negative(): @Ann("") Any
expect fun onType_positive(): @Ann("") Any
@Ann("")
expect fun onFunction_negative()
@Ann("")
expect fun onFunction_positive()
@Ann
expect fun withEmptyArguments_negative()
@Ann
expect fun withEmptyArguments_positive()
// MODULE: main()()(common)
// TARGET_PLATFORM: JVM
actual fun onType_negative(): @Ann("") Any = Any()
actual fun onType_positive(): @Ann("incorrect") Any = Any()
@Ann("")
actual fun onFunction_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onFunction_positive<!>() {}
@Ann
actual fun withEmptyArguments_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>withEmptyArguments_positive<!>() {}
@@ -0,0 +1,39 @@
// LL_FIR_DIVERGENCE
// The reason is bug, which will be fixed in next commit
// LL_FIR_DIVERGENCE
// Test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic when annotations arguments are lazily resolved.
// LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
@Target(AnnotationTarget.<!MISSING_DEPENDENCY_SUPERCLASS!>TYPE<!>, AnnotationTarget.<!MISSING_DEPENDENCY_SUPERCLASS!>FUNCTION<!>)
annotation class Ann(val s: String = "default")
expect fun onType_negative(): @Ann("") Any
expect fun onType_positive(): @Ann("") Any
@Ann("")
expect fun onFunction_negative()
@Ann("")
expect fun onFunction_positive()
@Ann
expect fun withEmptyArguments_negative()
@Ann
expect fun withEmptyArguments_positive()
// MODULE: main()()(common)
// TARGET_PLATFORM: JVM
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onType_negative<!>(): @Ann("") Any = Any()
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onType_positive<!>(): @Ann("incorrect") Any = Any()
@Ann("")
actual fun onFunction_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onFunction_positive<!>() {}
@Ann
actual fun withEmptyArguments_negative() {}
@Ann("incorrect")
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>withEmptyArguments_positive<!>() {}
@@ -22820,6 +22820,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/multimodule/dependsOnModule.kt");
}
@Test
@TestMetadata("expectActualAnnotationsWithLazyResolve.kt")
public void testExpectActualAnnotationsWithLazyResolve() throws Exception {
runTest("compiler/testData/diagnostics/tests/multimodule/expectActualAnnotationsWithLazyResolve.kt");
}
@Test
@TestMetadata("friendModule.kt")
public void testFriendModule() throws Exception {