Fix codegen for closures returning 'Unit?'

Only do a checkcast when we need to coerce Object to Unit: the code was
hopefully type-checked so that it'll only be necessary when the value is either
Unit.VALUE or null
This commit is contained in:
Alexander Udalov
2013-12-11 17:56:10 +04:00
parent 9e5c68a8f9
commit 0576851102
4 changed files with 34 additions and 1 deletions
@@ -0,0 +1,12 @@
fun foo() {}
fun box(): String {
val x = when ("A") {
"B" -> foo()
else -> null
}
foo()
return if (x == null) "OK" else "Fail"
}