Files
kotlin-fork/js/js.translator/testData/box/number/incDecOptimization.kt
T
2021-10-06 09:23:50 +00:00

20 lines
367 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1283
// CHECK_VARS_COUNT: function=test count=1 TARGET_BACKENDS=JS
class A {
var i = 23
}
fun test(a: A): String {
var x = ++a.i
if (x != 24) return "fail1: $x"
a.i++
if (a.i != 25) return "fail2: $a.i"
// a.i++, used as expression, requires temporary variable
return "OK"
}
fun box(): String = test(A())