[K2, MPP] Fix actualization of fake overrides (fixes a set of bugs in coroutines / ktor)

Split MissingFakeOverridesAdder on FakeOverridesActualizer and ActualFakeOverridesAdder

^KT-57984 Fixed
^KT-58003 Fixed
^KT-58124 Fixed
^KT-57833 Fixed
^KT-58153 Fixed
This commit is contained in:
Ivan Kochurkin
2023-04-11 21:41:36 +02:00
committed by Space Team
parent 58f8e25bfe
commit 432c781ff7
39 changed files with 1581 additions and 182 deletions
@@ -0,0 +1,29 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-58003
// MODULE: common
// FILE: common.kt
class C3 : C2()
open class C2 : C1()
expect open class C1() {
fun o(): String
val k: String
}
fun foo(c3: C3) = c3.o() + c3.k
// MODULE: platform()()(common)
// FILE: platform.kt
actual open class C1 {
actual fun o() = "O"
actual val k = "K"
}
fun box() = foo(C3())
@@ -0,0 +1,29 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-57984
// MODULE: common
// FILE: common.kt
expect interface I {
fun ok(): String
}
interface I2 : I
fun ok(c: I2) = c.ok()
// MODULE: lib()()(common)
// FILE: lib.kt
actual interface I {
actual fun ok(): String
}
// MODULE: main(lib)
// FILE: main.kt
class C : I2 {
override fun ok(): String = "OK"
}
fun box() = ok(C())
@@ -0,0 +1,31 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-58004
// MODULE: common
// FILE: common.kt
expect open class A<S>() {
fun <T> f(arg: T): T
fun g(s: S): S
val <S> S.p: S
}
class B : A<String>()
fun foo(arg: B) = arg.f("O") + arg.g("K")
// MODULE: platform()()(common)
// FILE: platform.kt
actual open class A<S> {
actual fun <T> f(arg: T) = arg
actual fun g(s: S): S = s.p
actual val <S> S.p: S get() = this
}
fun box() = foo(B())
@@ -0,0 +1,38 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// FILE: common.kt
public class X: I1 {
override fun <A> f(a: A): A = a
}
public interface I1 : I2
public expect interface I2 {
public fun <A> f(a: A): A
}
public class Y<B>: I3<B> {
override fun f(b: B): B = b
}
public interface I3<B> : I4<B>
public expect interface I4<B> {
public fun f(b: B): B
}
fun box() = X().f("O") + Y<String>().f("K")
// MODULE: platform()()(common)
// FILE: platform.kt
public actual interface I2 {
public actual fun <A> f(a: A): A
}
public actual interface I4<B> {
public actual fun f(b: B): B
}
@@ -0,0 +1,27 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// ISSUE: KT-58124
// MODULE: common
// FILE: common.kt
interface I1 {
fun f(): String
}
interface I2 {
fun f(): String
}
expect class C() : I1, I2
fun test() = C().f()
// MODULE: platform()()(common)
// FILE: platform.kt
actual class C : I1, I2 {
override fun f() = "OK"
}
fun box() = test()
@@ -0,0 +1,39 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// FILE: common.kt
class C() : I1, C1()
expect open class C1() {
fun o(): String
val k: String
}
expect interface I1 {
fun o(): String
val k: String
}
fun f1(x: C1) = x.o()
fun f2(x: I1) = x.k
// MODULE: platform()()(common)
// FILE: platform.kt
actual open class C1 {
actual fun o() = "O"
actual val k = "K"
}
actual interface I1 {
actual fun o(): String
actual val k: String
}
fun box() = f1(C()) + f2(C())
@@ -0,0 +1,35 @@
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: common.kt
expect interface S1
expect interface S2
expect interface S : S1, S2
open class A : S
class B : A()
// MODULE: platform()()(common)
// FILE: platform.kt
actual interface S1 {
fun s1() = "O"
}
interface S20 {
fun s2() = "K"
}
actual interface S2 : S20 {
}
actual interface S : S1, S2 {
fun s3() = s1() + s2()
}
fun box() = B().s3()
@@ -0,0 +1,17 @@
// IGNORE_BACKEND_K1: JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// TARGET_PLATFORM: Common
// FILE: common.kt
interface I { fun ok(): String }
expect open class Base() { fun ok(): String }
class Child: Base(), I {}
fun box() = Base().ok()
// MODULE: platform()()(common)
// FILE: platform.kt
actual open class Base { actual fun ok() = "OK" }
@@ -0,0 +1,30 @@
// IGNORE_BACKEND_K1: JVM, JVM_IR, JS, JS_IR, JS_IR_ES6, NATIVE
// !LANGUAGE: +MultiPlatformProjects
// MODULE: common
// FILE: common.kt
class C2 : C1() {
override fun o() = super.o()
override val k = "K"
}
expect open class C1() {
open fun o(): String
open val k: String
}
fun foo(c2: C2) = c2.o() + c2.k
// MODULE: platform()()(common)
// FILE: platform.kt
actual open class C1 {
actual open fun o() = "O"
actual open val k = "K"
}
fun box() = foo(C2())