c335015c05
Don't forget to split nested try blocks without finally block on generating finally blocks from outer ones. #KT-31923 InProgress
31 lines
603 B
Kotlin
Vendored
31 lines
603 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
var result = ""
|
|
|
|
fun test() {
|
|
try {
|
|
for (z in 1..2) {
|
|
|
|
try {
|
|
result += "try "
|
|
continue
|
|
} catch (fail: Throwable) {
|
|
result += " catch"
|
|
}
|
|
}
|
|
result += "after loop"
|
|
} finally {
|
|
result += " finally"
|
|
throw RuntimeException()
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
try {
|
|
test()
|
|
return "fail: expected exception"
|
|
} catch (e: RuntimeException) {
|
|
|
|
}
|
|
|
|
return if (result == "try try after loop finally") "OK" else "fail: $result"
|
|
} |