[FIR] Prohibit suspend anonymous functions in statement position

^KT-62018 Fixed
^KT-62019
This commit is contained in:
Dmitriy Novozhilov
2023-12-12 17:02:11 +02:00
committed by Space Team
parent cae6e0ee0f
commit fb00c1dfb6
23 changed files with 116 additions and 5 deletions
@@ -0,0 +1,13 @@
FILE: suspendAnonymousFunction.kt
public final fun take(f: R|suspend () -> kotlin/Unit|): R|kotlin/Unit| {
}
public final fun test_1(): R|kotlin/Unit| {
suspend fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
}
}
public final fun test_2(): R|kotlin/Unit| {
R|/take<Inapplicable(INAPPLICABLE_ARGUMENTS_MAPPING_ERROR): /take>#|(<Unresolved name: suspend>#, fun <anonymous>(): R|kotlin/Unit| <inline=Unknown> {
}
)
}
@@ -0,0 +1,11 @@
// ISSUE: KT-62018, KT-62019
fun take(f: suspend () -> Unit) {}
fun test_1() {
<!ANONYMOUS_SUSPEND_FUNCTION!>suspend<!> fun() {}
}
fun test_2() {
take(<!UNRESOLVED_REFERENCE!>suspend<!><!SYNTAX!><!> <!TOO_MANY_ARGUMENTS!>fun () {}<!>)
}