-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Extension methods and implicit class defs do not always interact well #14450
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
Comments
Moving the extension to the companion of Guessing that you get a pass with lexically scoped givens, then the second pass with implicitly scoped givens plus other implicit conversions. For the resolution of the second selection, it doesn't hop back to first pass resolution. Maybe that is because of some subtlety of how It doesn't work to just change the alias to an import. It doesn't work to make the implicit class extend AnyVal. It doesn't work to make it an opaque alias and create an anchor
This ticket reads like a subplot of Agatha Christie's Death on the Nile. |
I don't think it's worth to out much more effort into this, since implicit classes will be get deprecated in the future. I'll close but if someone volunteers to take this one, please re-open. |
@odersky I don't understand the policy on closing this. The bug exists. Whether it's important or not is relevant for a tag, IMO. The reason is simple. If someone looks for an existing open issue they look under OPEN issues. |
And additionally, when interacting with Scala 2 libraries you can get this issue even if implicit classes do not exist at all in your codebase. |
We currently have 766 open issues, and have to prioritize between issues that we think are worth fixing and issues where it is less likely. Issues that are currently not on the horizon for a possible fix get closed with stat:revisit. If someone wants to have a go at solving them they can be re-opened at any moment. But otherwise, if we leave an issue open, we should also assign someone to spend potentially a lot of time solving it. And I don't see anyone we could assign this to right now. |
Keeping the issue open with a flag costs us nothing. Closing the issue while it is unresolved can potentially cost another person valuable time in minimizing and debugging the same issue yet again. |
@soronpo That's a good point. We should discuss what to do with stat:revisit issues, and whether another category is more appropriate. |
Extension methods and implicit class defs do not always interact well and we can get unrelated ambiguity.
I minimized this to the example below. There are various crucial elements for this error recipe:
BlaB.Foo
to a class and this example will compile).Compiler version
v3.1.2-RC1
Minimized code
https://scastie.scala-lang.org/IwKSNqrxSZSnd6LVmBXJHg
Output
Expectation
No error.
The text was updated successfully, but these errors were encountered: