[Test] Add tests for expect class default arguments which actualized
...by fake-override. ^KT-62036
This commit is contained in:
committed by
Space Team
parent
7ad23aeb73
commit
02680442a0
+58
@@ -1089,6 +1089,64 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
|||||||
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class MethodDefaultArgsViaActualFakeOverride {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInMethodDefaultArgsViaActualFakeOverride() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("constructor.kt")
|
||||||
|
public void testConstructor() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/constructor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("delegation.kt")
|
||||||
|
public void testDelegation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/delegation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("intersectionOverride.kt")
|
||||||
|
public void testIntersectionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/intersectionOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nestedClass.kt")
|
||||||
|
public void testNestedClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/nestedClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("realOverride.kt")
|
||||||
|
public void testRealOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/realOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simple.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simpleIncompatible.kt")
|
||||||
|
public void testSimpleIncompatible() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simpleIncompatible.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("substitutionOverride.kt")
|
||||||
|
public void testSubstitutionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/substitutionOverride.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+58
@@ -1089,6 +1089,64 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
|||||||
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class MethodDefaultArgsViaActualFakeOverride {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInMethodDefaultArgsViaActualFakeOverride() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), TargetBackend.JVM_IR, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("constructor.kt")
|
||||||
|
public void testConstructor() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/constructor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("delegation.kt")
|
||||||
|
public void testDelegation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/delegation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("intersectionOverride.kt")
|
||||||
|
public void testIntersectionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/intersectionOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nestedClass.kt")
|
||||||
|
public void testNestedClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/nestedClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("realOverride.kt")
|
||||||
|
public void testRealOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/realOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simple.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simpleIncompatible.kt")
|
||||||
|
public void testSimpleIncompatible() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simpleIncompatible.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("substitutionOverride.kt")
|
||||||
|
public void testSubstitutionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/substitutionOverride.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo(p: Int = 1)
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base(p1: Int, p2: Int, p3: Int) {
|
||||||
|
constructor(p1: Int, p2: Int) : this(p1, p2, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class Foo actual constructor(p: Int) : Base(p, p)
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
<!INCOMPATIBLE_MATCHING{JVM}!>expect class Foo {
|
||||||
|
<!INCOMPATIBLE_MATCHING{JVM}!>fun foo(param: Int = 1)<!>
|
||||||
|
}<!>
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
interface Base {
|
||||||
|
fun foo(p: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
object BaseImpl : Base {
|
||||||
|
override fun foo(p: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base by BaseImpl
|
||||||
+17
@@ -0,0 +1,17 @@
|
|||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo {
|
||||||
|
fun foo(param: Int = 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
interface Base {
|
||||||
|
fun foo(p: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
object BaseImpl : Base {
|
||||||
|
override fun foo(p: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base by BaseImpl
|
||||||
+19
@@ -0,0 +1,19 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect interface Foo {
|
||||||
|
fun foo(p: Int = 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
interface Base1 {
|
||||||
|
fun foo(p: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Base2 {
|
||||||
|
fun foo(p: Int)
|
||||||
|
}
|
||||||
|
|
||||||
|
@Suppress("ACTUAL_CLASSIFIER_MUST_HAVE_THE_SAME_SUPERTYPES_AS_NON_FINAL_EXPECT_CLASSIFIER")
|
||||||
|
actual interface Foo : Base1, Base2
|
||||||
+18
@@ -0,0 +1,18 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo {
|
||||||
|
class Bar() {
|
||||||
|
fun foo(p: Int = 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base {
|
||||||
|
fun foo(p: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class Foo {
|
||||||
|
actual class Bar : Base()
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo {
|
||||||
|
fun foo(param: Int = 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base {
|
||||||
|
open fun foo(param: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class Foo : Base() {
|
||||||
|
actual override fun foo(param: Int) {}
|
||||||
|
}
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo {
|
||||||
|
fun foo(param: Int = 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base {
|
||||||
|
fun foo(param: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class Foo : Base()
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
<!INCOMPATIBLE_MATCHING{JVM}!>expect class Foo {
|
||||||
|
fun foo(param: Int = 1)
|
||||||
|
<!NO_ACTUAL_FOR_EXPECT{JVM}!>fun missingOnActual()<!>
|
||||||
|
}<!>
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base {
|
||||||
|
fun foo(param: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base()
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo {
|
||||||
|
fun foo(param: Int = 1)
|
||||||
|
fun missingOnActual()
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base {
|
||||||
|
fun foo(param: Int) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base()
|
||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
// FIR_IDENTICAL
|
||||||
|
// MODULE: m1-common
|
||||||
|
// FILE: common.kt
|
||||||
|
expect class Foo() {
|
||||||
|
fun foo(p: Int = 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
// MODULE: m2-jvm()()(m1-common)
|
||||||
|
// FILE: jvm.kt
|
||||||
|
open class Base<T> {
|
||||||
|
fun foo(p: T) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
actual class Foo : Base<Int>()
|
||||||
Generated
+58
@@ -24114,6 +24114,64 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
|||||||
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
public void testNestedClassMethodsViaActualTypealias() throws Exception {
|
||||||
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/nestedClassMethodsViaActualTypealias.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Nested
|
||||||
|
@TestMetadata("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride")
|
||||||
|
@TestDataPath("$PROJECT_ROOT")
|
||||||
|
public class MethodDefaultArgsViaActualFakeOverride {
|
||||||
|
@Test
|
||||||
|
public void testAllFilesPresentInMethodDefaultArgsViaActualFakeOverride() throws Exception {
|
||||||
|
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride"), Pattern.compile("^(.*)\\.kts?$"), Pattern.compile("^(.+)\\.(reversed|fir|ll)\\.kts?$"), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("constructor.kt")
|
||||||
|
public void testConstructor() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/constructor.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("delegation.kt")
|
||||||
|
public void testDelegation() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/delegation.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("intersectionOverride.kt")
|
||||||
|
public void testIntersectionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/intersectionOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("nestedClass.kt")
|
||||||
|
public void testNestedClass() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/nestedClass.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("realOverride.kt")
|
||||||
|
public void testRealOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/realOverride.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simple.kt")
|
||||||
|
public void testSimple() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simple.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("simpleIncompatible.kt")
|
||||||
|
public void testSimpleIncompatible() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/simpleIncompatible.kt");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("substitutionOverride.kt")
|
||||||
|
public void testSubstitutionOverride() throws Exception {
|
||||||
|
runTest("compiler/testData/diagnostics/tests/multiplatform/defaultArguments/methodDefaultArgsViaActualFakeOverride/substitutionOverride.kt");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nested
|
@Nested
|
||||||
|
|||||||
Reference in New Issue
Block a user