Fix libraries analysis for case of isReleaseCoroutines feature enabled
#KT-25466 In Progress
This commit is contained in:
+4
@@ -0,0 +1,4 @@
|
||||
package libN
|
||||
|
||||
suspend fun newFoo() {}
|
||||
fun newBuilder(x: suspend () -> Unit) {}
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
package libO
|
||||
|
||||
suspend fun oldFoo() {}
|
||||
fun oldBuilder(x: suspend () -> Unit) {}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
import libN.*
|
||||
import libO.*
|
||||
|
||||
suspend fun newMain() {
|
||||
newFoo()
|
||||
oldFoo(<error descr="[NO_VALUE_FOR_PARAMETER] No value passed for parameter 'continuation'">)</error>
|
||||
|
||||
oldFoo(
|
||||
object : kotlin.coroutines.experimental.Continuation<Unit> {
|
||||
override val context
|
||||
get() = null!!
|
||||
|
||||
override fun resume(value: Unit) {}
|
||||
|
||||
override fun resumeWithException(exception: Throwable) {}
|
||||
}
|
||||
)
|
||||
|
||||
// TODO: actually, it's a bug
|
||||
oldMain()
|
||||
}
|
||||
|
||||
fun newMain2() {
|
||||
newBuilder {
|
||||
newMain()
|
||||
}
|
||||
|
||||
oldBuilder {
|
||||
<error descr="[ILLEGAL_SUSPEND_FUNCTION_CALL] Suspend function 'newMain' should be called only from a coroutine or another suspend function">newMain</error>()
|
||||
|
||||
// `suspend () -> Unit` becomes (Continuation<Unit> -> Any?)
|
||||
it.resume(Unit)
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
import libN.*
|
||||
import libO.*
|
||||
|
||||
suspend fun oldMain() {
|
||||
<error descr="[VERSION_REQUIREMENT_DEPRECATION_ERROR] 'newFoo(): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2">newFoo</error>()
|
||||
oldFoo()
|
||||
}
|
||||
|
||||
fun oldMain2() {
|
||||
<error descr="[VERSION_REQUIREMENT_DEPRECATION_ERROR] 'newBuilder((Continuation<Unit>) -> Any?): Unit' is only available since Kotlin 1.3 and cannot be used in Kotlin 1.2">newBuilder</error> {
|
||||
<error descr="[ILLEGAL_SUSPEND_FUNCTION_CALL] Suspend function 'oldMain' should be called only from a coroutine or another suspend function">oldMain</error>()
|
||||
}
|
||||
|
||||
oldBuilder {
|
||||
oldMain()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user