Add DefaultProgressionHandler that handles for-loops over

non-specialized progressions, including "step" progressions.

DefaultProgressionHandler uses the "first/last/step" properties of
the progression when building the loop header.
This commit is contained in:
Mark Punzalan
2019-03-20 00:01:32 -07:00
committed by max-kammerer
parent 301ac90770
commit ea9572ad28
9 changed files with 56 additions and 10 deletions
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
import kotlin.test.assertEquals
fun test(coll: Collection<*>?): Int {
@@ -11,3 +11,4 @@ fun Int.digitsUpto(end: Int): Int {
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getStep
@@ -7,4 +7,5 @@ fun f() {
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getLast
// 0 getStep
@@ -7,4 +7,5 @@ fun f(a: Int, b: Int) {
// 0 getStart
// 0 getEnd
// 0 getFirst
// 0 getLast
// 0 getLast
// 0 getStep
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun f() {
for (i in 0..5 step 2) {
}
@@ -1,4 +1,3 @@
// IGNORE_BACKEND: JVM_IR
fun f(r: IntRange) {
for (i in r) {
}
@@ -8,4 +7,5 @@ fun f(r: IntRange) {
// 0 getStart
// 0 getEnd
// 1 getFirst
// 1 getLast
// 1 getLast
// 1 getStep