Files
kotlin/compiler/testData/debug/localVariables/tryFinally11.kt
Mads Ager d33b70af1a [JVM IR] Ensure an instruction for the line number for a break.
This ensures that the debugger always has a bytecode offset for
the line number of a break/continue so that you step there and
so that you can set breakpoints there.

The `nop` instruction is optimized out if it has no line number
information.

^KT-46450 Fixed
2021-08-19 15:40:44 +02:00

38 lines
1.2 KiB
Kotlin
Vendored

// FILE: test.kt
fun box(): String {
try {
for (i in 0 until 1) {
try {
val x = "x"
throw RuntimeException(x)
} catch (e: Exception) {
val y = "y"
val z = "z"
break
} finally {
throw RuntimeException("$i")
}
}
} finally {
return "OK"
}
return "FAIL"
}
// The local variables `z` and `y` are visible in the finally block with old backend.
// IGNORE_BACKEND: JVM
// LOCAL VARIABLES
// test.kt:4 box:
// test.kt:5 box:
// test.kt:6 box: i:int=0:int
// test.kt:7 box: i:int=0:int
// test.kt:8 box: i:int=0:int, x:java.lang.String="x":java.lang.String
// test.kt:9 box: i:int=0:int
// test.kt:10 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException
// test.kt:11 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String
// test.kt:12 box: i:int=0:int, e:java.lang.Exception=java.lang.RuntimeException, y:java.lang.String="y":java.lang.String, z:java.lang.String="z":java.lang.String
// test.kt:14 box: i:int=0:int
// test.kt:18 box: