Fix coroutine-related VerifyError
The problem was that we spilled the `origin` variable (see test) as Object, because we determined the type of merge(null, String) incorrectly. #KT-15973 Fixed
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
fun builder(c: suspend () -> Unit) {
|
||||
c.startCoroutine(EmptyContinuation)
|
||||
}
|
||||
|
||||
var res = ""
|
||||
|
||||
suspend fun foo(y: A?): String {
|
||||
val origin: String? = y?.z
|
||||
if (origin != null) {
|
||||
baz(origin)
|
||||
baz(origin)
|
||||
}
|
||||
|
||||
return res
|
||||
}
|
||||
|
||||
suspend fun baz(y: String): Unit = suspendCoroutineOrReturn { x ->
|
||||
res += y[res.length]
|
||||
x.resume(Unit)
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
|
||||
class A(val z: String)
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
result = foo(A("OK"))
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user