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
@@ -3,7 +3,7 @@ import libO.*
suspend fun newMain() {
newFoo()
<error descr="[DEPRECATION_ERROR] Using 'oldFoo(): Unit' is an error. Experimental coroutine cannot be used with API version 1.3">oldFoo</error>()
<warning descr="[DEPRECATION] 'oldFoo(): Unit' is deprecated. Experimental coroutines support will be dropped in 1.4">oldFoo</warning>()
// TODO: actually, it's a bug
oldMain()
@@ -14,5 +14,5 @@ fun newMain2() {
newMain()
}
<error descr="[DEPRECATION_ERROR] Using 'oldFoo(): Unit' is an error. Experimental coroutine cannot be used with API version 1.3"><error descr="[ILLEGAL_SUSPEND_FUNCTION_CALL] Suspend function 'oldFoo' should be called only from a coroutine or another suspend function">oldFoo</error></error>()
<error descr="[ILLEGAL_SUSPEND_FUNCTION_CALL] Suspend function 'oldFoo' should be called only from a coroutine or another suspend function">oldFoo</error>()
}