ForLoopsLowering: Fix issue with break/continue in loop over withIndex.
This commit is contained in:
committed by
max-kammerer
parent
724eda8fdb
commit
3ee344b836
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// KJS_WITH_FULL_RUNTIME
|
||||
// WITH_RUNTIME
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun box(): String {
|
||||
val indexList = mutableListOf<Int>()
|
||||
val valueList = mutableListOf<Int>()
|
||||
for ((i, v) in (4..11 step 2).withIndex()) {
|
||||
if (i == 0) continue
|
||||
if (i == 3) break
|
||||
indexList += i
|
||||
valueList += v
|
||||
}
|
||||
assertEquals(listOf(1, 2), indexList)
|
||||
assertEquals(listOf(6, 8), valueList)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user