Disallow break or continue across a function boundary
Code containing breaks or continues that attempt to jump across a
function boundary weren't detected during analysis but would crash
the compiler during code generation. Add diagnostics for these kinds
of errors.
Example:
fun f() {
while (true) {
fun inner() {
continue
}
}
}
#KT-4334 Fixed
This commit is contained in:
@@ -1745,6 +1745,11 @@ public class JetDiagnosticsTestGenerated extends AbstractJetDiagnosticsTest {
|
||||
doTest("compiler/testData/diagnostics/tests/controlStructures/ForbidStatementAsDirectFunctionBody.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("jumpAcrossFunctionBoundary.kt")
|
||||
public void testJumpAcrossFunctionBoundary() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/controlStructures/jumpAcrossFunctionBoundary.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt1075.kt")
|
||||
public void testKt1075() throws Exception {
|
||||
doTest("compiler/testData/diagnostics/tests/controlStructures/kt1075.kt");
|
||||
|
||||
Reference in New Issue
Block a user