Files
kotlin-fork/compiler/testData/codegen/bytecodeListing/delegatedProperty/delegateMethodIsNonOverridable.kt
T
Alexander Udalov 04c5bbdcf8 JVM IR: change generation scheme of property $delegate methods
Generate $delegate method as instance method in
PropertyReferenceDelegationLowering, and remove dispatch receiver later
in MakePropertyDelegateMethodsStatic. The method needs to be static to
be non-overridable (see delegateMethodIsNonOverridable.kt), and public
to be accessible in reflection.

Otherwise we generated incorrect IR where a static function accessed an
instance field of the containing class, which failed in multiple places
including LocalDeclarationsLowering.

 #KT-48350 Fixed
2021-08-31 14:07:22 +02:00

15 lines
186 B
Kotlin
Vendored

// WITH_RUNTIME
val a = 1
val b = 2
open class C {
open val x by run { ::a }
open val y by ::a
}
class D : C() {
override val x by run { ::b }
override val y by ::b
}