JVM_IR: optimize delegation by property references

E.g. a statement like

    var x by ::y

is semantically equivalent to

    var x
      get() = y
      set(value) { y = value }

and thus does not need a full property reference object, or even a field
if the receiver is not bound.

 #KT-39054 Fixed
 #KT-47102 Fixed
This commit is contained in:
pyos
2021-06-16 13:22:32 +02:00
committed by Alexander Udalov
parent 66e052b9b3
commit e49410e07b
17 changed files with 286 additions and 2 deletions
@@ -10722,6 +10722,16 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt");
}
@TestMetadata("delegateToAnotherMutable.kt")
public void testDelegateToAnotherMutable() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt");
}
@TestMetadata("delegateToGenericJavaProperty.kt")
public void testDelegateToGenericJavaProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToGenericJavaProperty.kt");
}
@TestMetadata("delegateWithPrivateSet.kt")
public void testDelegateWithPrivateSet() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateWithPrivateSet.kt");