-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Relax] Allow composition of DFPattern replacements (#16732)
[Relax] Allow composition of DFPattern replacements The `rewrite_call` function accepts a `DFPattern`, and a function to rewrite expressions matching that pattern. Often, the rewriting function will perform additional validation that cannot be expressed within the `DFPattern` itself. If this additional validation fails, the rewriter function will return the matched expression unmodified. Prior to this commit, an `OrPattern` that matches on the first branch, but whose rewriter function does not apply a modification, would prevent the second branch from being checked. This commit updates the `ExprPatternRewriter` to check both branches of a `OrPattern`, if the rewriter function of the first branch does not modify the result.
- Loading branch information
1 parent
726a141
commit 86b5a13
Showing
2 changed files
with
102 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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