[JVM] Improve code coverage of EntriesMapping

Ensure that when .entries is accessed from an inline function body
or lambda argument, EntriesMapping are properly generated and used
without excessive mappings and duplicated fields

#KT-53236
This commit is contained in:
Vsevolod Tolstopyatov
2022-07-22 17:31:56 +02:00
committed by Space
parent 8a181cf2bd
commit c0f81cbc45
21 changed files with 495 additions and 0 deletions
@@ -488,6 +488,40 @@ public class FirBlackBoxInlineCodegenTestGenerated extends AbstractFirBlackBoxIn
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
public class EnumEntries {
@Test
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("callSite.kt")
public void testCallSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/callSite.kt");
}
@Test
@TestMetadata("declSite.kt")
public void testDeclSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSite.kt");
}
@Test
@TestMetadata("declSiteSeveralMappings.kt")
public void testDeclSiteSeveralMappings() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappings.kt");
}
@Test
@TestMetadata("declSiteSeveralMappingsDifOrder.kt")
public void testDeclSiteSeveralMappingsDifOrder() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappingsDifOrder.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")
@@ -3414,6 +3414,12 @@ public class FirBytecodeTextTestGenerated extends AbstractFirBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/inline/deleteClassOnTransformation.kt");
}
@Test
@TestMetadata("entriesMappingOnCallSite.kt")
public void testEntriesMappingOnCallSite() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/inline/entriesMappingOnCallSite.kt");
}
@Test
@TestMetadata("finallyMarkers.kt")
public void testFinallyMarkers() throws Exception {
@@ -488,6 +488,40 @@ public class FirLightTreeBlackBoxInlineCodegenTestGenerated extends AbstractFirL
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
public class EnumEntries {
@Test
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR, true);
}
@Test
@TestMetadata("callSite.kt")
public void testCallSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/callSite.kt");
}
@Test
@TestMetadata("declSite.kt")
public void testDeclSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSite.kt");
}
@Test
@TestMetadata("declSiteSeveralMappings.kt")
public void testDeclSiteSeveralMappings() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappings.kt");
}
@Test
@TestMetadata("declSiteSeveralMappingsDifOrder.kt")
public void testDeclSiteSeveralMappingsDifOrder() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappingsDifOrder.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")
@@ -488,6 +488,40 @@ public class FirSerializeCompileKotlinAgainstInlineKotlinTestGenerated extends A
runTest("compiler/testData/codegen/boxInline/anonymousObject/withInlineMethod.kt");
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumEntries")
@TestDataPath("$PROJECT_ROOT")
public class EnumEntries {
@Test
public void testAllFilesPresentInEnumEntries() throws Exception {
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/boxInline/anonymousObject/enumEntries"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM_IR_SERIALIZE, true);
}
@Test
@TestMetadata("callSite.kt")
public void testCallSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/callSite.kt");
}
@Test
@TestMetadata("declSite.kt")
public void testDeclSite() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSite.kt");
}
@Test
@TestMetadata("declSiteSeveralMappings.kt")
public void testDeclSiteSeveralMappings() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappings.kt");
}
@Test
@TestMetadata("declSiteSeveralMappingsDifOrder.kt")
public void testDeclSiteSeveralMappingsDifOrder() throws Exception {
runTest("compiler/testData/codegen/boxInline/anonymousObject/enumEntries/declSiteSeveralMappingsDifOrder.kt");
}
}
@Nested
@TestMetadata("compiler/testData/codegen/boxInline/anonymousObject/enumWhen")
@TestDataPath("$PROJECT_ROOT")