Files
kotlin-fork/compiler/testData/codegen/box/unit/kt4265.kt
T
Steven Schäfer 7d59c7689c JVM IR: Avoid direct invokes in callable reference tests
Due to the direct invoke optimization, most callable reference tests
were not generating callable references/lambdas.
2022-07-14 23:24:18 +02:00

15 lines
248 B
Kotlin
Vendored

fun <T : Any, R> T.myLet(f: (T) -> R): R = f(this)
fun box(): String {
val o: String? = null
var state = 0
o?.myLet {
state = 1
} ?: { state = 2 }.let { it() }
if (state != 2) return "Fail: $state"
return "OK"
}