From be6694f049d60c1be175e8094dc9dd795d51491e Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 11 Dec 2023 16:30:48 +0200 Subject: [PATCH] [Test] Add tests for KT-63076 --- ...CompilerTestFE10TestdataTestGenerated.java | 24 ++++++++ ...sticCompilerFE10TestDataTestGenerated.java | 24 ++++++++ ...eeOldFrontendDiagnosticsTestGenerated.java | 24 ++++++++ ...siOldFrontendDiagnosticsTestGenerated.java | 24 ++++++++ ...eticPropertyFromKotlinGetter_javaOrigin.kt | 58 ++++++++++++++++++ ...opertyFromKotlinGetter_kotlinOrigin.fir.kt | 57 ++++++++++++++++++ ...icPropertyFromKotlinGetter_kotlinOrigin.kt | 57 ++++++++++++++++++ ...cPropertyFromKotlinGetter_mixedOrigin_1.kt | 59 +++++++++++++++++++ ...cPropertyFromKotlinGetter_mixedOrigin_2.kt | 59 +++++++++++++++++++ .../test/runners/DiagnosticTestGenerated.java | 24 ++++++++ 10 files changed, 410 insertions(+) create mode 100644 compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.fir.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt create mode 100644 compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java index b21b4c6f75d..9ebe41ffdd8 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFE10TestdataTestGenerated.java @@ -22419,6 +22419,30 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia runTest("compiler/testData/diagnostics/tests/j+k/properties/staticFieldPropertyOverloads.kt"); } + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_javaOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_javaOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_kotlinOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_kotlinOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_1() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_2() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt"); + } + @Test @TestMetadata("unitVsVoid.kt") public void testUnitVsVoid() throws Exception { diff --git a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java index a344310355e..14b7666cb48 100644 --- a/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java +++ b/analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated.java @@ -22419,6 +22419,30 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated runTest("compiler/testData/diagnostics/tests/j+k/properties/staticFieldPropertyOverloads.kt"); } + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_javaOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_javaOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_kotlinOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_kotlinOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_1() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_2() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt"); + } + @Test @TestMetadata("unitVsVoid.kt") public void testUnitVsVoid() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java index 6cb4f38ba42..9f1c84d8cbc 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeOldFrontendDiagnosticsTestGenerated.java @@ -22413,6 +22413,30 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir runTest("compiler/testData/diagnostics/tests/j+k/properties/staticFieldPropertyOverloads.kt"); } + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_javaOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_javaOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_kotlinOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_kotlinOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_1() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_2() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt"); + } + @Test @TestMetadata("unitVsVoid.kt") public void testUnitVsVoid() throws Exception { diff --git a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java index 44365d6e39b..8594281e0d4 100644 --- a/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java +++ b/compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiOldFrontendDiagnosticsTestGenerated.java @@ -22419,6 +22419,30 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia runTest("compiler/testData/diagnostics/tests/j+k/properties/staticFieldPropertyOverloads.kt"); } + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_javaOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_javaOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_kotlinOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_kotlinOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_1() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_2() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt"); + } + @Test @TestMetadata("unitVsVoid.kt") public void testUnitVsVoid() throws Exception { diff --git a/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt new file mode 100644 index 00000000000..85b9a88c5d4 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt @@ -0,0 +1,58 @@ +// FIR_IDENTICAL +// ISSUE: KT-63076 + +// FILE: A.java +public class A { + public String getX1() { return ""; } + public String getX2() { return ""; } + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: B.kt +open class B : A() { + override fun getX2(): String = "" + override fun getX3(): String = "" + override fun getX4(): String = "" +} + +// FILE: C.java +public class C extends B { + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: D.kt +open class D : C() { + override fun getX4(): String = "" +} + +// FILE: main.kt + +fun test_1(a: A) { + a.x1 + a.x2 + a.x3 + a.x4 +} + +fun test_2(b: B) { + b.x1 + b.x2 + b.x3 + b.x4 +} + +fun test_3(c: C) { + c.x1 + c.x2 + c.x3 + c.x4 +} + +fun test_4(d: D) { + d.x1 + d.x2 + d.x3 + d.x4 +} diff --git a/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.fir.kt b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.fir.kt new file mode 100644 index 00000000000..60fdabaaee5 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.fir.kt @@ -0,0 +1,57 @@ +// ISSUE: KT-63076 + +// FILE: A.kt +open class A { + open fun getX1(): String = "" + open fun getX2(): String = "" + open fun getX3(): String = "" + open fun getX4(): String = "" +} + +// FILE: B.java +public class B extends A { + public String getX2() { return ""; } + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: C.kt +open class C : B() { + override fun getX3(): String = "" + override fun getX4(): String = "" +} + +// FILE: D.java +public class D extends C { + public String getX4() { return ""; } +} + +// FILE: main.kt + +fun test_1(a: A) { + a.x1 + a.x2 + a.x3 + a.x4 +} + +fun test_2(b: B) { + b.x1 + b.x2 + b.x3 + b.x4 +} + +fun test_3(c: C) { + c.x1 + c.x2 + c.x3 + c.x4 +} + +fun test_4(d: D) { + d.x1 + d.x2 + d.x3 + d.x4 +} diff --git a/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt new file mode 100644 index 00000000000..0eabd0f7de6 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt @@ -0,0 +1,57 @@ +// ISSUE: KT-63076 + +// FILE: A.kt +open class A { + open fun getX1(): String = "" + open fun getX2(): String = "" + open fun getX3(): String = "" + open fun getX4(): String = "" +} + +// FILE: B.java +public class B extends A { + public String getX2() { return ""; } + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: C.kt +open class C : B() { + override fun getX3(): String = "" + override fun getX4(): String = "" +} + +// FILE: D.java +public class D extends C { + public String getX4() { return ""; } +} + +// FILE: main.kt + +fun test_1(a: A) { + a.x1 + a.x2 + a.x3 + a.x4 +} + +fun test_2(b: B) { + b.x1 + b.x2 + b.x3 + b.x4 +} + +fun test_3(c: C) { + c.x1 + c.x2 + c.x3 + c.x4 +} + +fun test_4(d: D) { + d.x1 + d.x2 + d.x3 + d.x4 +} diff --git a/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt new file mode 100644 index 00000000000..3bba1fd58db --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt @@ -0,0 +1,59 @@ +// FIR_IDENTICAL +// ISSUE: KT-63076 + +// FILE: AK.kt +open class AK { + open fun getX1(): String = "" + open fun getX2(): String = "" + open fun getX3(): String = "" + open fun getX4(): String = "" +} + +// FILE: AJ.java +public interface AJ { + String getX1(); + String getX2(); + String getX3(); + String getX4(); +} + +// FILE: B.java +public class B extends AK implements AJ { + public String getX2() { return ""; } + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: C.kt +open class C : B() { + override fun getX3(): String = "" + override fun getX4(): String = "" +} + +// FILE: D.java +public class D extends C { + public String getX4() { return ""; } +} + +// FILE: main.kt + +fun test_1(b: B) { + b.x1 + b.x2 + b.x3 + b.x4 +} + +fun test_2(c: C) { + c.x1 + c.x2 + c.x3 + c.x4 +} + +fun test_3(d: D) { + d.x1 + d.x2 + d.x3 + d.x4 +} diff --git a/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt new file mode 100644 index 00000000000..8bf878e8393 --- /dev/null +++ b/compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt @@ -0,0 +1,59 @@ +// FIR_IDENTICAL +// ISSUE: KT-63076 + +// FILE: AK.kt +open class AK { + open fun getX1(): String = "" + open fun getX2(): String = "" + open fun getX3(): String = "" + open fun getX4(): String = "" +} + +// FILE: AJ.java +public interface AJ { + String getX1(); + String getX2(); + String getX3(); + String getX4(); +} + +// FILE: B.kt +open class B : AK(), AJ { + override fun getX2(): String = "" + override fun getX3(): String = "" + override fun getX4(): String = "" +} + +// FILE: C.java +public class C extends B { + public String getX3() { return ""; } + public String getX4() { return ""; } +} + +// FILE: D.kt +open class D : C() { + override fun getX4(): String = "" +} + +// FILE: main.kt + +fun test_1(b: B) { + b.x1 + b.x2 + b.x3 + b.x4 +} + +fun test_2(c: C) { + c.x1 + c.x2 + c.x3 + c.x4 +} + +fun test_3(d: D) { + d.x1 + d.x2 + d.x3 + d.x4 +} 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 bc399803320..b7d7453aafb 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 @@ -22419,6 +22419,30 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest { runTest("compiler/testData/diagnostics/tests/j+k/properties/staticFieldPropertyOverloads.kt"); } + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_javaOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_javaOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_javaOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_kotlinOrigin.kt") + public void testSyntheticPropertyFromKotlinGetter_kotlinOrigin() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_kotlinOrigin.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_1() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_1.kt"); + } + + @Test + @TestMetadata("syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt") + public void testSyntheticPropertyFromKotlinGetter_mixedOrigin_2() throws Exception { + runTest("compiler/testData/diagnostics/tests/j+k/properties/syntheticPropertyFromKotlinGetter_mixedOrigin_2.kt"); + } + @Test @TestMetadata("unitVsVoid.kt") public void testUnitVsVoid() throws Exception {