Prohibit labeled returns inside kotlin.suspend argument lambdas
Probably, it would be more correct to skip such lambdas when resolving the returns' references, but it'd be more complicated and still useless since non-local returns are impossible in such lambdas (relevant parameter is noinline) #KT-22900 Fixed
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
// SKIP_TXT
|
||||
fun bar() {
|
||||
suspend {
|
||||
<!RETURN_FOR_BUILT_IN_SUSPEND!>return@suspend<!>
|
||||
}
|
||||
|
||||
suspend {
|
||||
run {
|
||||
<!RETURN_FOR_BUILT_IN_SUSPEND!>return@suspend<!>
|
||||
}
|
||||
}
|
||||
|
||||
suspend l@{
|
||||
return@l
|
||||
}
|
||||
|
||||
suspend suspend@{
|
||||
return@suspend
|
||||
}
|
||||
|
||||
val <!UNUSED_VARIABLE!>x<!> = suspend@{
|
||||
suspend {
|
||||
// Might be resolved to outer lambda, but doesn't make sense because suspend-lambdas here is noinline
|
||||
<!RETURN_FOR_BUILT_IN_SUSPEND!>return<!LABEL_NAME_CLASH!>@suspend<!><!>
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user