Skip to content

Commit

Permalink
Fix constant condition switch rewrite rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Fischman committed Jan 26, 2024
1 parent 3f7ceb8 commit 6d49f95
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tree_unique_args/src/switch_rewrites.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ pub(crate) fn rules() -> String {
; Constant condition elimination
(rewrite (Switch (Boolean id true) (Cons A (Cons B (Nil))))
A
B
:when ((ExprIsValid (Switch (Boolean id true) (Cons A (Cons B (Nil))))))
:ruleset switch-rewrites)
(rewrite (Switch (Boolean id false) (Cons A (Cons B (Nil))))
B
A
:when ((ExprIsValid (Switch (Boolean id false) (Cons A (Cons B (Nil))))))
:ruleset switch-rewrites)
Expand Down Expand Up @@ -124,8 +124,8 @@ fn test_constant_condition() -> Result<(), egglog::Error> {
(ExprIsValid switch_f)
";
let check = "
(check (= switch_t a))
(check (= switch_f b))
(check (= switch_t b))
(check (= switch_f a))
";
crate::run_test(build, check)
}
Expand Down Expand Up @@ -165,7 +165,7 @@ fn switch_interval() -> Result<(), egglog::Error> {
(ExprIsValid switch)
";
let check = "
(check (= switch four))
(check (= switch five))
";
crate::run_test(build, check)
}
Expand Down

0 comments on commit 6d49f95

Please sign in to comment.