30 lines
547 B
Kotlin
Vendored
30 lines
547 B
Kotlin
Vendored
// EXPECTED_REACHABLE_NODES: 1283
|
|
// FILE: castToNativeClassChecked.kt
|
|
external abstract class S() {
|
|
abstract fun foo(): String
|
|
}
|
|
|
|
external class A(x: String) {
|
|
fun foo(): String = definedExternally
|
|
}
|
|
|
|
fun createObject(): Any = A("fail: CCE not thrown")
|
|
|
|
fun box(): String {
|
|
try {
|
|
return (createObject() as S).foo()
|
|
}
|
|
catch (e: ClassCastException) {
|
|
return "OK"
|
|
}
|
|
}
|
|
|
|
// FILE: castToNativeClassChecked.js
|
|
function S() {
|
|
}
|
|
function A(x) {
|
|
this.x = x;
|
|
}
|
|
A.prototype.foo = function() {
|
|
return this.x;
|
|
} |