[6.0][ConstraintSystem] Order VarDecl
s before other kinds of decls in disjunctions.
#72784
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.
Explanation: The implementation of
count(where:)
caused a source compatibility failure in penny-bot. The following code example was reduced from the project:To fix this, order
VarDecl
s before other kinds of declarations in a disjunction because they are effectively favored over functions when the two are in the same overload set. This disjunction order allowsSK_UnappliedFunction
to prune later overload choices that are functions when a solution has already been found with a property.Scope: Only impacts overload sets that contain both
VarDecl
s and other kinds of declarations.Risk: Changing type variable binding order always carries some amount of risk for code that happened to find a solution faster with the old binding order, but it's rare to have functions and variables in the same overload set, so I would call this a relatively low risk constraint system change.
Testing: Added a new type checker performance test. Source compatibility testing for penny-bot also succeeded on
main
.Reviewer: @xedin
Main branch PR: [ConstraintSystem] Order
VarDecl
s before other kinds of decls in disjunctions. #72755