[Tests] Add tests for matching of expect property against Java property

...via typealias. Java property can be either field or method, which
overrides Kotlin property.

^KT-63624
This commit is contained in:
Roman Efremov
2023-12-07 16:48:24 +01:00
committed by Space Team
parent c322644860
commit 3f95e99e29
16 changed files with 388 additions and 0 deletions
@@ -26190,6 +26190,48 @@ public class DiagnosticCompilerTestFE10TestdataTestGenerated extends AbstractDia
public void testParameterNames() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideInJava.kt")
public void testPropertyAgainstFakeOverrideInJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPrivateFieldAndPublicMethod.kt")
public void testPropertyAgainstJavaPrivateFieldAndPublicMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPublicFieldAndPublicGetter.kt")
public void testPropertyAgainstJavaPublicFieldAndPublicGetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt");
}
@Test
@TestMetadata("propertyAgainstValInJavaWithExtraSetter.kt")
public void testPropertyAgainstValInJavaWithExtraSetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstValInJavaWithExtraSetter.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaField.kt")
public void testVarPropertyAgainstJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaField.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaGetterAndNonFinalField.kt")
public void testVarPropertyAgainstJavaGetterAndNonFinalField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt");
}
}
@Nested
@@ -26190,6 +26190,48 @@ public class LLFirPreresolvedReversedDiagnosticCompilerFE10TestDataTestGenerated
public void testParameterNames() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideInJava.kt")
public void testPropertyAgainstFakeOverrideInJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPrivateFieldAndPublicMethod.kt")
public void testPropertyAgainstJavaPrivateFieldAndPublicMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPublicFieldAndPublicGetter.kt")
public void testPropertyAgainstJavaPublicFieldAndPublicGetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt");
}
@Test
@TestMetadata("propertyAgainstValInJavaWithExtraSetter.kt")
public void testPropertyAgainstValInJavaWithExtraSetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstValInJavaWithExtraSetter.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaField.kt")
public void testVarPropertyAgainstJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaField.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaGetterAndNonFinalField.kt")
public void testVarPropertyAgainstJavaGetterAndNonFinalField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt");
}
}
@Nested
@@ -1959,6 +1959,48 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
public void testParameterNames() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideInJava.kt")
public void testPropertyAgainstFakeOverrideInJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPrivateFieldAndPublicMethod.kt")
public void testPropertyAgainstJavaPrivateFieldAndPublicMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPublicFieldAndPublicGetter.kt")
public void testPropertyAgainstJavaPublicFieldAndPublicGetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt");
}
@Test
@TestMetadata("propertyAgainstValInJavaWithExtraSetter.kt")
public void testPropertyAgainstValInJavaWithExtraSetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstValInJavaWithExtraSetter.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaField.kt")
public void testVarPropertyAgainstJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaField.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaGetterAndNonFinalField.kt")
public void testVarPropertyAgainstJavaGetterAndNonFinalField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt");
}
}
@Nested
@@ -1959,6 +1959,48 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
public void testParameterNames() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideInJava.kt")
public void testPropertyAgainstFakeOverrideInJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPrivateFieldAndPublicMethod.kt")
public void testPropertyAgainstJavaPrivateFieldAndPublicMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPublicFieldAndPublicGetter.kt")
public void testPropertyAgainstJavaPublicFieldAndPublicGetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt");
}
@Test
@TestMetadata("propertyAgainstValInJavaWithExtraSetter.kt")
public void testPropertyAgainstValInJavaWithExtraSetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstValInJavaWithExtraSetter.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaField.kt")
public void testVarPropertyAgainstJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaField.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaGetterAndNonFinalField.kt")
public void testVarPropertyAgainstJavaGetterAndNonFinalField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt");
}
}
@Nested
@@ -0,0 +1,19 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
val foo: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
interface I {
val foo: Int
get() = 1
}
actual typealias Foo = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo implements I {
}
@@ -0,0 +1,22 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
val foo: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Foo = JavaFoo
interface I {
val foo: Int
}
// FILE: JavaFoo.java
public class JavaFoo implements I {
@Override
public int getFoo() {
return 0;
}
}
@@ -0,0 +1,23 @@
// MODULE: m1-common
// FILE: common.kt
interface I {
val foo: Int
}
expect class Foo : I {
override val foo: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo implements I {
private final int foo = 1;
@Override
public int getFoo() {
return 0;
}
}
@@ -0,0 +1,23 @@
// MODULE: m1-common
// FILE: common.kt
interface I {
val foo: Int
}
expect class Foo : I {
override val <!AMBIGUOUS_ACTUALS{JVM}!>foo<!>: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Foo = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo implements I {
private final int foo = 1;
@Override
public int getFoo() {
return 0;
}
}
@@ -0,0 +1 @@
Fails in K2 due to KT-63667
@@ -0,0 +1,24 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
val <!AMBIGUOUS_ACTUALS{JVM}!>foo<!>: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Foo = JavaFoo
interface I {
val foo: Int
}
// FILE: JavaFoo.java
public class JavaFoo implements I {
public final int foo = 1;
@Override
public int getFoo() {
return 0;
}
}
@@ -0,0 +1,25 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
val foo: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
interface I {
val foo: Int
}
actual typealias Foo = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo implements I {
@Override
public int getFoo() {
return 0;
}
public void setFoo(int i) {
}
}
@@ -0,0 +1 @@
Fails in K2 due to KT-63667
@@ -0,0 +1,15 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
var foo: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual typealias Foo = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo {
public int foo = 0;
}
@@ -0,0 +1 @@
Fails in K2 due to KT-63667
@@ -0,0 +1,24 @@
// FIR_IDENTICAL
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
var <!AMBIGUOUS_ACTUALS{JVM}!>foo<!>: Int
}
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
interface I {
val foo: Int
}
actual typealias Foo = JavaFoo
// FILE: JavaFoo.java
public class JavaFoo implements I {
public int foo;
@Override
public int getFoo() {
return 0;
}
}
@@ -26190,6 +26190,48 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
public void testParameterNames() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/parameterNames.kt");
}
@Test
@TestMetadata("propertyAgainstFakeOverrideInJava.kt")
public void testPropertyAgainstFakeOverrideInJava() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstFakeOverrideInJava.kt");
}
@Test
@TestMetadata("propertyAgainstJavaMethod.kt")
public void testPropertyAgainstJavaMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPrivateFieldAndPublicMethod.kt")
public void testPropertyAgainstJavaPrivateFieldAndPublicMethod() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPrivateFieldAndPublicMethod.kt");
}
@Test
@TestMetadata("propertyAgainstJavaPublicFieldAndPublicGetter.kt")
public void testPropertyAgainstJavaPublicFieldAndPublicGetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstJavaPublicFieldAndPublicGetter.kt");
}
@Test
@TestMetadata("propertyAgainstValInJavaWithExtraSetter.kt")
public void testPropertyAgainstValInJavaWithExtraSetter() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/propertyAgainstValInJavaWithExtraSetter.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaField.kt")
public void testVarPropertyAgainstJavaField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaField.kt");
}
@Test
@TestMetadata("varPropertyAgainstJavaGetterAndNonFinalField.kt")
public void testVarPropertyAgainstJavaGetterAndNonFinalField() throws Exception {
runTest("compiler/testData/diagnostics/tests/multiplatform/java/varPropertyAgainstJavaGetterAndNonFinalField.kt");
}
}
@Nested