b79719d6f5
- Materialize unit when its value is actually needed. - Special-case Unit_getInstance return type at codegen. It should be a proper Unit object instead of a "void"
15 lines
235 B
Kotlin
Vendored
15 lines
235 B
Kotlin
Vendored
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"
|
|
}
|