Fix exception after combination of while (true) + stack-spilling
FixStack transformation divides on phases: - Fixing stack before break/continue - Fixing stack for inline markers/try-catch blocks After the first stage all ALWAYS_TRUE markers are replaced with simple GOTO's and if we're skipping break/continue edges we won't reach the code after while (true) statement. At the same time it's fine to not to skip them in the second phase as the stack for them is already corrected in the first phase #KT-19475 Fixed
This commit is contained in:
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// WITH_RUNTIME
|
||||
fun box(): String {
|
||||
val a = arrayListOf<String>()
|
||||
|
||||
while (true) {
|
||||
if (a.size == 0) {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
for (i in 1..2) {
|
||||
a.add(try { foo() } catch (e: Throwable) { "OK" })
|
||||
}
|
||||
|
||||
return a[0]
|
||||
}
|
||||
|
||||
fun foo(): String = throw RuntimeException()
|
||||
Reference in New Issue
Block a user