Files
kotlin-fork/js/js.translator/testData/box/native/castToNativeInterface.kt
T
2019-02-25 15:09:25 +03:00

21 lines
399 B
Kotlin
Vendored

// EXPECTED_REACHABLE_NODES: 1282
// FILE: castToNativeInterface.kt
external interface I {
fun foo(): String
}
external class A(x: String) : I {
override fun foo(): String = definedExternally
}
fun createObject(): Any = A("OK")
fun box() = (createObject() as I).foo()
// FILE: castToNativeInterface.js
function A(x) {
this.x = x;
}
A.prototype.foo = function() {
return this.x;
}