From fd057ac68a04a05a06e904d11bc598145aaca3ce Mon Sep 17 00:00:00 2001 From: Mikhail Glukhikh Date: Mon, 16 Oct 2023 11:00:09 +0200 Subject: [PATCH] FE: Add two more tests around KT-59561 --- ...DiagnosticsWithLightTreeTestGenerated.java | 12 +++++++++++ ...endMPPDiagnosticsWithPsiTestGenerated.java | 12 +++++++++++ .../annotationMatching/arrayVsOutArray.fir.kt | 20 +++++++++++++++++++ .../annotationMatching/arrayVsOutArray.kt | 20 +++++++++++++++++++ .../annotationMatching/arrayVsVararg.fir.kt | 15 ++++++++++++++ .../annotationMatching/arrayVsVararg.kt | 15 ++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 12 +++++++++++ 7 files changed, 106 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.fir.kt create mode 100644 compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt 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 1d612ad092f..feca175bda6 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 @@ -800,6 +800,18 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationTypeParameters.kt"); } + @Test + @TestMetadata("arrayVsOutArray.kt") + public void testArrayVsOutArray() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt"); + } + + @Test + @TestMetadata("arrayVsVararg.kt") + public void testArrayVsVararg() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt"); + } + @Test @TestMetadata("basicOnDeclaration.kt") public void testBasicOnDeclaration() 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 2d3a3bf697d..50aa9103d0b 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 @@ -800,6 +800,18 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationTypeParameters.kt"); } + @Test + @TestMetadata("arrayVsOutArray.kt") + public void testArrayVsOutArray() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt"); + } + + @Test + @TestMetadata("arrayVsVararg.kt") + public void testArrayVsVararg() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt"); + } + @Test @TestMetadata("basicOnDeclaration.kt") public void testBasicOnDeclaration() throws Exception { diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.fir.kt new file mode 100644 index 00000000000..6f2c5fa6480 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.fir.kt @@ -0,0 +1,20 @@ +// MODULE: m1-common +// FILE: common.kt + +expect annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test() {} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt + +actual annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test2() {} + +annotation class B(val x: Array) + +@B("abc", "foo", "bar") +fun test3() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt new file mode 100644 index 00000000000..9ea7834456f --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt @@ -0,0 +1,20 @@ +// MODULE: m1-common +// FILE: common.kt + +expect annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test() {} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt + +actual annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test2() {} + +annotation class B(val x: Array) + +@B("abc", "foo", "bar") +fun test3() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.fir.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.fir.kt new file mode 100644 index 00000000000..e72ef19eb28 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.fir.kt @@ -0,0 +1,15 @@ +// MODULE: m1-common +// FILE: common.kt + +expect annotation class A; ; some value parameter is vararg in one declaration and non-vararg in the other")!>(vararg val x: String) + +@A("abc", "foo", "bar") +fun test() {} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt + +actual annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test2() {} diff --git a/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt new file mode 100644 index 00000000000..4157f8947e8 --- /dev/null +++ b/compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt @@ -0,0 +1,15 @@ +// MODULE: m1-common +// FILE: common.kt + +expect annotation class A(vararg val x: String) + +@A("abc", "foo", "bar") +fun test() {} + +// MODULE: m1-jvm()()(m1-common) +// FILE: jvm.kt + +actual annotation class A(val x: Array) + +@A("abc", "foo", "bar") +fun test2() {} 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 d1599d83d34..bdea7cf4cd9 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 @@ -23975,6 +23975,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/annotationTypeParameters.kt"); } + @Test + @TestMetadata("arrayVsOutArray.kt") + public void testArrayVsOutArray() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsOutArray.kt"); + } + + @Test + @TestMetadata("arrayVsVararg.kt") + public void testArrayVsVararg() throws Exception { + runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/arrayVsVararg.kt"); + } + @Test @TestMetadata("basicOnDeclaration.kt") public void testBasicOnDeclaration() throws Exception {