mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 08:31:29 +00:00
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
17 lines
211 B
Kotlin
17 lines
211 B
Kotlin
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"
|
|
}
|