Add support for desctructuring of lambda parameters in JVM backend

#KT-5828 In Progress
This commit is contained in:
Denis Zharkov
2016-09-16 16:33:19 +03:00
parent e975d32196
commit e75efc88ff
17 changed files with 332 additions and 15 deletions
@@ -0,0 +1,21 @@
class A<T>(val x: String, val y: String, val z: T)
fun <T> foo(a: A<T>, block: (A<T>) -> String): String = block(a)
operator fun A<*>.component1() = x
object B {
operator fun A<*>.component2() = y
}
fun B.bar(): String {
operator fun <R> A<R>.component3() = z
val x = foo(A("O", "K", 123)) { (x, y, z) -> x + y + z.toString() }
if (x != "OK123") return "fail 1: $x"
return "OK"
}
fun box() = B.bar()