Allow calling some pieces of the experimental coroutine API

- Calling suspend functions is allowed
- Presence of suspend function type still makes declaration
unusable unless it belongs to a value parameter as a top-level type
containing less then three parameters

Still, warning should be emitted because they will become unsupported in 1.4

 #KT-25683 In Progress
This commit is contained in:
Denis Zharkov
2018-08-20 11:30:32 +03:00
parent c94b72680a
commit 944b0d058a
13 changed files with 272 additions and 89 deletions
@@ -1,27 +1,14 @@
suspend fun dummy() {}
class C {
suspend fun dummy() = "OK"
}
class WithNested {
class Nested {
suspend fun dummy() = "OK"
}
}
class WithInner {
inner class Inner {
suspend fun dummy() = "OK"
}
}
val c: suspend () -> Unit = {}
class WithTypeParameter<T: suspend() -> Unit> {}
fun returnsSuspend() : suspend() -> Unit = {}
fun builder(c: suspend () -> Unit) {}
fun <T: suspend () -> Unit> withTypeParameter() = {}
fun <T: suspend () -> Unit> withTypeParameter() = {}
fun suspendFunctionNested(x: List<suspend () -> Unit>) {}
fun suspendFunctionNestedInFunctionType(x: (suspend () -> Unit) -> Unit) {}
fun suspendFunctionType3(x: suspend (Int, Int, Int) -> Unit) {}
fun suspendVarargs(vararg x: suspend () -> Unit) {}