For loops over arrays generated with multi-decl support

This commit is contained in:
Andrey Breslav
2012-08-23 20:44:12 +04:00
parent d5c44c3dd8
commit 707408b241
7 changed files with 180 additions and 35 deletions
@@ -0,0 +1,19 @@
class C(val i: Int) {
}
fun C.component1() = i + 1
fun C.component2() = i + 2
fun doTest(l : Array<C>): String {
var s = ""
for ((a, b) in l) {
s += "$a:$b;"
}
return s
}
fun box(): String {
val l = Array<C>(3, {x -> C(x)})
val s = doTest(l)
return if (s == "1:2;2:3;3:4;") "OK" else "fail: $s"
}