[FIR, IR] Convert FirDefaultArgumentsInExpectActualizedByFakeOverrideChecker into ExpectActualCheckingCompatibility

FirDefaultArgumentsInExpectActualizedByFakeOverrideChecker is an adhoc
checker which can be converted to ExpectActualCheckingCompatibility to
reuse common expect-actual checking infrastructure.

^KT-62913 Fixed
Review: https://jetbrains.team/p/kt/reviews/13094/timeline

Tests that were broken by one of my previous commits are now fixed:
- actualFakeOverride_paramsAreCompatibleViaSharedMethodWithDefaultParams.kt
- inheritedJavaMembers.kt

DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE diagnostic
disappeared in delegation.fir.kt because only one
AbstractExpectActualChecker incompatibility can be reported at a time
(DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE is now reported
not by adhoc checker but by common AbstractExpectActualChecker). It
would be nice to report both of them, but it's a separate issue KT-62631

delegation2 test makes sure that
DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE is reported when
NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS is fixed
This commit is contained in:
Nikita Bobko
2023-11-17 11:39:24 +01:00
committed by teamcity
parent c8a9928624
commit 7166adb179
20 changed files with 156 additions and 152 deletions
@@ -9,4 +9,4 @@ expect class Foo : Shared
// MODULE: m2-jvm()()(m1-common)
// FILE: jvm.kt
actual class Foo : <!DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE!>Shared<!>
actual class Foo : Shared
@@ -14,4 +14,4 @@ object BaseImpl : Base {
override fun foo(p: Int) {}
}
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : <!DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE!>Base by BaseImpl<!>
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base by BaseImpl
@@ -14,4 +14,4 @@ object BaseImpl : Base {
override fun foo(p: Int) {}
}
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : <!DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE!>Base by BaseImpl<!>
actual class <!NO_ACTUAL_CLASS_MEMBER_FOR_EXPECTED_CLASS!>Foo<!> : Base by BaseImpl
@@ -0,0 +1,17 @@
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
fun foo(p: 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 Foo : <!DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE!>Base by BaseImpl<!>
@@ -0,0 +1,17 @@
// MODULE: m1-common
// FILE: common.kt
expect class Foo {
fun foo(p: 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 Foo : Base by BaseImpl
@@ -51,7 +51,7 @@ public actual open class FastArrayList<E> internal constructor(
var array: Array<Any?>,
var _size: Int = array.size,
var arrayCapacity: Int = array.size,
) : <!DEFAULT_ARGUMENTS_IN_EXPECT_ACTUALIZED_BY_FAKE_OVERRIDE!>AbstractMutableList<E>(), MutableListEx<E>, RandomAccess<!> {
) : AbstractMutableList<E>(), MutableListEx<E>, RandomAccess {
public actual constructor() : this(arrayOfNulls(16), 0) {}
public actual constructor(initialCapacity: Int) : this(arrayOfNulls(initialCapacity), 0) {}
public actual constructor(elements: Collection<E>) : this(elements.toTypedArray<Any?>()) {}