Handle withIndex() on Iterables (including progressions) and Sequences

in ForLoopsLowering.
This commit is contained in:
Mark Punzalan
2019-11-05 11:15:33 -08:00
committed by max-kammerer
parent a54d9482dd
commit 7adffe0007
49 changed files with 1357 additions and 42 deletions
@@ -15950,6 +15950,84 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInProgressionWithIndex extends AbstractIrJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS_IR, testDataFilePath);
}
public void testAllFilesPresentInForInProgressionWithIndex() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInProgressionWithIndex"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS_IR, true);
}
@TestMetadata("forInDownToWithIndex.kt")
public void testForInDownToWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInDownToWithIndex.kt");
}
@TestMetadata("forInIndicesWithIndex.kt")
public void testForInIndicesWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInIndicesWithIndex.kt");
}
@TestMetadata("forInRangeToWithIndex.kt")
public void testForInRangeToWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInRangeToWithIndex.kt");
}
@TestMetadata("forInReversedStepWithIndex.kt")
public void testForInReversedStepWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInReversedStepWithIndex.kt");
}
@TestMetadata("forInReversedWithIndex.kt")
public void testForInReversedWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInReversedWithIndex.kt");
}
@TestMetadata("forInStepReversedWithIndex.kt")
public void testForInStepReversedWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInStepReversedWithIndex.kt");
}
@TestMetadata("forInStepWithIndex.kt")
public void testForInStepWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInStepWithIndex.kt");
}
@TestMetadata("forInUntilWithIndex.kt")
public void testForInUntilWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt");
}
@TestMetadata("forInWithIndexNoIndexOrElementVar.kt")
public void testForInWithIndexNoIndexOrElementVar() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt");
}
@TestMetadata("forInWithIndexNotDestructured.kt")
public void testForInWithIndexNotDestructured() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNotDestructured.kt");
}
@TestMetadata("forInWithIndexReversed.kt")
public void testForInWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexReversed.kt");
}
@TestMetadata("forInWithIndexWithDestructuringInLoop.kt")
public void testForInWithIndexWithDestructuringInLoop() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithDestructuringInLoop.kt");
}
@TestMetadata("forInWithIndexWithIndex.kt")
public void testForInWithIndexWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInReversed")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
@@ -17125,6 +17125,84 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInProgressionWithIndex")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)
public static class ForInProgressionWithIndex extends AbstractJsCodegenBoxTest {
private void runTest(String testDataFilePath) throws Exception {
KotlinTestUtils.runTest0(this::doTest, TargetBackend.JS, testDataFilePath);
}
public void testAllFilesPresentInForInProgressionWithIndex() throws Exception {
KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/testData/codegen/box/ranges/forInProgressionWithIndex"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.JS, true);
}
@TestMetadata("forInDownToWithIndex.kt")
public void testForInDownToWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInDownToWithIndex.kt");
}
@TestMetadata("forInIndicesWithIndex.kt")
public void testForInIndicesWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInIndicesWithIndex.kt");
}
@TestMetadata("forInRangeToWithIndex.kt")
public void testForInRangeToWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInRangeToWithIndex.kt");
}
@TestMetadata("forInReversedStepWithIndex.kt")
public void testForInReversedStepWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInReversedStepWithIndex.kt");
}
@TestMetadata("forInReversedWithIndex.kt")
public void testForInReversedWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInReversedWithIndex.kt");
}
@TestMetadata("forInStepReversedWithIndex.kt")
public void testForInStepReversedWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInStepReversedWithIndex.kt");
}
@TestMetadata("forInStepWithIndex.kt")
public void testForInStepWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInStepWithIndex.kt");
}
@TestMetadata("forInUntilWithIndex.kt")
public void testForInUntilWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInUntilWithIndex.kt");
}
@TestMetadata("forInWithIndexNoIndexOrElementVar.kt")
public void testForInWithIndexNoIndexOrElementVar() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNoIndexOrElementVar.kt");
}
@TestMetadata("forInWithIndexNotDestructured.kt")
public void testForInWithIndexNotDestructured() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexNotDestructured.kt");
}
@TestMetadata("forInWithIndexReversed.kt")
public void testForInWithIndexReversed() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexReversed.kt");
}
@TestMetadata("forInWithIndexWithDestructuringInLoop.kt")
public void testForInWithIndexWithDestructuringInLoop() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithDestructuringInLoop.kt");
}
@TestMetadata("forInWithIndexWithIndex.kt")
public void testForInWithIndexWithIndex() throws Exception {
runTest("compiler/testData/codegen/box/ranges/forInProgressionWithIndex/forInWithIndexWithIndex.kt");
}
}
@TestMetadata("compiler/testData/codegen/box/ranges/forInReversed")
@TestDataPath("$PROJECT_ROOT")
@RunWith(JUnit3RunnerWithInners.class)