Files
kotlin-fork/compiler/testData/codegen/box/unit/kt4265.kt
T
2020-11-09 16:04:43 +03:00

17 lines
303 B
Kotlin
Vendored

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