If I define the following class:
class CopyingList<T>() satisfies List<T> {
variable List<T> impl = [];
shared actual T? getFromFirst(Integer index) {
return impl.getFromFirst(index);
}
shared void add(T element) {
impl = [element, *impl];
}
shared actual Integer? lastIndex => impl.lastIndex;
}
I get the errors:
May not inherit two declarations with the same name unless redefined in subclass: equals is defined by supertypes Identifiable and List.
Member hash is inherited ambiguously by CopyingList from Identifiable and another subtype of Object and so must be refined by CopyingList.
May not inherit two declarations with the same name unless redefined in subclass: hash is defined by supertypes Identifiable and List.
Member equals is inherited ambiguously by CopyingList from Identifiable and another subtype of Object and so must be refined by CopyingList.
I don't understand why this is ambiguous. My assumption would be that List's implementation would take president over Object's.