Files
kotlin-fork/compiler/testData/codegen/box/casts/kt53146.kt
T
Pavel Mikhailovskii 903a5d69a4 KT-53146 Don't coerce Nothing? returned from "catch" clauses
At first, I tried to modify the logic in PromisedValue.materializeAt
to get rid of all casts from Nothing? to other types, but that broke
a number of tests containing casts of java.lang.Void to other types,
so I decided to fix only this particular case with try...catch
(for some reason, here we get a null of type java.lang.Object).
2022-09-29 06:15:39 +00:00

18 lines
229 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// WITH_STDLIB
// FULL_JDK
// CHECK_BYTECODE_TEXT
class A
fun box(): String {
val a = try {
A()
} catch (e: NoClassDefFoundError) {
null
}
return "OK"
}
// 0 CHECKCAST