Add another cache control heuristic#2053
Merged
Merged
Conversation
woodruffw
commented
May 23, 2026
| /// For example, `a == b` is considered to match `b == a`, but `a > b` is not | ||
| /// considered to match `b > a`. This check is recusive, i.e. two nested binary expressions | ||
| /// will be fully checked for commutative equivalence. | ||
| pub fn commutative_matches(&self, other: &Expr<'src>) -> bool { |
Member
Author
There was a problem hiding this comment.
This is one of the key changes: we now have this helper for comparing BinExprs for commutative equivalence. We don't yet do anything more special here, like De Morgan's laws for equivalence between distinct forms.
2 tasks
aecb075 to
cdf3d14
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This ended up being very large due to refactoring (mostly moving
BinExprinto its own proper type and changing how origin tests are represented), but the core change is only a hundred lines or so.TL;DR: we can now detect (with acceptable generality) patterns like
github.event_name == 'push' && github.ref_type == 'tag'(and their negation). Needs more tests still.Fixes #2050.