-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Delay hard argument comparisons #20007
Conversation
When comparing arguments of two applied types, perform hard comparisons after easy ones. A comparison if hard if it entails a subtype test A <: B where A is an AndType or B is an OrType. Such comparisons need to perform an either, which might lose solutions. Fixes scala#19999
We could possibly generalize this, delaying hard comparisons in more conjunctive tests, not just type in arguments. But it is hard in general to identify a conjunctive subsequence of tests when doing a subtype traversal. |
Interesting! I've had a case that required this defer too. |
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.
Otherwise LGTM.
* So we defer such tests to run last, on the chance that some other argument | ||
* comparison will instantiate or constrain type variables first. | ||
*/ | ||
def isHard(arg1: Type, arg2: Type): Boolean = |
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.
Using the word hard
here might lead to confuse with hard unions since OrTypes are also involved. Maybe we could call this isIncomplete
instead?
Co-authored-by: Guillaume Martres <[email protected]>
Backports #20007 to the LTS branch. PR submitted by the release tooling. [skip ci]
When comparing arguments of two applied types, perform hard comparisons after easy ones. A comparison is hard if it entails a subtype test A <: B where A is an AndType or B is an OrType. Such comparisons need to perform an either, which might lose solutions.
Fixes #19999