Generate proper exception table
Don't forget to split nested try blocks without finally block on generating finally blocks from outer ones. #KT-31923 InProgress
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
// !LANGUAGE: +ProperFinally
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
var result = ""
|
||||
|
||||
fun test() {
|
||||
for (z in 1..2) {
|
||||
try {
|
||||
try {
|
||||
result += "try"
|
||||
continue
|
||||
} catch (fail: Throwable) {
|
||||
result += "catch"
|
||||
}
|
||||
} finally {
|
||||
result += " finally"
|
||||
throw RuntimeException()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
test()
|
||||
return "fail: expected exception"
|
||||
} catch (e: RuntimeException) {
|
||||
|
||||
}
|
||||
|
||||
return if (result == "try finally") "OK" else "fail: $result"
|
||||
}
|
||||
Reference in New Issue
Block a user