mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-10 15:53:46 +00:00
21 lines
448 B
Kotlin
Vendored
21 lines
448 B
Kotlin
Vendored
// TODO: muted automatically, investigate should it be ran for JS or not
|
|
// IGNORE_BACKEND: JS
|
|
|
|
// 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"
|
|
}
|