[Test] Write reproducer test for expect-actual matching to Java field

..., which comes from super class, which incorrectly works in K2.

^KT-63624
This commit is contained in:
Roman Efremov
2024-01-16 17:59:36 +01:00
committed by Space Team
parent bb044bb57e
commit 3d2a37ee41
7 changed files with 86 additions and 0 deletions
@@ -26551,6 +26551,12 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideOfJavaField.kt")
public void testPropertyAgainstFakeOverrideOfJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideOfJavaField.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
@@ -26551,6 +26551,12 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideOfJavaField.kt")
public void testPropertyAgainstFakeOverrideOfJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideOfJavaField.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
@@ -1978,6 +1978,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideOfJavaField.kt")
public void testPropertyAgainstFakeOverrideOfJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideOfJavaField.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
@@ -1978,6 +1978,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideOfJavaField.kt")
public void testPropertyAgainstFakeOverrideOfJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideOfJavaField.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
@@ -0,0 +1,28 @@
// MODULE: m1-common
// FILE: common.kt
expect class MyHashMap<K, V> {
val values: Collection<V>
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
interface MyMap<K, V> {
val values: Collection<V>
}
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>MyHashMap<!><K, V> = MyHashMapJava<K, V>
// FILE: MyHashMapJava.java
import java.util.Collection;
public final class MyHashMapJava<K, V> extends AbstractMyHashMap<K, V> {
// fake override of field AbstractMyHashMap.values
}
abstract class AbstractMyHashMap<K, V> implements MyMap<K, V> {
protected Collection<V> values;
@Override
public Collection<V> getValues() {
return values;
}
}
@@ -0,0 +1,28 @@
// MODULE: m1-common
// FILE: common.kt
expect class MyHashMap<K, V> {
val values: Collection<V>
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
interface MyMap<K, V> {
val values: Collection<V>
}
actual typealias MyHashMap<K, V> = MyHashMapJava<K, V>
// FILE: MyHashMapJava.java
import java.util.Collection;
public final class MyHashMapJava<K, V> extends AbstractMyHashMap<K, V> {
// fake override of field AbstractMyHashMap.values
}
abstract class AbstractMyHashMap<K, V> implements MyMap<K, V> {
protected Collection<V> values;
@Override
public Collection<V> getValues() {
return values;
}
}
@@ -26551,6 +26551,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideOfJavaField.kt")
public void testPropertyAgainstFakeOverrideOfJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideOfJavaField.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {