KT-11892: explicitly qualified 'super' with a supertype that is overridden

by a different explicitly declared supertype is an error (as in Java)
(see http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.12.3)
This commit is contained in:
Dmitry Petrov
2016-07-01 15:51:54 +03:00
parent dbf38823b9
commit 07cb3e09b9
9 changed files with 158 additions and 5 deletions
@@ -5,12 +5,12 @@ interface A {
fun foo(t: Int): Int = t + 1
}
interface B : A {
override fun bar(): Int = 3
interface B {
fun foo(t: Int): Int = t
fun bar(): Int = 3
}
class C : B, A {
override fun bar(): Int {
return super<B>.bar() + super<A>.bar()
}
@@ -23,7 +23,7 @@ class C : B, A {
fun box(): String {
val c = C()
if (c.foo(3) != 5) return "Trait super call fail. c.foo(3) is ${c.foo(3)}"
if (c.bar() != 5) return "Trait super call fail. c.bar() is ${c.bar()}"
if (c.foo(3) != 5) return "Interface super call fail. c.foo(3) is ${c.foo(3)}"
if (c.bar() != 5) return "Interface super call fail. c.bar() is ${c.bar()}"
return "OK"
}