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:
Denis Zharkov
2017-01-27 20:36:41 +03:00
parent 0dd3f11175
commit b0ebbe99d6
8 changed files with 116 additions and 5 deletions
@@ -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
}