PSI2IR: Support suspend conversion for function references
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
// !LANGUAGE: +SuspendConversion
|
||||
|
||||
fun useSuspend(fn: suspend () -> Unit) {}
|
||||
fun useSuspendInt(fn: suspend (Int) -> Unit) {}
|
||||
|
||||
suspend fun foo0() {}
|
||||
fun foo1() {}
|
||||
fun fooInt(x: Int) {}
|
||||
fun foo2(vararg xs: Int) {}
|
||||
fun foo3(): Int = 42
|
||||
fun foo4(i: Int = 42) {}
|
||||
|
||||
class C {
|
||||
fun bar() {}
|
||||
}
|
||||
|
||||
fun testLambda() { useSuspend { foo1() } }
|
||||
|
||||
fun testNoCoversion() { useSuspend(::foo0) }
|
||||
|
||||
fun testSuspendPlain() { useSuspend(::foo1) }
|
||||
|
||||
fun testSuspendWithArgs() { useSuspendInt(::fooInt) }
|
||||
|
||||
fun testWithVararg() { useSuspend(::foo2) }
|
||||
|
||||
fun testWithVarargMapped() { useSuspendInt(::foo2) }
|
||||
|
||||
fun testWithCoercionToUnit() { useSuspend(::foo3) }
|
||||
|
||||
fun testWithDefaults() { useSuspend(::foo4) }
|
||||
|
||||
fun testWithBoundReceiver() { useSuspend(C()::bar) }
|
||||
Reference in New Issue
Block a user