KT-23397 Optimize out field for property delegate when it's safe (JVM)

This commit is contained in:
Pavel Mikhailovskii
2022-06-03 16:54:12 +02:00
committed by teamcity
parent 9ee0268197
commit 65b2cee913
83 changed files with 3015 additions and 19 deletions
@@ -11041,6 +11041,172 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -11083,6 +11083,172 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToConst {
@Test
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@Test
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@Test
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToFinalProperty {
@Test
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@Test
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@Test
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@Test
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@Test
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@Test
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@Test
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToSingleton {
@Test
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@Test
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@Test
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@Test
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@Test
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@Test
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@Test
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
public class DelegateToThis {
@Test
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JS_IR, true);
}
@Test
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@Test
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@Test
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@@ -9804,6 +9804,163 @@ public class IrCodegenBoxWasmTestGenerated extends AbstractIrCodegenBoxWasmTest
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToConst")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToConst extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToConst() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToConst"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToConst.kt")
public void testDelegateToConst() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConst.kt");
}
@TestMetadata("delegateToConstProperty.kt")
public void testDelegateToConstProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToConstProperty.kt");
}
@TestMetadata("delegateToNull.kt")
public void testDelegateToNull() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToConst/delegateToNull.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToFinalProperty extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToFinalProperty() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("chain.kt")
public void testChain() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/chain.kt");
}
@TestMetadata("delegateToFinalInstanceProperty.kt")
public void testDelegateToFinalInstanceProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalInstanceProperty.kt");
}
@TestMetadata("delegateToFinalObjectProperty.kt")
public void testDelegateToFinalObjectProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalObjectProperty.kt");
}
@TestMetadata("delegateToFinalProperty.kt")
public void testDelegateToFinalProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/delegateToFinalProperty.kt");
}
@TestMetadata("finalPropertyInAnotherFile.kt")
public void testFinalPropertyInAnotherFile() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/finalPropertyInAnotherFile.kt");
}
@TestMetadata("initializeContainerOfTopLevelProperties.kt")
public void testInitializeContainerOfTopLevelProperties() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/initializeContainerOfTopLevelProperties.kt");
}
@TestMetadata("memberExtensionPropertyAndImportFromObject.kt")
public void testMemberExtensionPropertyAndImportFromObject() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndImportFromObject.kt");
}
@TestMetadata("memberExtensionPropertyAndLocalDelegatedProperty.kt")
public void testMemberExtensionPropertyAndLocalDelegatedProperty() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToFinalProperty/memberExtensionPropertyAndLocalDelegatedProperty.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToSingleton extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToSingleton() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToEnum.kt")
public void testDelegateToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnum.kt");
}
@TestMetadata("delegateToEnumInAClass.kt")
public void testDelegateToEnumInAClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToEnumInAClass.kt");
}
@TestMetadata("delegateToSingleton.kt")
public void testDelegateToSingleton() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/delegateToSingleton.kt");
}
@TestMetadata("noInitializationOfOuterClass.kt")
public void testNoInitializationOfOuterClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/noInitializationOfOuterClass.kt");
}
@TestMetadata("withSideEffects.kt")
public void testWithSideEffects() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffects.kt");
}
@TestMetadata("withSideEffectsFromFileClass.kt")
public void testWithSideEffectsFromFileClass() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsFromFileClass.kt");
}
@TestMetadata("withSideEffectsToEnum.kt")
public void testWithSideEffectsToEnum() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToSingleton/withSideEffectsToEnum.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/delegateToThis")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class DelegateToThis extends AbstractIrCodegenBoxWasmTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.WASM, testDataFilePath);
}
public void testAllFilesPresentInDelegateToThis() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/delegateToThis"), Pattern.compile("^([^_](.+))\\.kt$"), null, TargetBackend.WASM, true);
}
@TestMetadata("delegateToOuterThis.kt")
public void testDelegateToOuterThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToOuterThis.kt");
}
@TestMetadata("delegateToThis.kt")
public void testDelegateToThis() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThis.kt");
}
@TestMetadata("delegateToThisByExtension.kt")
public void testDelegateToThisByExtension() throws Exception {
runTest("compiler/testData/codegen/box/delegatedProperty/delegateToThis/delegateToThisByExtension.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/local")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)