Fix coroutine generation in case of empty lambda

'handleResult' should be called in such case too
This commit is contained in:
Denis Zharkov
2016-06-20 15:41:33 +03:00
parent b6ccd03ef4
commit 453ee55615
4 changed files with 55 additions and 11 deletions
@@ -0,0 +1,20 @@
class Controller {
var ok = false
operator fun handleResult(u: Unit, v: Continuation<Nothing>) {
ok = true
}
}
fun builder(coroutine c: Controller.() -> Continuation<Unit>): String {
val controller = Controller()
c(controller).resume(Unit)
if (!controller.ok) throw java.lang.RuntimeException("Was not called")
return "OK"
}
fun unitFun() {}
fun box(): String {
return builder {}
}