PSI2IR: Fix delegated members generation

When generating bodies for members implemented by delegation, invoke
corresponding delegate member, not an interface member. Otherwise we
might lose platform-specific nullability information in case of mixed
Kotlin-Java hierarchies, as in
implicitNotNullOnDelegatedImplementation.kt
This commit is contained in:
Dmitry Petrov
2019-12-30 16:04:24 +03:00
parent cc0b231b3b
commit d622542824
9 changed files with 670 additions and 93 deletions
@@ -1,15 +1,4 @@
// IGNORE_BACKEND: JVM_IR
// FILE: Delegation.java
public class Delegation {
public static class ReturnNull {
public String foo() {
return null;
}
}
}
// FILE: 1.kt
// FILE: delegation.kt
interface Tr {
fun foo(): String
@@ -19,8 +8,7 @@ class DelegateTo : Delegation.ReturnNull(), Tr {
override fun foo() = super<Delegation.ReturnNull>.foo()
}
class DelegateFrom : Tr by DelegateTo() {
}
class DelegateFrom : Tr by DelegateTo()
fun box(): String {
try {
@@ -31,3 +19,13 @@ fun box(): String {
return "OK"
}
}
// FILE: Delegation.java
public class Delegation {
public static class ReturnNull {
public String foo() {
return null;
}
}
}