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:
+12
@@ -13198,6 +13198,18 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnother.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateToAnotherMutable.kt")
|
||||
public void testDelegateToAnotherMutable() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToAnotherMutable.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateToGenericJavaProperty.kt")
|
||||
public void testDelegateToGenericJavaProperty() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToGenericJavaProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateWithPrivateSet.kt")
|
||||
public void testDelegateWithPrivateSet() throws Exception {
|
||||
|
||||
+6
@@ -4708,6 +4708,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/definedInSources.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("delegateToAnother.kt")
|
||||
public void testDelegateToAnother() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/delegateToAnother.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("inSeparateModule.kt")
|
||||
public void testInSeparateModule() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user