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:
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user