[FIR] Add REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE diagnostic

This commit is contained in:
Andrey Zinovyev
2021-07-22 15:33:00 +03:00
committed by teamcityserver
parent e56deb4525
commit c46a393a19
10 changed files with 34 additions and 48 deletions
@@ -16,7 +16,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: suspend () -> Unit) {
suspend inline fun test(c: <!REDUNDANT_INLINE_SUSPEND_FUNCTION_TYPE!>suspend<!> () -> Unit) {
c()
val o = object: SuspendRunnable {
override suspend fun run() {
@@ -1,45 +0,0 @@
// !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,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
// SKIP_TXT
inline fun foo1(<!INLINE_SUSPEND_FUNCTION_TYPE_UNSUPPORTED!>x: suspend () -> Unit<!>) {}