Allow destructuring in suspend lambda with suspend componentX
#KT-16113 Fixed
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// WITH_RUNTIME
|
||||
// WITH_COROUTINES
|
||||
// IGNORE_BACKEND: JS
|
||||
import kotlin.coroutines.experimental.*
|
||||
import kotlin.coroutines.experimental.intrinsics.*
|
||||
|
||||
data class A(val o: String) {
|
||||
operator suspend fun component2(): String = suspendCoroutineOrReturn { x ->
|
||||
x.resume("K")
|
||||
COROUTINE_SUSPENDED
|
||||
}
|
||||
}
|
||||
fun builder(c: suspend (A) -> Unit) {
|
||||
(c as (suspend A.() -> Unit)).startCoroutine(A("O"), EmptyContinuation)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder {
|
||||
(x, y) ->
|
||||
result = x + y
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
Reference in New Issue
Block a user