Files
kotlin-fork/js/js.translator/testData/box/native/castToNativeInterface.kt
T
Zalim Bashorov b02279de14 [Wasm] Run wasm test using all available VMs: V8 & SpiderMonkey for now
Also, add a new directive, `WASM_FAILS_IN`, to specify VMs where a test is expected to fail for now.

#KT-56166 Fixed
2023-01-27 17:57:50 +01:00

22 lines
420 B
Kotlin
Vendored

// WASM_FAILS_IN: SM
// 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;
}