Support parameter destructuring in suspend lambdas

#KT-16092 Fixed
This commit is contained in:
Denis Zharkov
2017-02-01 19:00:01 +03:00
parent 0878049f15
commit 529b526763
9 changed files with 133 additions and 36 deletions
@@ -0,0 +1,23 @@
// WITH_RUNTIME
// WITH_COROUTINES
// IGNORE_BACKEND: JS
import kotlin.coroutines.experimental.*
import kotlin.coroutines.experimental.intrinsics.*
data class A(val o: String) {
operator fun component2(): String = "K"
}
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
}