Files
kotlin-fork/js/js.translator/testFiles/expression/misc/cases/safecallComputesExpressionOnlyOnce.kt
T
2012-02-27 21:55:58 +04:00

14 lines
216 B
Kotlin

package foo
var i = 0
fun test() : Int? = i++
fun box() : Boolean {
if (i != 0) return false
test()?.plus(1)
if (i != 1) return false
test()?.minus(2)
if (i != 2) return false
return true
}