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
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
fun a(): IntArray? = null
|
||||
|
||||
fun b() = throw Exception()
|
||||
|
||||
fun foo(): IntArray = a() ?: b()
|
||||
|
||||
|
||||
fun box(): String {
|
||||
try {
|
||||
foo()
|
||||
} catch (e: Exception) {
|
||||
return "OK"
|
||||
}
|
||||
|
||||
return "Fail"
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user