JS: allow to inherit external classes with overloaded functions in case we don't override them (see KT-13910).

This commit is contained in:
Alexey Andreev
2016-11-28 18:00:32 +03:00
parent ecb498717a
commit fff1af4ff6
7 changed files with 88 additions and 2 deletions
@@ -0,0 +1,36 @@
external open class A {
open fun f(x: Int) = "number"
open fun f(x: String) = "string"
}
class B : A() {
fun g(x: Int) = "[${f(x)}]"
fun g(x: String) = "[${f(x)}]"
}
interface I {
fun f(x: Int): String
}
class C : A(), I
external interface J {
fun f(x: Int): String
}
class D : A(), J
fun box(): String {
var result = B().g(23) + B().g("foo")
if (result != "[number][string]") return "fail1: $result"
result = C().f(42)
if (result != "number") return "fail2: $result"
result = D().f("bar")
if (result != "string") return "fail3: $result"
return "OK"
}