Files
kotlin-fork/compiler/testData/codegen/box/finally/kt31923_wrong.kt
T
Mikhael Bogdanov c335015c05 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
2019-12-12 13:33:39 +01:00

28 lines
529 B
Kotlin
Vendored

// !LANGUAGE: -ProperFinally
// TARGET_BACKEND: JVM
var result = ""
fun test() {
try {
try {
result += "try"
return
} 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 catch finally") "OK" else "fail: $result"
}