[FIR2IR] Reuse IR fake overrides for FIR fake overrides for all MPP modules

^KT-58229 Fixed
This commit is contained in:
Dmitriy Novozhilov
2023-07-31 12:11:14 +03:00
committed by Space Team
parent 027fdb86a5
commit cc2bc5e8b1
23 changed files with 650 additions and 12 deletions
@@ -0,0 +1,48 @@
// LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-58229
// WITH_STDLIB
// MODULE: common
// FILE: common.kt
expect class Expect {
fun o(): String
val k: String
}
interface Base1 {
fun foo(x: Expect): String
val Expect.bar: String
}
interface Base2 {
fun foo(x: Expect): String
val Expect.bar: String
}
interface Derived : Base1, Base2
// MODULE: platform()()(common)
// FILE: platform.kt
class Impl : Derived {
override fun foo(x: Expect): String = x.o()
override val Expect.bar: String get() = this.k
}
class ActualTarget {
fun o(): String = "O"
val k: String = "K"
}
actual typealias Expect = ActualTarget
fun test(x: Derived): String {
val actual = ActualTarget()
return x.foo(actual) + with(x) { actual.k }
}
fun box(): String {
return test(Impl())
}
@@ -0,0 +1,63 @@
// LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-58229
// WITH_STDLIB
// MODULE: common
// FILE: common.kt
expect class Expect {
fun o(): String
val k: String
}
interface Base1 {
fun foo(x: Expect): String
val Expect.bar: String
}
interface Base2 {
fun foo(x: Expect): String
val Expect.bar: String
}
interface Derived : Base1, Base2
fun testCommon(expect: Expect): String {
class LocalCommon : Derived {
override fun foo(x: Expect): String = x.o()
override val Expect.bar: String get() = this.k
}
val x = LocalCommon()
return x.foo(expect) + with(x) { expect.k }
}
// MODULE: platform()()(common)
// FILE: platform.kt
class Impl : Derived {
override fun foo(x: Expect): String = x.o()
override val Expect.bar: String get() = this.k
}
class ActualTarget {
fun o(): String = "O"
val k: String = "K"
}
actual typealias Expect = ActualTarget
fun testPlatform(actual: Expect): String {
class LocalPlatform : Derived {
override fun foo(x: Expect): String = x.o()
override val Expect.bar: String get() = this.k
}
val x = LocalPlatform()
return x.foo(actual) + with(x) { actual.k }
}
fun box(): String {
val actual = ActualTarget()
if (testCommon(actual) != "OK") return "Fail"
return testPlatform(actual)
}
@@ -0,0 +1,49 @@
// LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-58229
// WITH_STDLIB
// MODULE: common
// FILE: common.kt
expect class Expect {
fun o(): String
val k: String
}
interface Base<E> {
fun foo(x: Expect): String = x.o()
val Expect.bar: String get() = this.k
}
interface Derived : Base<Any?>
fun testCommon(expect: Expect): String {
class LocalCommon : Derived
val x = LocalCommon()
return x.foo(expect) + with(x) { expect.k }
}
// MODULE: platform()()(common)
// FILE: platform.kt
class ActualTarget {
fun o(): String = "O"
val k: String = "K"
}
actual typealias Expect = ActualTarget
fun testPlatform(actual: ActualTarget): String {
class LocalPlatform : Derived
val x = LocalPlatform()
return x.foo(actual) + with(x) { actual.k }
}
fun box(): String {
val actual = ActualTarget()
if (testCommon(actual) != "OK") return "Fail"
return testPlatform(actual)
}
@@ -0,0 +1,40 @@
// LANGUAGE: +MultiPlatformProjects
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-58229
// WITH_STDLIB
// MODULE: common
// FILE: common.kt
expect class Expect {
fun o(): String
val k: String
}
interface Base<E> {
fun foo(x: Expect): String = x.o()
val Expect.bar: String get() = this.k
}
interface Derived : Base<Any?>
// MODULE: platform()()(common)
// FILE: platform.kt
class Impl : Derived
class ActualTarget {
fun o(): String = "O"
val k: String = "K"
}
actual typealias Expect = ActualTarget
fun test(x: Derived): String {
val actual = ActualTarget()
return x.foo(actual) + with(x) { actual.k }
}
fun box(): String {
return test(Impl())
}