Files
kotlin/compiler/testData/codegen/box/functions/coerceVoidToObject.kt
Alexander Udalov ace7bd9bc8 Fix StackValue.coerce void to Object
We can only put Unit.VALUE on stack if we're requested an instance of Object or
Unit. In other cases (arbitrary objects / arrays) we put null instead
2013-04-22 17:59:32 +04:00

17 lines
207 B
Kotlin

fun a(): String? = null
fun b() = throw Exception()
fun foo(): String = a() ?: b()
fun box(): String {
try {
foo()
} catch (e: Exception) {
return "OK"
}
return "Fail"
}