Files
kotlin/compiler/testData/codegen/boxWithStdlib/casts/unitAsInt.kt
2016-01-22 05:54:38 +03:00

16 lines
335 B
Kotlin
Vendored

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