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
This commit is contained in:
committed by
Alexander Udalov
parent
50508da156
commit
04c5bbdcf8
+2
-2
@@ -35,11 +35,11 @@ fun local() {
|
||||
// 0 private final( static)? Lkotlin/reflect/KMutableProperty[0-2]; [xyz]m?\$delegate
|
||||
// 2 private final( static)? LC; [xyz]m?\$receiver
|
||||
// 0 LOCALVARIABLE [xyz]m? Lkotlin/reflect/KMutableProperty[0-2];
|
||||
// 12 static get[XYZ]m?\$delegate
|
||||
// 12 public( static)? get[XYZ]m?\$delegate
|
||||
|
||||
// JVM_TEMPLATES
|
||||
// Not optimized, references created as classes and stored in fields:
|
||||
// 16 extends kotlin/jvm/internal/MutablePropertyReference[0-2]Impl
|
||||
// 12 private final( static)? Lkotlin/reflect/KMutableProperty[0-2]; [xyz]m?\$delegate
|
||||
// 4 LOCALVARIABLE [xyz]m? Lkotlin/reflect/KMutableProperty[0-2];
|
||||
// 0 static get[XYZ]m?\$delegate
|
||||
// 0 get[XYZ]m?\$delegate
|
||||
|
||||
Reference in New Issue
Block a user