Files
kotlin-fork/compiler/testData/codegen/box/closures/capturedVarsOptimization/kt45446.kt
T

26 lines
468 B
Kotlin
Vendored

// DONT_TARGET_EXACT_BACKEND: WASM
// WASM_MUTE_REASON: EXCEPTIONS_NOT_IMPLEMENTED
// This test checks that bytecode optimizer doesn't crash on unreachable code.
fun box(): String {
try {
remove()
}
catch (e: Exception) {
return e.message!!
}
return "Should fail with exception"
}
fun remove() {
throw Exception("OK")
var captured = 0
debug {
captured = 1
}
}
private fun debug(f: () -> Unit) {
f()
}