mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-12 00:21:32 +00:00
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
18 lines
330 B
Kotlin
18 lines
330 B
Kotlin
fun call(f: () -> Unit) = f()
|
|
|
|
fun f1() {
|
|
@outer while (true) {
|
|
call {
|
|
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break@outer<!>
|
|
}
|
|
}
|
|
}
|
|
|
|
fun f2() {
|
|
do {
|
|
fun inner() {
|
|
<!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!>
|
|
}
|
|
} while (true)
|
|
}
|