Files
kotlin-fork/compiler/testData/codegen/box/when/whenArgumentIsEvaluatedOnlyOnce.kt
T
2019-11-19 11:00:09 +03:00

16 lines
264 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// KJS_WITH_FULL_RUNTIME
var x = 0
fun inc(): Int {
x++
return 0
}
fun box(): String {
val al = ArrayList<Int>()
when (inc()) {
in al -> return "fail 1"
else -> {}
}
return if (x == 1) "OK" else "fail 2"
}