Fix problem with missing handleResult call
At first we try to resolve 'handleResult' just as last expression in a lambda is first argument, then if results are unsuccessful try resolve 'handleResult' with fake Unit expression #KT-12969 Fixed
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
class Controller {
|
||||
var isCompleted = false
|
||||
suspend fun suspendHere(x: Continuation<String>) {
|
||||
x.resume("OK")
|
||||
}
|
||||
|
||||
operator fun handleResult(x: Unit, y: Continuation<Nothing>) {
|
||||
isCompleted = true
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(coroutine c: Controller.() -> Continuation<Unit>) {
|
||||
val controller = Controller()
|
||||
c(controller).resume(Unit)
|
||||
if (!controller.isCompleted) throw java.lang.RuntimeException("fail")
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
builder {
|
||||
"OK"
|
||||
}
|
||||
|
||||
builder {
|
||||
suspendHere()
|
||||
}
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user