Never resolve free variables as types during overload ordering #11973
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the following snippet, the
Bar
inx : Bar
is resolved as a type even though it is a free variable, and sinceBar < Foo
, theBar
overload is ordered first:Bar forall Bar
accepts types that are not subtypes ofFoo
, so the overload order should be untouched here.Similarly, in the following snippet, the two defs are redefinitions because the restrictions have the same name, even though only one of them is a free variable and the two are definitely distinguishable:
This PR makes it so that those free variables are never resolved as types; for the purposes of overload ordering, they are considered undefined types, and the non-free
Path
s come first. Most free variables have only one letter and most type names don't, so the impact should be very small in practice.The first commit here is also necessary when we eventually deal with bounded free variables.
Nothing changes if both
Path
s are free variables (they are already somewhat broken before and nobody really knows how to fix them yet, for example #10042).