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:
Mikhael Bogdanov
2014-02-07 13:45:22 +04:00
parent 7b07b748cb
commit e0ca1abe4b
4 changed files with 58 additions and 1 deletions
@@ -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})
}