Handle reversed() in ForLoopsLowering.

We get the info for the underlying progression and invert it. For
progressions whose last bound was open (e.g., `until` loop), the
reversed version will have an open first bound and so the induction
variable must be incremented first.

Also unified the way of extracting HeaderInfo out of changed calls
(e.g., `indices.reversed()`), and fixed declaration parents in
ForLoopsLowering.
This commit is contained in:
Mark Punzalan
2019-04-10 14:33:51 -07:00
committed by max-kammerer
parent 3d1b6fb83c
commit 1b703448d3
34 changed files with 953 additions and 201 deletions
@@ -1971,6 +1971,16 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedRangeLiteral.kt");
}
@TestMetadata("forInReversedReversedArrayIndices.kt")
public void testForInReversedReversedArrayIndices() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedArrayIndices.kt");
}
@TestMetadata("forInReversedReversedDownTo.kt")
public void testForInReversedReversedDownTo() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedDownTo.kt");
}
@TestMetadata("ForInReversedReversedRange.kt")
public void testForInReversedReversedRange() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/ForInReversedReversedRange.kt");
@@ -1981,6 +1991,11 @@ public class BytecodeTextTestGenerated extends AbstractBytecodeTextTest {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedReversedRange.kt");
}
@TestMetadata("forInReversedReversedUntil.kt")
public void testForInReversedReversedUntil() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedReversedUntil.kt");
}
@TestMetadata("forInReversedUntil.kt")
public void testForInReversedUntil() throws Exception {
runTest("compiler/testData/codegen/bytecodeText/forLoop/forInReversed/forInReversedUntil.kt");