-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spurious error about incompatible type signatures when override Iterable.filter #1163
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1163?orig=1
|
@DRMacIver said: I feel quite strongly that this should work, but if it's by design I suppose this will require a SIP to fix. |
Aaron Harnly (aaronharnly) said: trait Super[A] { def foo: Super[A] = new Super[A] {} }
trait Sub[A] extends Super[A] { override def foo: Sub[A] } |
Aaron Harnly (aaronharnly) said: trait Super { def foo: Super = new Super {} }
trait Sub extends Super { override def foo: Sub } |
@DRMacIver said: |
@odersky said: |
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
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.
The text was updated successfully, but these errors were encountered: