ForLoopsLowering: Assume step == 1 for *Range (e.g., IntRange) and

handle accordingly (e.g., do not read `step` property).
This commit is contained in:
Mark Punzalan
2020-07-23 15:21:03 -07:00
committed by Alexander Udalov
parent 09e47fff7b
commit 2cfd776092
10 changed files with 143 additions and 24 deletions
@@ -1,6 +1,6 @@
// TARGET_BACKEND: JVM_IR
fun box(): String {
val intProgression = 1..7
val intProgression = 1..7 step 3 // `step` ensures type is IntProgression, NOT IntRange
for (i in intProgression step 2) {
}
@@ -15,10 +15,9 @@ fun box(): String {
// Expected lowered form of loop:
//
// // Additional statements:
// val progression = intProgression
// val nestedFirst = progression.first
// val nestedLast = progression.last
// val nestedStep = progression.step
// val nestedFirst = intProgression.first
// val nestedLast = intProgression.last
// val nestedStep = intProgression.step
// val maybeNegatedStep = if (nestedStep <= 0) -2 else 2
//
// // Standard form of loop over progression