KT-3706 Inconsistent stack height in try catch finally in function
KT-4134 Incorrect bytecode is generated for #KT-3706 Fixed #KT-4134 Fixed
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
fun f(): Int {
|
||||
try {
|
||||
return 0
|
||||
}
|
||||
finally {
|
||||
try { // culprit ?? remove this try-catch and it works.
|
||||
} catch (ignore: Exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
if (f() != 0) return "fail1"
|
||||
|
||||
return "OK"
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
fun <T, R> io(s: R, a: (R) -> T): T {
|
||||
try {
|
||||
return a(s)
|
||||
} finally {
|
||||
try {
|
||||
s.toString()
|
||||
} catch(e: Exception) {
|
||||
//NOP
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
return io(("OK"), {it})
|
||||
}
|
||||
Reference in New Issue
Block a user