-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Incorrect type selection due to mixin #16133
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
@odersky is this an inference / implicit search bug, or is there a good reason why this doesn't use the expected I assume there's good reason why |
Yes, givens with fewer using clauses take precedence. So this is as expected. |
But what about the expected intersection type, should that drive to the use of |
Expected types don't propagate into parents of anonymous classes. |
Ah, got it, thank you. |
Unfortunately, while simplifying the code, I did not notice the transition to a (in-retrospect) more understandable error message. In my original code, I wonder: if only the language developers know whether there is a bug or not, maybe that indicates an issue with the language, the compiler message, or the language documentation. @dwijnand Is the behavior described here also intentional? I wouldn't mind showing my code to someone on a call. But given the growing backlog of bugs, it probably won't be worth any developer's time for a while. |
That seems to be fixed in main. It's possible by #15986. |
Compiler version
3.2.0
Minimized code
Compiler output
Expectation
No compiler error.
The code does compile when the last line is changed to
or when there is no mixin.
For more complex code, I've seen errors due to this that are impossible to decipher, as they wrongly assert that other
using
parameters are missing. Unfortunately, they are hard to reproduce with a small piece of code.The text was updated successfully, but these errors were encountered: