Properly generate exception table for try/catch block
KT-3549 'Finally' block not run when re-throwing exception KT-3867 When catched exception occurs in finnaly block it invokes additional catch and itself #KT-3549 Fixed #KT-3867 Fixed
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
fun test1() : String {
|
||||
var s = "";
|
||||
try {
|
||||
try {
|
||||
s += "Try";
|
||||
throw Exception()
|
||||
} catch (x : Exception) {
|
||||
s += "Catch";
|
||||
throw x
|
||||
} finally {
|
||||
s += "Finally";
|
||||
}
|
||||
} catch (x : Exception) {
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() : String {
|
||||
var s = "";
|
||||
|
||||
try {
|
||||
s += "Try";
|
||||
throw Exception()
|
||||
} catch (x : Exception) {
|
||||
s += "Catch";
|
||||
} finally {
|
||||
s += "Finally";
|
||||
}
|
||||
|
||||
return s
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun box() : String {
|
||||
if (test1() != "TryCatchFinally") return "fail1: ${test1()}"
|
||||
|
||||
if (test2() != "TryCatchFinally") return "fail2: ${test2()}"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user