Files
kotlin-fork/js/js.translator/testData/box/jsName/overriddenMethod.kt
T
2018-04-19 13:17:28 +03:00

22 lines
426 B
Kotlin
Vendored

// IGNORE_BACKEND: JS_IR
// EXPECTED_REACHABLE_NODES: 1127
package foo
open class A {
@JsName("js_f") open fun f(x: Int) = "A.f($x)"
}
class B : A() {
override fun f(x: Int) = "B.f($x)"
}
fun test() = js("""
var module = JS_TESTS.foo;
return new (module.A)().js_f(23) + ";" + new (module.B)().js_f(42);
""")
fun box(): String {
val result = test()
assertEquals("A.f(23);B.f(42)", result);
return "OK"
}