Disallow non-local break/continue in crossinline lambdas
This commit is contained in:
committed by
Space
parent
79885c770d
commit
fe5a6fd511
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: +BreakContinueInInlineLambdas
|
||||
|
||||
|
||||
inline fun foo(crossinline block: () -> Unit) = block()
|
||||
|
||||
|
||||
fun test1() {
|
||||
L1@ while (true) {
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break@L1<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue@L1<!> }
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public inline fun foo(/*0*/ crossinline block: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test1(): kotlin.Unit
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// FIR_IDENTICAL
|
||||
// LANGUAGE: +BreakContinueInInlineLambdas
|
||||
|
||||
|
||||
<!NOTHING_TO_INLINE!>inline<!> fun foo(noinline block: () -> Unit) = block()
|
||||
|
||||
|
||||
fun test1() {
|
||||
L1@ while (true) {
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>break@L1<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue<!> }
|
||||
|
||||
foo { <!BREAK_OR_CONTINUE_JUMPS_ACROSS_FUNCTION_BOUNDARY!>continue@L1<!> }
|
||||
}
|
||||
}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public inline fun foo(/*0*/ noinline block: () -> kotlin.Unit): kotlin.Unit
|
||||
public fun test1(): kotlin.Unit
|
||||
Reference in New Issue
Block a user