blob: 17c3c1c8d38e9cf56d216c0213ebcc66d9e0161f [file]
// IGNORE_BACKEND: WASM_JS, WASM_WASI
// WASM_MUTE_REASON: Null leaking is not allowed by Wasm
fun <T> Any?.unsafeCast(): T = this as T
fun <R> foo(returnType: String): R {
return when {
returnType == "Nothing" -> throw Exception()
else -> null.unsafeCast()
}
}
fun box(): String {
foo<String>("")
return "OK"
}