kt343 fixed (Exceptions while function literal ends with no unit and 'Unit' is expected)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
import java.util.ArrayList
|
||||
|
||||
fun box(): String {
|
||||
val list = ArrayList<Int>()
|
||||
val foo : fun() : Unit = {
|
||||
list.add(2) //first exception
|
||||
}
|
||||
foo()
|
||||
|
||||
val bar = {
|
||||
val x = 1 //second exception
|
||||
}
|
||||
bar()
|
||||
|
||||
return if (list.get(0) == 2) "OK" else "fail"
|
||||
}
|
||||
Reference in New Issue
Block a user