Control flow changes for secondary constructors

This commit is contained in:
Denis Zharkov
2015-03-10 19:42:45 +03:00
parent 61ae694be4
commit 7f20c4a237
39 changed files with 1785 additions and 30 deletions
@@ -63,7 +63,7 @@ public abstract class AbstractPseudocodeTest extends KotlinTestWithEnvironment {
if (declaration instanceof JetDeclarationContainer) {
for (JetDeclaration member : ((JetDeclarationContainer) declaration).getDeclarations()) {
// Properties and initializers are processed elsewhere
if (member instanceof JetNamedFunction) {
if (member instanceof JetNamedFunction || member instanceof JetSecondaryConstructor) {
addDeclaration(data, bindingContext, member);
}
}
@@ -40,6 +40,7 @@ import java.util.regex.Pattern;
ControlFlowTestGenerated.Declarations.class,
ControlFlowTestGenerated.Expressions.class,
ControlFlowTestGenerated.Functions.class,
ControlFlowTestGenerated.SecondaryConstructors.class,
ControlFlowTestGenerated.TailCalls.class,
})
@RunWith(JUnit3RunnerWithInners.class)
@@ -611,6 +612,45 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
}
}
@TestMetadata("compiler/testData/cfg/secondaryConstructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SecondaryConstructors extends AbstractControlFlowTest {
public void testAllFilesPresentInSecondaryConstructors() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("withPrimary.kt")
public void testWithPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withPrimary.kt");
doTest(fileName);
}
@TestMetadata("withPrimarySuper.kt")
public void testWithPrimarySuper() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withPrimarySuper.kt");
doTest(fileName);
}
@TestMetadata("withReturn.kt")
public void testWithReturn() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withReturn.kt");
doTest(fileName);
}
@TestMetadata("withoutPrimary.kt")
public void testWithoutPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withoutPrimary.kt");
doTest(fileName);
}
@TestMetadata("withoutPrimarySuper.kt")
public void testWithoutPrimarySuper() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withoutPrimarySuper.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/cfg/tailCalls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -46,6 +46,7 @@ public class PseudoValueTestGenerated extends AbstractPseudoValueTest {
Cfg.Declarations.class,
Cfg.Expressions.class,
Cfg.Functions.class,
Cfg.SecondaryConstructors.class,
Cfg.TailCalls.class,
})
@RunWith(JUnit3RunnerWithInners.class)
@@ -617,6 +618,45 @@ public class PseudoValueTestGenerated extends AbstractPseudoValueTest {
}
}
@TestMetadata("compiler/testData/cfg/secondaryConstructors")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class SecondaryConstructors extends AbstractPseudoValueTest {
public void testAllFilesPresentInSecondaryConstructors() throws Exception {
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/cfg/secondaryConstructors"), Pattern.compile("^(.+)\\.kt$"), true);
}
@TestMetadata("withPrimary.kt")
public void testWithPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withPrimary.kt");
doTest(fileName);
}
@TestMetadata("withPrimarySuper.kt")
public void testWithPrimarySuper() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withPrimarySuper.kt");
doTest(fileName);
}
@TestMetadata("withReturn.kt")
public void testWithReturn() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withReturn.kt");
doTest(fileName);
}
@TestMetadata("withoutPrimary.kt")
public void testWithoutPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withoutPrimary.kt");
doTest(fileName);
}
@TestMetadata("withoutPrimarySuper.kt")
public void testWithoutPrimarySuper() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/cfg/secondaryConstructors/withoutPrimarySuper.kt");
doTest(fileName);
}
}
@TestMetadata("compiler/testData/cfg/tailCalls")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -10439,6 +10439,18 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("propertyInitializationWithPrimary.kt")
public void testPropertyInitializationWithPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithPrimary.kt");
doTest(fileName);
}
@TestMetadata("propertyInitializationWithoutPrimary.kt")
public void testPropertyInitializationWithoutPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/propertyInitializationWithoutPrimary.kt");
doTest(fileName);
}
@TestMetadata("return.kt")
public void testReturn() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/return.kt");
@@ -10463,6 +10475,24 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
doTest(fileName);
}
@TestMetadata("unreachableCode.kt")
public void testUnreachableCode() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/unreachableCode.kt");
doTest(fileName);
}
@TestMetadata("useOfPropertiesWithPrimary.kt")
public void testUseOfPropertiesWithPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithPrimary.kt");
doTest(fileName);
}
@TestMetadata("useOfPropertiesWithoutPrimary.kt")
public void testUseOfPropertiesWithoutPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/useOfPropertiesWithoutPrimary.kt");
doTest(fileName);
}
@TestMetadata("varargsInDelegationCallToPrimary.kt")
public void testVarargsInDelegationCallToPrimary() throws Exception {
String fileName = JetTestUtils.navigationMetadata("compiler/testData/diagnostics/tests/secondaryConstructors/varargsInDelegationCallToPrimary.kt");