KT-1436 Allow break/continue in inlined lambdas

This commit is contained in:
Pavel Mikhailovskii
2022-08-11 00:12:43 +02:00
committed by teamcity
parent ba7df005a1
commit 8ba80b4b7b
52 changed files with 1851 additions and 88 deletions
@@ -0,0 +1,60 @@
inline fun foo(block: Function0<Unit>) {
block.invoke()
}
inline fun bar(block1: Function0<Unit>, noinline block2: Function0<Unit>) {
block1.invoke()
block2.invoke()
}
fun test1() {
while (true) { // BLOCK
foo(block = local fun <anonymous>() {
break
}
)
foo(block = local fun <anonymous>() {
continue
}
)
foo(block = local fun <no name provided>() {
break
}
)
foo(block = local fun <no name provided>() {
continue
}
)
}
}
fun test2() {
while (true) { // BLOCK
bar(block1 = local fun <anonymous>() {
break
}
, block2 = local fun <anonymous>() {
return Unit
}
)
bar(block1 = local fun <anonymous>() {
continue
}
, block2 = local fun <anonymous>() {
return Unit
}
)
bar(block1 = local fun <no name provided>() {
break
}
, block2 = local fun <no name provided>() {
}
)
bar(block1 = local fun <no name provided>() {
continue
}
, block2 = local fun <no name provided>() {
}
)
}
}