Fix signature of accessor for suspend function

It must be a suspend function too to have an additional Continuation parameter

 #KT-15715 Fixed
This commit is contained in:
Denis Zharkov
2017-01-17 11:29:25 +03:00
parent d0d617b44e
commit 630fab1952
8 changed files with 108 additions and 1 deletions
@@ -0,0 +1,34 @@
// WITH_RUNTIME
// WITH_COROUTINES
import kotlin.coroutines.*
import kotlin.coroutines.intrinsics.*
fun builder(c: suspend () -> Unit) {
c.startCoroutine(EmptyContinuation)
}
class A {
suspend private fun a(): String = suspendCoroutineOrReturn { x ->
x.resume("OK")
SUSPENDED_MARKER
}
suspend fun myfun(): String {
var result = "fail"
builder {
result = a()
}
return result
}
}
fun box(): String {
var result = ""
builder {
result = A().myfun()
}
return result
}