[FIR] Remove suspend lambda redundant warning for inline functions

#KT-57971 Fixed
This commit is contained in:
Brian Norman
2023-06-01 06:06:00 -05:00
committed by Space Team
parent 5f59de23c5
commit 0298d17987
10 changed files with 48 additions and 37 deletions
@@ -17,7 +17,7 @@ interface SuspendRunnable {
// Block is NOT allowed to be called from nested classes/lambdas (as common crossinlines)
// It is NOT possible to call startCoroutine on the parameter
// suspend calls possible inside lambda matching to the parameter
suspend inline fun test(c: <!REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE!>suspend<!> () -> Unit) {
suspend inline fun test(c: suspend () -> Unit) {
c()
val o = object: SuspendRunnable {
override suspend fun run() {
@@ -0,0 +1,45 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
inline fun foo1(<!INLINE_SUSPEND_FUNCTION_TYPE_UNSUPPORTED!>x: suspend () -> Unit<!>) {}
inline fun foo2(crossinline x: suspend () -> Unit) {}
<!NOTHING_TO_INLINE!>inline<!> fun foo3(noinline x: suspend () -> Unit) {}
<!NOTHING_TO_INLINE!>inline<!> fun foo4(<!INCOMPATIBLE_MODIFIERS!>noinline<!> <!INCOMPATIBLE_MODIFIERS!>crossinline<!> x: suspend () -> Unit) {}
suspend inline fun bar1(x: suspend () -> Unit) {}
suspend inline fun bar2(crossinline x: suspend () -> Unit) {}
suspend inline fun bar3(noinline x: suspend () -> Unit) {}
suspend inline fun bar4(<!INCOMPATIBLE_MODIFIERS!>noinline<!> <!INCOMPATIBLE_MODIFIERS!>crossinline<!> x: suspend () -> Unit) {}
suspend fun baz() {
foo1 {
return@baz
}
foo2 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
foo3 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
foo4 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
bar1 {
return@baz
}
bar2 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
bar3 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
bar4 {
<!RETURN_NOT_ALLOWED!>return@baz<!>
}
}
@@ -1,4 +1,3 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
inline fun foo1(<!INLINE_SUSPEND_FUNCTION_TYPE_UNSUPPORTED!>x: suspend () -> Unit<!>) {}