JVM IR: adjust generation of linenumber for try-finally

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
This commit is contained in:
Alexander Udalov
2022-02-03 02:34:50 +01:00
parent 838743bf07
commit c53d91bae1
9 changed files with 34 additions and 8 deletions
@@ -0,0 +1,10 @@
fun foo() {
try {
System.out.println("A")
} finally {
System.out.println("B")
}
}
// 0 LINENUMBER 4
// 2 LINENUMBER 5