[Wasm] Do not erase interfaces down to Any type in Wasm signature.

This enables overloading virtual methods with different interface types
This commit is contained in:
Svyatoslav Kuzmich
2021-09-20 15:41:39 +03:00
parent 6db7154876
commit a2bfcfeae8
13 changed files with 93 additions and 10 deletions
@@ -1,5 +1,3 @@
// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: BRIDGE_ISSUES
public open class A<T> {
fun foo(x: T) = "O"
fun foo(x: A<T>) = "K"
@@ -0,0 +1,35 @@
interface I1 {
fun o(): String
}
interface I2 {
fun k(): String
}
interface I {
fun foo(x: I1): I1
fun foo(x: I2): I2
}
open class C : I {
override fun foo(x: I1): I1 = x
override fun foo(x: I2): I2 = x
}
class C2 : C() {
override fun foo(x: I1): I1 = x
override fun foo(x: I2): I2 = x
}
fun box(): String {
val x: I = C2()
val o = x.foo(object : I1 {
override fun o(): String = "O"
}).o()
val k = x.foo(object : I2 {
override fun k(): String = "K"
}).k()
return o + k
}