Skip to content

Inferred (result) type of overridden member should not be narrower than in super interface #7873

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

Closed
scabug opened this issue Sep 24, 2013 · 3 comments

Comments

@scabug
Copy link

scabug commented Sep 24, 2013

Discussion at https://groups.google.com/d/msg/scala-internals/6vemF4hOA9A/tsouPjHDO_AJ

scala> trait Foo { def foo: Option[String] }
defined trait Foo

scala> trait Bar extends Foo { def foo = Some("bar") }
defined trait Bar

scala> trait Baz extends Bar { override def foo: Option[String] = Some("baz") }
<console>:9: error: overriding method foo in trait Bar of type => Some[String];
 method foo has incompatible type
       trait Baz extends Bar { override def foo: Option[String] = Some("baz") }
                                            ^
@scabug
Copy link
Author

scabug commented Sep 24, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7873?orig=1
Reporter: @som-snytt
Affected Versions: 2.11.0-M5

@scabug
Copy link
Author

scabug commented Sep 24, 2013

@paulp said:
FYI this is #7212.

@scabug
Copy link
Author

scabug commented Feb 19, 2014

@adriaanm said:
See #7212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant