JS: support case when class inherits method from superclass and both implements same method (but with optional parameter) from superinterface.

This commit is contained in:
Alexey Andreev
2016-12-23 19:34:16 +03:00
parent d2050ace72
commit e6b78f68cd
7 changed files with 156 additions and 7 deletions
@@ -0,0 +1,42 @@
// TARGET_BACKEND: JS
// This test causes JVM to generate incorrect bytecode
// Could not use IGNORE_BACKEND directive, since it makes LightAnalysisModeCodegenTestsGenerated fail on this test
interface I<T> {
val prop: T
fun f(x: String = "1"): String
fun g(x: String = "2"): String
fun h(x: T = prop): T
}
open class A<T> {
open fun f(x: String) = x
open fun g(x: T) = x
open fun h(x: String) = x
}
class B : A<String>(), I<String> {
override val prop
get() = "3"
}
fun box(): String {
val i: I<String> = B()
var result = i.f() + i.g() + i.h()
if (result != "123") return "fail1: $result"
val b = B()
result = b.f() + b.g() + b.h()
if (result != "123") return "fail2: $result"
val a: A<String> = B()
result = a.f("q") + a.g("w") + a.h("e")
if (result != "qwe") return "fail3: $result"
return "OK"
}