Files
kotlin/compiler/testData/codegen/box/casts/unitAsInt.kt
2016-11-09 21:41:12 +03:00

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"
}