KT-14513 Don't generate delegated property metadata when unused
If the delegated property operators involved are inline, and delegated property metadata parameter is not used (which is often the case, e.g., 'lazy'), we can skip those properties in metadata generation. NOT implemented: special case when only 'kProperty.name' is used by the corresponding delegated property operators. Also a sneak fix for KT-34060.
This commit is contained in:
committed by
Dmitry Petrov
parent
92ba298e68
commit
a633a33627
Generated
+43
@@ -7313,6 +7313,49 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OptimizedDelegatedProperties extends AbstractIrJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOptimizedDelegatedProperties() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
|
||||
}
|
||||
|
||||
@TestMetadata("definedInSources.kt")
|
||||
public void testDefinedInSources() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definedInSourcesWithNonNullParameter.kt")
|
||||
public void testDefinedInSourcesWithNonNullParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSeparateModule.kt")
|
||||
public void testInSeparateModule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSeparateModuleWithNonNullParameter.kt")
|
||||
public void testInSeparateModuleWithNonNullParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lazy.kt")
|
||||
public void testLazy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixedArgumentSizes.kt")
|
||||
public void testMixedArgumentSizes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/mixedArgumentSizes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
+43
@@ -8398,6 +8398,49 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OptimizedDelegatedProperties extends AbstractJsCodegenBoxTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOptimizedDelegatedProperties() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
|
||||
}
|
||||
|
||||
@TestMetadata("definedInSources.kt")
|
||||
public void testDefinedInSources() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSources.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("definedInSourcesWithNonNullParameter.kt")
|
||||
public void testDefinedInSourcesWithNonNullParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/definedInSourcesWithNonNullParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSeparateModule.kt")
|
||||
public void testInSeparateModule() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSeparateModuleWithNonNullParameter.kt")
|
||||
public void testInSeparateModuleWithNonNullParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/inSeparateModuleWithNonNullParameter.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lazy.kt")
|
||||
public void testLazy() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/lazy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("mixedArgumentSizes.kt")
|
||||
public void testMixedArgumentSizes() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/delegatedProperty/optimizedDelegatedProperties/mixedArgumentSizes.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/box/delegatedProperty/provideDelegate")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user