mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-11 00:21:29 +00:00
21 lines
406 B
Kotlin
Vendored
21 lines
406 B
Kotlin
Vendored
// IGNORE_BACKEND_FIR: JVM_IR
|
|
// TARGET_BACKEND: JVM
|
|
|
|
// WITH_RUNTIME
|
|
|
|
fun foo() {}
|
|
|
|
fun box(): String {
|
|
try {
|
|
foo() as Int?
|
|
}
|
|
catch (e: ClassCastException) {
|
|
return "OK"
|
|
}
|
|
catch (e: Throwable) {
|
|
return "Fail: ClassCastException should have been thrown, but was instead ${e.javaClass.getName()}: ${e.message}"
|
|
}
|
|
|
|
return "Fail: no exception was thrown"
|
|
}
|