JVM_IR KT-45446 don't erase captured var if it's dead code
This commit is contained in:
committed by
TeamCityServer
parent
6bd34db725
commit
7fabc19326
@@ -0,0 +1,25 @@
|
||||
// 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()
|
||||
}
|
||||
Reference in New Issue
Block a user