Files
kotlin-fork/backend.native/tests/external/codegen/box/when/switchOptimizationSparse.kt
T
2017-03-13 15:31:46 +03:00

18 lines
305 B
Kotlin

// WITH_RUNTIME
fun sparse(x: Int): Int {
return when ((x % 4) * 100) {
100 -> 1
200 -> 2
300 -> 3
else -> 4
}
}
fun box(): String {
var result = (0..3).map(::sparse).joinToString()
if (result != "4, 1, 2, 3") return "sparse:" + result
return "OK"
}