Files
kotlin-fork/compiler/testData/codegen/box/callableReference/bound/receiverEvaluatedOnce.kt
T
2021-09-20 19:08:22 +03:00

16 lines
202 B
Kotlin
Vendored

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)
}