K1/K2: add test confirming the work of KT-54487 case

#KT-54487 Obsolete
#KT-63350 Declined
This commit is contained in:
Mikhail Glukhikh
2023-12-12 18:10:11 +01:00
committed by Space Team
parent 601f90917b
commit 4783822fbc
9 changed files with 94 additions and 0 deletions
@@ -0,0 +1,47 @@
// TARGET_BACKEND: JVM_IR
// ISSUE: KT-54487, KT-63350
// FILE: p/I.java
package p;
public interface I {
String foo();
}
// FILE: p/I2.java
package p;
public interface I2 extends I {}
// FILE: p/C.java
package p;
public class C {
static class Impl implements I {
public String foo() {
return "OK";
}
}
static class C1Base extends Impl {}
static class C2Base extends Impl {}
public static class C1 extends C1Base implements I2 {}
public static class C2 extends C2Base implements I2 {}
public static final C1 c1 = new C1();
public static final C2 c2 = new C2();
}
// FILE: test.kt
import p.C
fun <T> union(a: T, b: T) = a
fun box() =
// receiver type = I2 & C.Impl
// method resolved to C.Impl.foo, but in backend IR the resulting call is I2.foo
union(C.c1, C.c2).foo()