c53d91bae1
Do not generate linenumber for the start of the finally block, because that is usually where the only word 'finally' is located. Instead, generate linenumber for the first expression inside the finally block. Not generating this linenumber fixes an issue in code coverage tools which would consider such finally uncovered. Although this might be technically considered as designed, it makes more sense to NOT detect it as uncovered because semantics of the finally block shouldn't really differ whether it's executed normally or because an exception happened. It's also beneficial for the tool support to behave like javac, which doesn't generate the linenumber either. #KT-50973 Fixed
22 lines
479 B
Kotlin
Vendored
22 lines
479 B
Kotlin
Vendored
// IGNORE_BACKEND: JVM
|
|
// The old backend steps on line 4, 5, 9, and 8. No step on the throw, and a step on the end
|
|
// brace of the finally before going into the actual finally code.
|
|
|
|
// FILE: test.kt
|
|
|
|
fun box(): String {
|
|
try {
|
|
val x = "x"
|
|
throw RuntimeException(x)
|
|
} finally {
|
|
return "OK"
|
|
}
|
|
return "FAIL"
|
|
}
|
|
|
|
// EXPECTATIONS
|
|
// test.kt:8 box:
|
|
// test.kt:9 box:
|
|
// test.kt:10 box: x:java.lang.String="x":java.lang.String
|
|
// test.kt:12 box:
|