[FIR] Make overriding generic callables independent of TP bounds order
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
// FILE: Test.java
|
||||
public class Test {
|
||||
|
||||
public interface I1 {}
|
||||
public interface I2 {}
|
||||
public interface I3 {}
|
||||
|
||||
public interface I123 extends I1, I2, I3 {}
|
||||
|
||||
public static class Base {
|
||||
public <P extends I1 & I2 & I3> void foo(P p) {}
|
||||
}
|
||||
|
||||
public static class Derived extends Base {
|
||||
@Override
|
||||
public <P extends I1 & I3 & I2> void foo(P p) {}
|
||||
}
|
||||
|
||||
public static class DerivedRaw extends Base {
|
||||
public void foo(I1 p) {}
|
||||
}
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
interface KI1
|
||||
interface KI2
|
||||
interface KI12 : KI1, KI2
|
||||
|
||||
open class KBase {
|
||||
open fun <P> foo()
|
||||
where P : KI1, P : KI2 {}
|
||||
}
|
||||
|
||||
class KDerived : KBase() {
|
||||
override fun <P> foo()
|
||||
where P : KI2, P : KI1 {}
|
||||
}
|
||||
|
||||
|
||||
fun callJava(derived: Test.Derived, derivedRaw: Test.DerivedRaw, v: Test.I123) {
|
||||
derived.foo(v)
|
||||
derivedRaw.foo(v)
|
||||
}
|
||||
|
||||
fun callKotlin(derived: KDerived) {
|
||||
derived.foo<KI12>()
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
FILE: main.kt
|
||||
public abstract interface KI1 : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface KI2 : R|kotlin/Any| {
|
||||
}
|
||||
public abstract interface KI12 : R|KI1|, R|KI2| {
|
||||
}
|
||||
public open class KBase : R|kotlin/Any| {
|
||||
public constructor(): R|KBase| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public open fun <P : R|KI1|, R|KI2|> foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final class KDerived : R|KBase| {
|
||||
public constructor(): R|KDerived| {
|
||||
super<R|KBase|>()
|
||||
}
|
||||
|
||||
public final override fun <P : R|KI2|, R|KI1|> foo(): R|kotlin/Unit| {
|
||||
}
|
||||
|
||||
}
|
||||
public final fun callJava(derived: R|Test.Derived|, derivedRaw: R|Test.DerivedRaw|, v: R|Test.I123|): R|kotlin/Unit| {
|
||||
R|<local>/derived|.R|/Test.Derived.foo|<R|ft<Test.I123, Test.I123?>!|>(R|<local>/v|)
|
||||
R|<local>/derivedRaw|.R|/Test.DerivedRaw.foo|(R|<local>/v|)
|
||||
}
|
||||
public final fun callKotlin(derived: R|KDerived|): R|kotlin/Unit| {
|
||||
R|<local>/derived|.R|/KDerived.foo|<R|KI12|>()
|
||||
}
|
||||
Reference in New Issue
Block a user