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

16 lines
231 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
var x = 0
class A {
fun f() = if (x == 1) "OK" else "Fail $x"
}
fun callTwice(f: () -> String): String {
f()
return f()
}
fun box(): String {
return callTwice(({ x++; A() }())::f)
}