[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:
committed by
Mikhael Bogdanov
parent
0764a0601c
commit
6d9f02cfc6
js/js.tests/tests-gen/org/jetbrains/kotlin/js/test/es6/semantics/IrJsCodegenBoxES6TestGenerated.java
Generated
+5
@@ -6014,6 +6014,11 @@ public class IrJsCodegenBoxES6TestGenerated extends AbstractIrJsCodegenBoxES6Tes
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturnInTryFinally.kt")
|
||||
public void testNonLocalReturnInTryFinally() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/nonLocalReturnInTryFinally.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("splitTry.kt")
|
||||
public void testSplitTry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt");
|
||||
|
||||
Generated
+5
@@ -5425,6 +5425,11 @@ public class IrJsCodegenBoxTestGenerated extends AbstractIrJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturnInTryFinally.kt")
|
||||
public void testNonLocalReturnInTryFinally() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/nonLocalReturnInTryFinally.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("splitTry.kt")
|
||||
public void testSplitTry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt");
|
||||
|
||||
Generated
+5
@@ -5425,6 +5425,11 @@ public class JsCodegenBoxTestGenerated extends AbstractJsCodegenBoxTest {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/multipleCatchBlocks.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("nonLocalReturnInTryFinally.kt")
|
||||
public void testNonLocalReturnInTryFinally() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/nonLocalReturnInTryFinally.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("splitTry.kt")
|
||||
public void testSplitTry() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/controlStructures/tryCatchInExpressions/splitTry.kt");
|
||||
|
||||
Reference in New Issue
Block a user