FIR: fix label stealling and crash with multiple labels
Consider the code below
```
fun test() {
a@ b@ {
{}
}
}
```
Currently when the code is converted to FIR, label `b` is bound to the
outer lambda and `a` gets bound to the inner lambda because it's not
consumed. This is wrong and also leads transfromation to fail with
exceptions because of the unexpected consumption of `a`.
This change fixes the above issue by designating a specific node in the
AST as the allowed user of a label when the label is added.
This commit is contained in:
committed by
TeamCityServer
parent
5c716ea979
commit
fadde98a86
+6
@@ -6271,6 +6271,12 @@ public class DiagnosisCompilerTestFE10TestdataTestGenerated extends AbstractDiag
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/localReturnInsidePropertyAccessor.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("nestedLoopsWithMultipleLabels.kt")
|
||||
public void testNestedLoopsWithMultipleLabels() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/nestedLoopsWithMultipleLabels.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("notAFunctionLabel_after.kt")
|
||||
public void testNotAFunctionLabel_after() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user