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"
}
@@ -0,0 +1,8 @@
// !LANGUAGE: +Coroutines
// !DIAGNOSTICS: -USELESS_IS_CHECK
// SKIP_TXT
fun test() {
suspend {} is <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><*>
suspend {} is kotlin.coroutines.SuspendFunction0<*>
}
@@ -11,7 +11,7 @@ typealias Test4 = <!WRONG_MODIFIER_TARGET!>suspend<!> Action
typealias Test5 = List<suspend () -> Unit>
typealias Test6 = <!WRONG_MODIFIER_TARGET!>suspend<!> List<() -> Unit>
typealias Test7 = <!WRONG_MODIFIER_TARGET!>suspend<!> SAM
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> SuspendFunction0<Unit>
typealias Test8 = <!WRONG_MODIFIER_TARGET!>suspend<!> kotlin.coroutines.SuspendFunction0<Unit>
typealias Test9 = suspend (() -> Unit) -> Unit
typealias Test10 = suspend (suspend () -> Unit) -> Unit
typealias Test11 = suspend () -> (suspend () -> Unit)
@@ -1,4 +1,4 @@
// JAVAC_SKIP
typealias Test1 = SuspendFunction0<Unit>
typealias Test2 = kotlin.SuspendFunction0<Unit>
typealias Test3 = kotlin.coroutines.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test1 = <!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test2 = kotlin.<!UNRESOLVED_REFERENCE!>SuspendFunction0<!><Unit>
typealias Test3 = kotlin.coroutines.SuspendFunction0<Unit>
@@ -1,5 +1,5 @@
package
public typealias Test1 = suspend () -> kotlin.Unit
public typealias Test2 = suspend () -> kotlin.Unit
public typealias Test3 = [ERROR : kotlin.coroutines.SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test1 = [ERROR : SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test2 = [ERROR : kotlin.SuspendFunction0<Unit>]<kotlin.Unit>
public typealias Test3 = suspend () -> kotlin.Unit