[NI] Support callable references to suspend functions

#KT-30658 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-03-28 11:50:37 +03:00
parent 017f9aea35
commit 1ac25259e8
6 changed files with 52 additions and 5 deletions
@@ -0,0 +1,22 @@
// !LANGUAGE: +NewInference
// !DIAGNOSTICS: -UNUSED_PARAMETER
// !USE_EXPERIMENTAL: kotlin.Experimental
import kotlin.reflect.KSuspendFunction0
import kotlin.reflect.KSuspendFunction1
import kotlin.reflect.KFunction0
import kotlin.reflect.KFunction1
fun test0(serialize: KSuspendFunction0<Unit>) {}
fun test1(serialize: KSuspendFunction1<Int, Unit>) {}
suspend fun foo() {}
suspend fun bar(x: Int) {}
fun test() {
test0(::foo)
test1(<!TYPE_MISMATCH!>::foo<!>)
test0(<!TYPE_MISMATCH!>::bar<!>)
test1(::bar)
}
@@ -0,0 +1,7 @@
package
public suspend fun bar(/*0*/ x: kotlin.Int): kotlin.Unit
public suspend fun foo(): kotlin.Unit
public fun test(): kotlin.Unit
public fun test0(/*0*/ serialize: kotlin.reflect.KSuspendFunction0<kotlin.Unit>): kotlin.Unit
public fun test1(/*0*/ serialize: kotlin.reflect.KSuspendFunction1<kotlin.Int, kotlin.Unit>): kotlin.Unit