Skip to content

Commit

Permalink
Disallow empty all
Browse files Browse the repository at this point in the history
  • Loading branch information
rtjoa committed Jan 26, 2024
1 parent 4f26ab3 commit c9c1b0f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tree_unique_args/src/disallow_empty_all.egg
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
(rule ((ExprIsValid (All order (Nil))))
((panic "UnitExpr should be used instead of an empty All"))
:ruleset error-checking)
7 changes: 7 additions & 0 deletions tree_unique_args/src/disallow_empty_all.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#[test]
#[should_panic]
fn empty_all_should_panic() {
let build = "(ExprIsValid (All (Parallel) (Nil)))";
let check = "";
let _ = crate::run_test(build, check);
}
2 changes: 2 additions & 0 deletions tree_unique_args/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ pub mod ast;
pub(crate) mod body_contains;
pub(crate) mod conditional_invariant_code_motion;
pub(crate) mod deep_copy;
pub(crate) mod disallow_empty_all;
pub(crate) mod function_inlining;
pub(crate) mod id_analysis;
pub mod interpreter;
Expand Down Expand Up @@ -142,6 +143,7 @@ pub fn run_test(build: &str, check: &str) -> Result {
include_str!("sugar.egg"),
&util::rules().join("\n"),
&id_analysis::id_analysis_rules().join("\n"),
include_str!("disallow_empty_all.egg"),
// optimizations
include_str!("simple.egg"),
include_str!("function_inlining.egg"),
Expand Down

0 comments on commit c9c1b0f

Please sign in to comment.