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

19 lines
299 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: EXCEPTIONS_NOT_IMPLEMENTED
fun a(): String? = null
fun b(): Nothing = throw Exception()
fun foo(): String = a() ?: b()
fun box(): String {
try {
foo()
} catch (e: Exception) {
return "OK"
}
return "Fail"
}