ForLoopsLowering: Fix issue with break/continue in loop over withIndex.
This commit is contained in:
committed by
max-kammerer
parent
724eda8fdb
commit
3ee344b836
+18
@@ -0,0 +1,18 @@
|
||||
// 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 ((index, x) in arr.withIndex()) {
|
||||
if (index == 0) continue
|
||||
if (index == 3) break
|
||||
s.append("$index:$x;")
|
||||
}
|
||||
|
||||
val ss = s.toString()
|
||||
return if (ss == "1:b;2:c;") "OK" else "fail: '$ss'"
|
||||
}
|
||||
Reference in New Issue
Block a user