Disallow non-local break/continue in crossinline lambdas
This commit is contained in:
committed by
Space
parent
79885c770d
commit
fe5a6fd511
+12
@@ -6290,6 +6290,18 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirDiagnosti
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/controlStructures"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInCrossInlineLambda.kt")
|
||||
public void testBreakContinueInCrossInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/breakContinueInCrossInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInNoInlineLambda.kt")
|
||||
public void testBreakContinueInNoInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/breakContinueInNoInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakToLabel.kt")
|
||||
public void testBreakToLabel() throws Exception {
|
||||
|
||||
+12
@@ -6290,6 +6290,18 @@ public class FirOldFrontendDiagnosticsWithLightTreeTestGenerated extends Abstrac
|
||||
KtTestUtil.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/testData/diagnostics/tests/controlStructures"), Pattern.compile("^(.+)\\.kt$"), Pattern.compile("^(.+)\\.fir\\.kts?$"), true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInCrossInlineLambda.kt")
|
||||
public void testBreakContinueInCrossInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/breakContinueInCrossInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInNoInlineLambda.kt")
|
||||
public void testBreakContinueInNoInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/controlStructures/breakContinueInNoInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakToLabel.kt")
|
||||
public void testBreakToLabel() throws Exception {
|
||||
|
||||
+3
-1
@@ -67,7 +67,9 @@ object FirBreakOrContinueJumpsAcrossFunctionBoundaryChecker : FirLoopJumpChecker
|
||||
val symbol = if (allowInlined) element.calleeReference.resolvedSymbol as? FirFunctionSymbol else null
|
||||
element.arguments.forEachIndexed { i, argument ->
|
||||
val expressionToCheck =
|
||||
if (symbol?.resolvedStatus?.isInline == true && !symbol.valueParameterSymbols[i].isNoinline) argument.tryInline() else argument
|
||||
if (symbol?.resolvedStatus?.isInline == true
|
||||
&& !symbol.valueParameterSymbols[i].run { isNoinline || isCrossinline }
|
||||
) argument.tryInline() else argument
|
||||
if (findPathAndCheck(expressionToCheck)) {
|
||||
return true
|
||||
}
|
||||
|
||||
Generated
-6
@@ -1250,12 +1250,6 @@ public class Fir2IrTextTestGenerated extends AbstractFir2IrTextTest {
|
||||
runTest("compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInNoInlineLambda.kt")
|
||||
public void testBreakContinueInNoInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/breakContinueInNoInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInWhen.kt")
|
||||
public void testBreakContinueInWhen() throws Exception {
|
||||
|
||||
-6
@@ -1250,12 +1250,6 @@ public class LightTreeFir2IrTextTestGenerated extends AbstractLightTreeFir2IrTex
|
||||
runTest("compiler/testData/ir/irText/expressions/breakContinueInLoopHeader.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInNoInlineLambda.kt")
|
||||
public void testBreakContinueInNoInlineLambda() throws Exception {
|
||||
runTest("compiler/testData/ir/irText/expressions/breakContinueInNoInlineLambda.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("breakContinueInWhen.kt")
|
||||
public void testBreakContinueInWhen() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user