Handle withIndex() on arrays and CharSequences in ForLoopsLowering.
This commit is contained in:
committed by
max-kammerer
parent
735535dd5a
commit
a54d9482dd
+15
@@ -0,0 +1,15 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
val arr = arrayOf("a", "b", "c", "d")
|
||||
|
||||
fun box(): String {
|
||||
var count = 0
|
||||
|
||||
for ((_, _) in arr.withIndex()) {
|
||||
count++
|
||||
}
|
||||
|
||||
return if (count == 4) "OK" else "fail: '$count'"
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
val arr = arrayOf("a", "b", "c", "d")
|
||||
|
||||
fun box(): String {
|
||||
val s = StringBuilder()
|
||||
|
||||
for (iv in arr.withIndex()) {
|
||||
val (i, x) = iv
|
||||
s.append("$i:$x;")
|
||||
}
|
||||
|
||||
val ss = s.toString()
|
||||
return if (ss == "0:a;1:b;2:c;3:d;") "OK" else "fail: '$ss'"
|
||||
}
|
||||
Reference in New Issue
Block a user