Signature mismatch: cannot simultaneously inherit Xs

When class C inherits a method m from two distinct super-classes, the signatures of the inherited methods must be compatible.

Example error and correction

class A extends Element {
    A foo() { result=this }
}

class B extends Element {
    B foo() { result=this }
}

class C extends A,B {
    A foo() { result=this }
}

To fix it, the return type of B.foo() should be A.

Comments
Only registered users can write comments!
 
< Prev   Next >