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
@@ -3400,6 +3400,39 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
public static class OptimizedDelegatedProperties extends AbstractBytecodeTextTest {
|
||||
private void runTest(String testDataFilePath) throws Exception {
|
||||
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
|
||||
}
|
||||
|
||||
public void testAllFilesPresentInOptimizedDelegatedProperties() throws Exception {
|
||||
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
|
||||
}
|
||||
|
||||
@TestMetadata("definedInSources.kt")
|
||||
public void testDefinedInSources() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/definedInSources.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("inSeparateModule.kt")
|
||||
public void testInSeparateModule() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/inSeparateModule.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("lazy.kt")
|
||||
public void testLazy() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/lazy.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("withNonNullMetadataParameter.kt")
|
||||
public void testWithNonNullMetadataParameter() throws Exception {
|
||||
runTest("compiler/testData/codegen/bytecodeText/optimizedDelegatedProperties/withNonNullMetadataParameter.kt");
|
||||
}
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/codegen/bytecodeText/properties")
|
||||
@TestDataPath("$PROJECT_ROOT")
|
||||
@RunWith(JUnit3RunnerWithInners.class)
|
||||
|
||||
Reference in New Issue
Block a user