[JVM_IR] Fix range of locals in connection with finally blocks.

For code such as:

```
try {
  var y = "y"
  for (i in 0 until 1) {
    return y
  }
} finally {
  println("finally")
}
```

The local variables `y` and `i` ended up covering the finally block as
well in the debugger.

This change splits the range of the locals so that they do
not cover the finally block.

This change does not change the inliner to do similar transformations,
so the range of locals is still wrong win finally blocks when inlined
into an inline function. Added a failing test to that effect.
This commit is contained in:
Mads Ager
2021-03-30 13:29:25 +02:00
committed by Mikhael Bogdanov
parent 0764a0601c
commit 6d9f02cfc6
16 changed files with 351 additions and 5 deletions
@@ -0,0 +1,14 @@
inline fun g(block: () -> Unit): Unit = block()
fun box(): String {
try {
for (c in emptyArray<String>()) {
g {
for (d in emptyArray<Int>()) {
return "Fail"
}
}
}
} finally {}
return "OK"
}