fix for KT-237

This commit is contained in:
Alex Tkachman
2011-09-04 14:20:40 +02:00
parent e862e8471a
commit 22e2caf7f8
8 changed files with 69 additions and 9 deletions
@@ -0,0 +1,20 @@
fun foreach(array: Array<Int>, action: fun(Int): Unit) {
for (el in array) {
action(el) //exception through compilation (see below)
}
}
/*
fun almostFilter(array: Array<Int>, action: fun(Int): Int) {
for (el in array) {
action(el)
}
}
*/
fun box() : String {
val a = Array<Int> (3)
a[0] = 0
a[1] = 1
a[2] = 2
foreach(a, { (el : Int) : Unit => System.out?.println(el) })
return "OK"
}