Simplify loop building by encoding open/closed bound information in the

HeaderInfo object, and modifying the operator in the loop condition.

The "additional emptiness condition" is no longer necessary with this.
The open/closed property was removed from HeaderInfo in an earlier
commit, but bringing it back in to simplify the loop building makes
more sense.

Also expanded tests for evaluation order of range bounds.
This commit is contained in:
Mark Punzalan
2019-04-02 10:12:55 -07:00
committed by max-kammerer
parent 7680e7fd56
commit dd65e0876f
16 changed files with 454 additions and 361 deletions
@@ -18583,6 +18583,49 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("forInDownToEvaluationOrder.kt")
public void testForInDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInDownToEvaluationOrder.kt");
}
@TestMetadata("forInRangeLiteralEvaluationOrder.kt")
public void testForInRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
@TestMetadata("forInUntilEvaluationOrder.kt")
public void testForInUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInUntilEvaluationOrder.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -18958,34 +19001,6 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
public void testForInReversedUntilWithNonConstBounds() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt");
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
@@ -18583,6 +18583,49 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("forInDownToEvaluationOrder.kt")
public void testForInDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInDownToEvaluationOrder.kt");
}
@TestMetadata("forInRangeLiteralEvaluationOrder.kt")
public void testForInRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
@TestMetadata("forInUntilEvaluationOrder.kt")
public void testForInUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInUntilEvaluationOrder.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -18958,34 +19001,6 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
public void testForInReversedUntilWithNonConstBounds() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt");
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractLightAnalysisModeTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM, true);
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")
@@ -18588,6 +18588,49 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("forInDownToEvaluationOrder.kt")
public void testForInDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInDownToEvaluationOrder.kt");
}
@TestMetadata("forInRangeLiteralEvaluationOrder.kt")
public void testForInRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
@TestMetadata("forInUntilEvaluationOrder.kt")
public void testForInUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/evaluationOrder/forInUntilEvaluationOrder.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/expression")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -18963,34 +19006,6 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
public void testForInReversedUntilWithNonConstBounds() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/forInReversedUntilWithNonConstBounds.kt");
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class EvaluationOrder extends AbstractIrBlackBoxCodegenTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest(this::doTest, TargetBackend.JVM_IR, testDataFilePath);
}
public void testAllFilesPresentInEvaluationOrder() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JVM_IR, true);
}
@TestMetadata("forInReversedDownToEvaluationOrder.kt")
public void testForInReversedDownToEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedDownToEvaluationOrder.kt");
}
@TestMetadata("forInReversedRangeLiteralEvaluationOrder.kt")
public void testForInReversedRangeLiteralEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedRangeLiteralEvaluationOrder.kt");
}
@TestMetadata("forInReversedUntilEvaluationOrder.kt")
public void testForInReversedUntilEvaluationOrder() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInReversed/evaluationOrder/forInReversedUntilEvaluationOrder.kt");
}
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInUntil")