Fix default value generation after suspension point
Replace coercion from VOID with call 'pushDefaultValueOnStack' It's necessary because coercion of VOID to java/lang/Object ends with Unit instance on stack that makes variables spilling algorithm thinking that variable is Unit #KT-13409 Fixed
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
class Controller {
|
||||
suspend fun <T> suspendHere(v: T, x: Continuation<T>) {
|
||||
x.resume(v)
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(coroutine c: Controller.() -> Continuation<Unit>) {
|
||||
c(Controller()).resume(Unit)
|
||||
}
|
||||
|
||||
var result: Any = ""
|
||||
|
||||
fun <T : Any> foo(v: T) {
|
||||
builder {
|
||||
val r = suspendHere(v)
|
||||
suspendHere("")
|
||||
result = r
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
foo("OK")
|
||||
return result as String
|
||||
}
|
||||
Reference in New Issue
Block a user