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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user