FIR: unwrap intersection overrides when looking for owner class

But not substitution overrides! This is important if the method called
is an intersection override where one of the intersected types is a
subtype of a generic type.
This commit is contained in:
pyos
2022-10-07 11:40:23 +02:00
committed by Space Team
parent 9f65c6022c
commit e2a83a0ed0
5 changed files with 58 additions and 7 deletions
@@ -0,0 +1,33 @@
// TARGET_BACKEND: JVM_IR
// MODULE: lib
// FILE: I.java
package test;
public interface I {
String foo();
}
// FILE: J.java
package test;
class JBase<T> {
public String foo() { return "OK"; }
}
public class J extends JBase<String> {}
// FILE: JImpl.java
package test;
public class JImpl {
public static class C1 extends J implements I {}
public static class C2 extends J implements I {}
}
// MODULE: main(lib)
// FILE: main.kt
import test.JImpl
fun <T> select(a: T, b: T): T = a
fun box() = select(JImpl.C1(), JImpl.C2()).foo()