Add test for questionable chained fun -> suspend conversion

This commit is contained in:
Mikhail Zarechenskiy
2020-04-22 05:31:38 +03:00
parent ac642cf175
commit cb975bde7c
6 changed files with 53 additions and 0 deletions
@@ -0,0 +1,14 @@
// !LANGUAGE: +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun interface SuspendRunnable {
suspend fun invoke()
}
fun foo(s: SuspendRunnable) {}
fun test(f: () -> Unit) {
foo { }
<!INAPPLICABLE_CANDIDATE!>foo<!>(f)
}
@@ -0,0 +1,13 @@
// !LANGUAGE: +SuspendConversion
// !DIAGNOSTICS: -UNUSED_PARAMETER
fun interface SuspendRunnable {
suspend fun invoke()
}
fun foo(s: SuspendRunnable) {}
fun test(f: () -> Unit) {
foo { }
foo(<!TYPE_MISMATCH!>f<!>)
}
@@ -0,0 +1,11 @@
package
public fun foo(/*0*/ s: SuspendRunnable): kotlin.Unit
public fun test(/*0*/ f: () -> kotlin.Unit): kotlin.Unit
public fun interface SuspendRunnable {
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public abstract suspend fun invoke(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}