JVM: use a safer version of fileParent for Java declarations
Java declarations do not have a file parent, their outer element is IrExternalPackageFragment. The test did not fail in K1 only by accident, because there's an extra IrTypeOperatorCall on the property reference's dispatch receiver, which automatically makes it non-inlinable. In K2, it's IrGetField, so we were trying to compute if its dispatch receiver is inlinable and for that we tried to get its fileParent, which resulted in exception if it comes from Java. Also refactor PropertyReferenceDelegationTransformer.canInline a bit. #KT-57955 Fixed
This commit is contained in:
committed by
Space Team
parent
e2dafdb5b9
commit
ff65324172
@@ -0,0 +1,16 @@
|
||||
// TARGET_BACKEND: JVM
|
||||
// WITH_STDLIB
|
||||
// FILE: box.kt
|
||||
|
||||
class C {
|
||||
val x: Int? by J().s::length
|
||||
}
|
||||
|
||||
fun box(): String =
|
||||
if (C().x == 0) "OK" else "Fail"
|
||||
|
||||
// FILE: J.java
|
||||
|
||||
public class J {
|
||||
public final String s = "";
|
||||
}
|
||||
Reference in New Issue
Block a user