Do not generate call for elvis + move dead code tests
This commit is contained in:
@@ -288,7 +288,6 @@ public class JetControlFlowProcessor {
|
||||
}
|
||||
else if (operationType == JetTokens.ELVIS) {
|
||||
generateInstructions(expression.getLeft(), false);
|
||||
generateInstructions(operationReference, false);
|
||||
Label afterElvis = builder.createUnboundLabel();
|
||||
builder.jumpOnTrue(afterElvis);
|
||||
if (right != null) {
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
== foo ==
|
||||
fun foo() {
|
||||
return ?: null
|
||||
}
|
||||
---------------------
|
||||
L0:
|
||||
<START> NEXT:[ret L1] PREV:[]
|
||||
ret L1 NEXT:[<END>] PREV:[<START>]
|
||||
- jt(L2) NEXT:[r(null), <END>] PREV:[]
|
||||
- r(null) NEXT:[<END>] PREV:[]
|
||||
L1:
|
||||
L2:
|
||||
<END> NEXT:[<SINK>] PREV:[ret L1]
|
||||
error:
|
||||
<ERROR> NEXT:[<SINK>] PREV:[]
|
||||
sink:
|
||||
<SINK> NEXT:[] PREV:[<ERROR>, <END>]
|
||||
=====================
|
||||
@@ -0,0 +1,3 @@
|
||||
fun foo() {
|
||||
return ?: null
|
||||
}
|
||||
@@ -31,6 +31,7 @@ import org.jetbrains.jet.cfg.AbstractControlFlowTest;
|
||||
/** This class is generated by {@link org.jetbrains.jet.generators.tests.GenerateTests}. DO NOT MODIFY MANUALLY */
|
||||
@SuppressWarnings("all")
|
||||
@TestMetadata("compiler/testData/cfg")
|
||||
@InnerTestClasses({ControlFlowTestGenerated.DeadCode.class})
|
||||
public class ControlFlowTestGenerated extends AbstractControlFlowTest {
|
||||
public void testAllFilesPresentInCfg() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/cfg"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
@@ -81,11 +82,6 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
|
||||
doTest("compiler/testData/cfg/Basic.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DeadCode.kt")
|
||||
public void testDeadCode() throws Exception {
|
||||
doTest("compiler/testData/cfg/DeadCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("DelegatedProperty.kt")
|
||||
public void testDelegatedProperty() throws Exception {
|
||||
doTest("compiler/testData/cfg/DelegatedProperty.kt");
|
||||
@@ -216,4 +212,28 @@ public class ControlFlowTestGenerated extends AbstractControlFlowTest {
|
||||
doTest("compiler/testData/cfg/unusedFunctionLiteral.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("compiler/testData/cfg/deadCode")
|
||||
public static class DeadCode extends AbstractControlFlowTest {
|
||||
public void testAllFilesPresentInDeadCode() throws Exception {
|
||||
JetTestUtils.assertAllTestsPresentByMetadata(this.getClass(), "org.jetbrains.jet.generators.tests.GenerateTests", new File("compiler/testData/cfg/deadCode"), Pattern.compile("^(.+)\\.kt$"), true);
|
||||
}
|
||||
|
||||
@TestMetadata("DeadCode.kt")
|
||||
public void testDeadCode() throws Exception {
|
||||
doTest("compiler/testData/cfg/deadCode/DeadCode.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("returnInElvis.kt")
|
||||
public void testReturnInElvis() throws Exception {
|
||||
doTest("compiler/testData/cfg/deadCode/returnInElvis.kt");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static Test suite() {
|
||||
TestSuite suite = new TestSuite("ControlFlowTestGenerated");
|
||||
suite.addTestSuite(ControlFlowTestGenerated.class);
|
||||
suite.addTestSuite(DeadCode.class);
|
||||
return suite;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user