[JVM_IR] Optimize properties delegated to const val

We can omit `get` call to delegated property and inline
constant value directly. If we are not going to
do that, we can get a runtime exception because
all usages of const property will be inlined and the property
itself will be dropped.

#KT-63567 Fixed
#KT-63580 Fixed
This commit is contained in:
Ivan Kylchik
2023-11-27 14:09:49 +01:00
committed by Space Team
parent 1f97c268e1
commit 2b6845c032
24 changed files with 221 additions and 14 deletions
@@ -11525,6 +11525,12 @@ public class FirJsCodegenBoxTestGenerated extends AbstractFirJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt");
}
@Test
@TestMetadata("delegateToConstVal.kt")
public void testDelegateToConstVal() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConstVal.kt");
}
@Test
@TestMetadata("delegateToConstructorParameter.kt")
public void testDelegateToConstructorParameter() throws Exception {
@@ -11525,6 +11525,12 @@ public class FirJsES6CodegenBoxTestGenerated extends AbstractFirJsES6CodegenBoxT
runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt");
}
@Test
@TestMetadata("delegateToConstVal.kt")
public void testDelegateToConstVal() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConstVal.kt");
}
@Test
@TestMetadata("delegateToConstructorParameter.kt")
public void testDelegateToConstructorParameter() throws Exception {
@@ -11525,6 +11525,12 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt");
}
@Test
@TestMetadata("delegateToConstVal.kt")
public void testDelegateToConstVal() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConstVal.kt");
}
@Test
@TestMetadata("delegateToConstructorParameter.kt")
public void testDelegateToConstructorParameter() throws Exception {
@@ -11525,6 +11525,12 @@ public class IrJsES6CodegenBoxTestGenerated extends AbstractIrJsES6CodegenBoxTes
runTest("compiler/testData/codegen/box/delegatedProperty/delegateForExtPropertyInClass.kt");
}
@Test
@TestMetadata("delegateToConstVal.kt")
public void testDelegateToConstVal() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConstVal.kt");
}
@Test
@TestMetadata("delegateToConstructorParameter.kt")
public void testDelegateToConstructorParameter() throws Exception {