Files
kotlin/compiler/testData/codegen/box/controlStructures/forInArrayWithIndex/forInArrayOfPrimArrayWithIndex.kt
Dmitry Petrov 1eca402332 Use correctElementType to determine array element type for withIndex
Rather unkind "gotcha" in ASM API.

 #KT-23900 Fixed Target versions 1.2.50
2018-04-23 18:00:12 +03:00

14 lines
265 B
Kotlin
Vendored

// WITH_RUNTIME
fun box(): String {
// [[0], [1], [2], [3]]
val arr = Array(4) { intArrayOf(it) }
var s = 0
for ((i, iarr) in arr.withIndex()) {
s += i*iarr[0]
}
// 0 + 1 + 4 + 9 = 14
return if (s != 14) "Fail: $s" else "OK"
}