JS: use prototype when checking is against interface

See KT-20527
This commit is contained in:
Alexey Andreev
2017-10-11 12:20:11 +03:00
parent 279126ad7e
commit 06b1ba7c47
3 changed files with 45 additions and 17 deletions
@@ -0,0 +1,25 @@
// EXPECTED_REACHABLE_NODES: 1112
interface A {
fun foo(): String
}
class B : A {
override fun foo(): String = "OK"
}
fun box(): String {
val b = B::class.js
val c = js("""
function C() {
b.call(this);
};
C.prototype = Object.create(b.prototype);
C.prototype.constructor = C;
new C();
""")
if (c !is B) return "fail: c !is B"
if (c !is A) return "fail: c !is A"
return "OK"
}