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

12 lines
236 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: NULL_REF_CAST
// IGNORE_BACKEND_FIR: JVM_IR
fun String?.foo() = this ?: "OK"
fun foo(i: Int?): String {
if (i == null) return i.foo()
return "$i"
}
fun box() = foo(null)