More fixes for possible coercion to unit of type of last statement in block

This commit is contained in:
svtk
2011-10-10 20:45:42 +04:00
parent fc6879e7fd
commit 868e024c93
4 changed files with 107 additions and 30 deletions
+9 -1
View File
@@ -1,5 +1,9 @@
import java.util.ArrayList
fun launch(f : fun() : Unit) {
f()
}
fun box(): String {
val list = ArrayList<Int>()
val foo : fun() : Unit = {
@@ -7,10 +11,14 @@ fun box(): String {
}
foo()
launch({
list.add(3)
})
val bar = {
val x = 1 //second exception
}
bar()
return if (list.get(0) == 2) "OK" else "fail"
return if (list.size() == 2 && list.get(0) == 2 && list.get(1) == 3) "OK" else "fail"
}