KT-1436 Allow break/continue in inlined lambdas
This commit is contained in:
committed by
teamcity
parent
ba7df005a1
commit
8ba80b4b7b
@@ -0,0 +1,31 @@
|
||||
// LANGUAGE: +BreakContinueInInlineLambdas
|
||||
// TARGET_BACKEND: JVM_IR
|
||||
// IGNORE_BACKEND_FIR: JVM_IR
|
||||
// !IGNORE_ERRORS
|
||||
// WITH_STDLIB
|
||||
|
||||
inline fun foo(block: () -> Unit) { block() }
|
||||
|
||||
inline fun bar(block1: () -> Unit, noinline block2: () -> Unit) {
|
||||
block1()
|
||||
block2()
|
||||
}
|
||||
|
||||
fun test1() {
|
||||
while (true) {
|
||||
foo { break }
|
||||
foo { continue }
|
||||
foo(fun () { break })
|
||||
foo(fun () { continue })
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
while (true) {
|
||||
bar({break}, {})
|
||||
bar({continue}, {})
|
||||
|
||||
bar(fun () {break}, fun () {})
|
||||
bar(fun () {continue}, fun () {})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user