Files
kotlin-fork/compiler/testData/codegen/box/ranges/capturedLoopVar.kt
T
2021-10-01 17:18:49 +03:00

15 lines
273 B
Kotlin
Vendored

// WITH_RUNTIME
fun build(): List<() -> Int> {
val r = ArrayList<() -> Int>()
for (i in 0 until 3) {
r.add({ i })
}
return r
}
fun box(): String {
val t = build().map { it() }
if (t != listOf(0, 1, 2)) return "Failed: $t"
return "OK"
}