Skip to content

Spurious error about incompatible type signatures when override Iterable.filter #1163

@scabug

Description

@scabug

I've attached a code sample which fails to compile. In it I override filter on Iterable with an abstract definition claiming to return a subtype of Iterable. This fails to compile with the error message

error overriding method filter;
 method filter in trait Iterable of type (((T, T)) => Boolean)Iterable[(T, T)] has incompatible type ((A) => Boolean)Iterable[A]
trait Foo[T] extends Iterable[(T, T)]{

However, the second two traits defined in this file exhibit the same overriding pattern and work fine. Additionally, if I add an implementation (say = error("foo")) to the definition of filter in Foo, the type error goes away.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions