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

20 lines
315 B
Kotlin
Vendored

// IGNORE_BACKEND_FIR: JVM_IR
// WITH_REFLECT
import kotlin.reflect.KProperty0
var x = 0
class A {
val p: String
get() = if (x == 1) "OK" else "Fail $x"
}
fun callTwice(p: KProperty0<String>): String {
p.get()
return p.get()
}
fun box(): String {
return callTwice(({ x++; A() }())::p)
}