Move SuspendFunction{N} interfaces to kotlin.coroutines package

#KT-25824: Fixed
This commit is contained in:
Ilmir Usmanov
2018-08-16 20:44:09 +03:00
parent 4a7703ed66
commit 0559cfb724
26 changed files with 111 additions and 103 deletions
@@ -7,6 +7,7 @@
// FILE: test.kt
import kotlin.reflect.KSuspendFunction0
import kotlin.coroutines.SuspendFunction0
class Test {
suspend fun o() = "O"
@@ -1,19 +0,0 @@
// IGNORE_BACKEND: JS_IR, JS
// IGNORE_BACKEND: JVM_IR
// WITH_RUNTIME
// WITH_COROUTINES
// LANGUAGE_VERSION: 1.2
import helpers.*
import kotlin.coroutines.*
val lambda1 = { x: Any -> } as (Any) -> Unit
val suspendLambda0: suspend () -> Unit = {}
fun box(): String {
assert(lambda1 is SuspendFunction0<*>) { "Failed: lambda1 !is SuspendFunction0<*>" }
assert(suspendLambda0 is Function1<*, *>) { "Failed: suspendLambda0 is Function1<*, *>" }
assert(suspendLambda0 is SuspendFunction0<*>) { "Failed: suspendLambda0 is SuspendFunction0<*>" }
return "OK"
}
@@ -21,6 +21,10 @@ class A {
suspend fun suspendFoo() {}
}
inline fun <reified T : suspend () -> Unit> checkReified(noinline x: (Any?) -> Unit) {
if(x is T) throw IllegalStateException("x is T")
}
fun box(): String {
val f1 = ::fn1 as Any
val sf0 = ::suspendFn0 as Any
@@ -57,5 +61,7 @@ fun box(): String {
assert(safoo is Function2<*, *, *>) { "safoo is Function2<*, *, *>" }
assert(safoo is SuspendFunction1<*, *>) { "asfoo is SuspendFunction1<*, *>" }
checkReified<suspend () -> Unit> {}
return "OK"
}