More fixes for possible coercion to unit of type of last statement in block
This commit is contained in:
@@ -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"
|
||||
}
|
||||
Reference in New Issue
Block a user