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
Prefer type of overridden member when inferring (under -Xsource:3
)
#9891
Conversation
CI likes it now. Is it ready for review? I'm in favor of the change, given that it's behind |
I don't remember what I wasn't sure about. If it breaks something, we might finally get a sense of who is actually using |
Mind supplying a nice user-facing PR description? |
Final review by @lrytz, please — I just want to be sure you're comfortable with the change. If merged, this increases the pressure on us to produce a really nice doc page that documents everything that |
-Xsource:3
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM
yup, that is now happening :-) e.g. scala/bug#12645 , and also: https://twitter.com/not_xuwei_k/status/1572987057621929984
|
@xuwei-k perhaps you'll need to resort to version-specific sources. either duplicate the entire file, or if that's too much duplication, make the return type a type alias and define the type alias differently in version-specific sources |
Minimally, it ought to warn under The other footnote is that they say don't rely on inferred types for API. |
I'm curious when/where this design decision was made on the Scala 3 side — does anyone know of tickets, discussions, etc? |
there is some talk now on scala/bug#12671 that this may need to be refined further to match the Scala 3 behavior more closely |
Sorry to necromance this. I just tried to upgrade our 2.13.6 project straight to 2.13.10 (we're using |
@hmemcpy Thanks for the upgrade effort. It's not necessary to announce on an old PR. Since twitter is moribund, there is discord or the contributors forum to open a topic about this upgrade challenge. A fresh ticket for bugs is welcome, of course. |
Under
-Xsource:3
, adopt the new rule that the type of an override is inferred from the overridden member, and not from the right-hand side of the overriding element, which may narrow the type unexpectedly. The type can be narrowed by supplying an explicit type.Fixes scala/bug#7212