From 6d49f951f34967a5dc0de8f600362c0751c6dc39 Mon Sep 17 00:00:00 2001 From: Alex Fischman Date: Fri, 26 Jan 2024 13:31:25 -0800 Subject: [PATCH] Fix constant condition switch rewrite rules --- tree_unique_args/src/switch_rewrites.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tree_unique_args/src/switch_rewrites.rs b/tree_unique_args/src/switch_rewrites.rs index 3f58c7dcc..f70d64aaf 100644 --- a/tree_unique_args/src/switch_rewrites.rs +++ b/tree_unique_args/src/switch_rewrites.rs @@ -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) @@ -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) } @@ -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) }