JVM IR: Fix generation of parameterless default constructor

The JVM backend does not generate parameterless default constructors for
private constructors and constructors of local, inner, or inline
classes.
This commit is contained in:
Steven Schäfer
2020-01-13 16:11:14 +01:00
committed by Alexander Udalov
parent 5321a6af33
commit 8e07482862
12 changed files with 217 additions and 3 deletions
@@ -1239,6 +1239,64 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/constructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class Constructors extends AbstractBytecodeTextTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInConstructors() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/codegen/bytecodeText/constructors"), Pattern.compile("^(.+)\\.kt$"), null, TargetBackend.JVM, true);
}
@TestMetadata("enumPrimaryDefaults.kt")
public void testEnumPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/enumPrimaryDefaults.kt");
}
@TestMetadata("inlineArgumentPrimaryDefaults.kt")
public void testInlineArgumentPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/inlineArgumentPrimaryDefaults.kt");
}
@TestMetadata("inlinePrimaryDefaults.kt")
public void testInlinePrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/inlinePrimaryDefaults.kt");
}
@TestMetadata("innerPrimaryDefaults.kt")
public void testInnerPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/innerPrimaryDefaults.kt");
}
@TestMetadata("internalPrimaryDefaults.kt")
public void testInternalPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/internalPrimaryDefaults.kt");
}
@TestMetadata("localPrimaryDefaults.kt")
public void testLocalPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/localPrimaryDefaults.kt");
}
@TestMetadata("parameterlessPrimary.kt")
public void testParameterlessPrimary() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/parameterlessPrimary.kt");
}
@TestMetadata("privatePrimaryDefaults.kt")
public void testPrivatePrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/privatePrimaryDefaults.kt");
}
@TestMetadata("protectedPrimaryDefaults.kt")
public void testProtectedPrimaryDefaults() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/constructors/protectedPrimaryDefaults.kt");
}
}
@TestMetadata("compiler/testData/codegen/bytecodeText/controlStructures")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)