diff --git a/src/term/mod.rs b/src/term/mod.rs index 3a0637320d..6a5e5d5521 100644 --- a/src/term/mod.rs +++ b/src/term/mod.rs @@ -41,6 +41,7 @@ pub struct DefNames { #[derive(Debug, Clone)] pub struct Definition { pub def_id: DefId, + pub generated: bool, pub rules: Vec, } @@ -220,9 +221,9 @@ impl Book { Default::default() } - pub fn insert_def(&mut self, name: Name, rules: Vec) -> DefId { + pub fn insert_def(&mut self, name: Name, is_generated: bool, rules: Vec) -> DefId { let def_id = self.def_names.insert(name); - let def = Definition { def_id, rules }; + let def = Definition { def_id, generated: is_generated, rules }; self.defs.insert(def_id, def); def_id } diff --git a/src/term/parser/parser.rs b/src/term/parser/parser.rs index 35b146d18d..e0dd108763 100644 --- a/src/term/parser/parser.rs +++ b/src/term/parser/parser.rs @@ -357,7 +357,7 @@ where if let Some(def_id) = book.def_names.def_id(&nam) { book.defs.get_mut(&def_id).unwrap().rules.push(rule); } else { - book.insert_def(nam, vec![rule]); + book.insert_def(nam, false, vec![rule]); } } TopLevel::Adt((nam, adt)) => { diff --git a/src/term/transform/definition_pruning.rs b/src/term/transform/definition_pruning.rs index b2a5365714..f0b7e26a65 100644 --- a/src/term/transform/definition_pruning.rs +++ b/src/term/transform/definition_pruning.rs @@ -12,18 +12,15 @@ impl Book { // to mark as used all constructors in case of the user // manually encode a constructor with tagged lambdas for ctr in self.ctrs.keys() { - let Definition { def_id, rules } = self.defs.get(&self.def_names.name_to_id[ctr]).unwrap(); - used.insert(*def_id); - for rule in rules { - rule.body.find_used_definitions(&mut used, &self.defs); - } + let def = self.defs.get(&self.def_names.name_to_id[ctr]).unwrap(); + used.insert(def.def_id); + def.assert_no_pattern_matching_rules(); + def.rules[0].body.find_used_definitions(&mut used, &self.defs); } - let Definition { def_id, rules } = self.defs.get(&main).unwrap(); - used.insert(*def_id); - for rule in rules { - rule.body.find_used_definitions(&mut used, &self.defs); - } + let def = self.defs.get(&main).unwrap(); + used.insert(def.def_id); + def.rules[0].body.find_used_definitions(&mut used, &self.defs); let ids = HashSet::from_iter(self.def_names.def_ids().copied()); let unused = ids.difference(&used); diff --git a/src/term/transform/detach_supercombinators.rs b/src/term/transform/detach_supercombinators.rs index aec322e9ea..9f6ad3493a 100644 --- a/src/term/transform/detach_supercombinators.rs +++ b/src/term/transform/detach_supercombinators.rs @@ -9,9 +9,8 @@ impl Book { let mut combinators = Combinators::new(); for def in self.defs.values_mut() { - for rule in def.rules.iter_mut() { - rule.body.detach_combinators(def.def_id, &mut self.def_names, &mut combinators); - } + def.assert_no_pattern_matching_rules(); + def.rules[0].body.detach_combinators(def.def_id, &mut self.def_names, &mut combinators); } // Definitions are not inserted to the book as they are defined to appease the borrow checker. @@ -68,7 +67,7 @@ impl<'d> TermInfo<'d> { let extracted_term = std::mem::replace(term, comb_var); let rules = vec![Rule { body: extracted_term, pats: Vec::new() }]; - let rule = Definition { def_id: comb_id, rules }; + let rule = Definition { def_id: comb_id, rules, generated: false }; self.combinators.insert(comb_id, rule); } } diff --git a/src/term/transform/encode_adts.rs b/src/term/transform/encode_adts.rs index 196da2650f..82a54dcb80 100644 --- a/src/term/transform/encode_adts.rs +++ b/src/term/transform/encode_adts.rs @@ -14,7 +14,7 @@ impl Book { } } for (name, rules) in defs { - self.insert_def(name, rules); + self.insert_def(name, true, rules); } } } diff --git a/src/term/transform/encode_pattern_matching.rs b/src/term/transform/encode_pattern_matching.rs index 8da3ea1231..4320a51f33 100644 --- a/src/term/transform/encode_pattern_matching.rs +++ b/src/term/transform/encode_pattern_matching.rs @@ -12,7 +12,7 @@ impl Book { if is_matching_def { make_pattern_matching_def(self, def_id, def_type); } else { - // For functions with only one rule that doesnt pattern match, + // For functions with only one rule that doesn't pattern match, // we just move the variables from arg to body. make_non_pattern_matching_def(self, def_id); } @@ -50,7 +50,8 @@ fn make_pattern_matching_def(book: &mut Book, def_id: DefId, def_type: &[Type]) } for (rule_idx, body) in rule_bodies.into_iter().enumerate() { let rule_name = make_rule_name(&def_name, rule_idx); - book.insert_def(rule_name, vec![Rule { pats: vec![], body }]); + let is_generated = false; + book.insert_def(rule_name, is_generated, vec![Rule { pats: vec![], body }]); } // Generate scott-encoded pattern matching @@ -454,7 +455,7 @@ fn add_case_to_book(book: &mut Book, nam: Name, body: Term) { if let Some(def_id) = book.def_names.def_id(&nam) { book.defs.get_mut(&def_id).unwrap().rules = vec![Rule { pats: vec![], body }]; } else { - book.insert_def(nam, vec![Rule { pats: vec![], body }]); + book.insert_def(nam, true, vec![Rule { pats: vec![], body }]); } } diff --git a/src/term/transform/eta_reduction.rs b/src/term/transform/eta_reduction.rs index 051721b77e..8bb4e67371 100644 --- a/src/term/transform/eta_reduction.rs +++ b/src/term/transform/eta_reduction.rs @@ -1,12 +1,14 @@ use crate::term::*; impl Book { - /// Applies eta-reduction to all definitions, converting occurences of `@x (f x)` into just `f`. + /// Applies eta-reduction to all generated definitions, converting occurrences of `@x (f x)` into just `f`. /// Assumes that variables are linear (used exactly once). pub fn eta_reduction(&mut self) { for def in self.defs.values_mut() { - for rule in def.rules.iter_mut() { - rule.body.eta_reduction(); + def.assert_no_pattern_matching_rules(); + if def.generated { + let rule = &mut def.rules[0].body; + rule.eta_reduction(); } } } diff --git a/src/term/transform/extract_matches.rs b/src/term/transform/extract_matches.rs index e91398764a..fcbc418c9b 100644 --- a/src/term/transform/extract_matches.rs +++ b/src/term/transform/extract_matches.rs @@ -187,7 +187,7 @@ fn match_to_def( let new_name = make_def_name(def_name, &Name::new("match"), match_count); let def_id = book.def_names.insert(new_name); - let def = Definition { def_id, rules }; + let def = Definition { def_id, generated: true, rules }; book.new_defs.insert(def_id, def); let scrutinee_app = Term::App { diff --git a/src/term/transform/flatten.rs b/src/term/transform/flatten.rs index 114129ed9d..d1deda1640 100644 --- a/src/term/transform/flatten.rs +++ b/src/term/transform/flatten.rs @@ -24,7 +24,7 @@ fn flatten_def(def: &Definition, def_names: &mut DefNames) -> Vec { .into_iter() .map(|(name, rules)| { let def_id = def_names.def_id(&name).unwrap(); - Definition { def_id, rules } + Definition { def_id , generated: def.generated, rules } }) .collect() } diff --git a/src/term/transform/linearize.rs b/src/term/transform/linearize.rs index 7916b71b42..3561168ae7 100644 --- a/src/term/transform/linearize.rs +++ b/src/term/transform/linearize.rs @@ -17,9 +17,8 @@ use std::collections::{hash_map::Entry, HashMap}; impl Book { pub fn linearize_vars(&mut self) { for def in self.defs.values_mut() { - for rule in def.rules.iter_mut() { - rule.body.linearize_vars(); - } + def.assert_no_pattern_matching_rules(); + def.rules[0].body.linearize_vars(); } } } diff --git a/src/term/transform/unique_names.rs b/src/term/transform/unique_names.rs index 28d6dacd3d..3a07a85b94 100644 --- a/src/term/transform/unique_names.rs +++ b/src/term/transform/unique_names.rs @@ -9,9 +9,8 @@ impl Book { /// Precondition: Definition references have been resolved, no unbound variables. pub fn make_var_names_unique(&mut self) { for def in self.defs.values_mut() { - for rule in def.rules.iter_mut() { - rule.body.make_var_names_unique() - } + def.assert_no_pattern_matching_rules(); + def.rules[0].body.make_var_names_unique() } } } diff --git a/tests/golden_tests/compile_file/long_name.hvm b/tests/golden_tests/compile_file/long_name.hvm index ef627f5b79..85501523b5 100644 --- a/tests/golden_tests/compile_file/long_name.hvm +++ b/tests/golden_tests/compile_file/long_name.hvm @@ -1,2 +1,2 @@ (WowThis_is_a_very_long_name_no_way_ItFits) = λa a -main = λa (WowThis_is_a_very_long_name_no_way_ItFits *) \ No newline at end of file +main = λa (WowThis_is_a_very_long_name_no_way_ItFits *) diff --git a/tests/golden_tests/compile_file/nested_eta.hvm b/tests/golden_tests/compile_file/nested_eta.hvm deleted file mode 100644 index dc51f9f8ca..0000000000 --- a/tests/golden_tests/compile_file/nested_eta.hvm +++ /dev/null @@ -1,3 +0,0 @@ -X = λa a - -main = λb0 λb1 (X b0 b1) diff --git a/tests/golden_tests/compile_file/eta.hvm b/tests/golden_tests/compile_file/unapplied_eta.hvm similarity index 60% rename from tests/golden_tests/compile_file/eta.hvm rename to tests/golden_tests/compile_file/unapplied_eta.hvm index 698a2b3b63..dc663882b9 100644 --- a/tests/golden_tests/compile_file/eta.hvm +++ b/tests/golden_tests/compile_file/unapplied_eta.hvm @@ -1,2 +1,2 @@ -Id = λb b +Id = λa a main = λa (Id a) \ No newline at end of file diff --git a/tests/snapshots/compile_file__adt_option_and.hvm.snap b/tests/snapshots/compile_file__adt_option_and.hvm.snap index 1b640ef67c..2248351976 100644 --- a/tests/snapshots/compile_file__adt_option_and.hvm.snap +++ b/tests/snapshots/compile_file__adt_option_and.hvm.snap @@ -2,15 +2,15 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/adt_option_and.hvm --- -@6 = ({2 @D {2 @C a}} a) @8 = (* @None) @9 = {4 a (b {2 {4 [b a] c} {2 * c}})} @C = (* @None) @D = {4 a ({2 @9 {2 @8 (a b)}} b)} @None = {2 * {2 a a}} +@Option.and = ({2 @D {2 @C (a b)}} (a b)) @Some = (a {2 {4 a b} {2 * b}}) @main = a -& @6 ~ (b (c a)) +& @Option.and ~ (b (c a)) & @Some ~ (#3 c) & @Some ~ (#1 b) diff --git a/tests/snapshots/compile_file__and.hvm.snap b/tests/snapshots/compile_file__and.hvm.snap index 5709cf8e6e..22c15ede2d 100644 --- a/tests/snapshots/compile_file__and.hvm.snap +++ b/tests/snapshots/compile_file__and.hvm.snap @@ -4,9 +4,9 @@ input_file: tests/golden_tests/compile_file/and.hvm --- @6 = (a a) @8 = (* @false) -@9 = (a ({2 @6 {2 @8 (a b)}} b)) +@and = (a ({2 @6 {2 @8 (a b)}} b)) @false = {2 * {2 a a}} @main = a -& @9 ~ (@true (@false a)) +& @and ~ (@true (@false a)) @true = {2 a {2 * a}} diff --git a/tests/snapshots/compile_file__eta.hvm.snap b/tests/snapshots/compile_file__eta.hvm.snap deleted file mode 100644 index b36b5af899..0000000000 --- a/tests/snapshots/compile_file__eta.hvm.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: tests/golden_tests.rs -input_file: tests/golden_tests/compile_file/eta.hvm ---- -@main = (a a) - diff --git a/tests/snapshots/compile_file__ex2.hvm.snap b/tests/snapshots/compile_file__ex2.hvm.snap index b8f21bc441..a7a905a027 100644 --- a/tests/snapshots/compile_file__ex2.hvm.snap +++ b/tests/snapshots/compile_file__ex2.hvm.snap @@ -6,8 +6,8 @@ input_file: tests/golden_tests/compile_file/ex2.hvm @F = (* (a a)) @I = (a (* ((a b) (* b)))) @c2 = ({3 (a b) (c a)} (c b)) -@decO = ((@decO (@low (@E a))) (* ((a b) (* b)))) -@low = ((@lowO (@lowI (@E a))) a) +@decI = ((@lowO (@lowI (@E a))) a) +@decO = ((@decO (@decI (@E a))) (* ((a b) (* b)))) @lowI = (a (((* ((a b) (* b))) c) (* (* c)))) @lowO = (a ((((a b) (* (* b))) c) (* (* c)))) @main = a @@ -15,5 +15,5 @@ input_file: tests/golden_tests/compile_file/ex2.hvm & @c2 ~ (@I (@E b)) @run = ((@runO (@runI (@E a))) a) @runI = ((@lowO (@lowI (@E (@runO (@runI (@E a)))))) a) -@runO = ((@decO (@low (@E (@lowO (@lowI (@E (@runO (@runI (@E a))))))))) a) +@runO = ((@decO (@decI (@E (@lowO (@lowI (@E (@runO (@runI (@E a))))))))) a) diff --git a/tests/snapshots/compile_file__extracted_match_pred.hvm.snap b/tests/snapshots/compile_file__extracted_match_pred.hvm.snap index f724b3bf29..1d9c716843 100644 --- a/tests/snapshots/compile_file__extracted_match_pred.hvm.snap +++ b/tests/snapshots/compile_file__extracted_match_pred.hvm.snap @@ -2,8 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/extracted_match_pred.hvm --- -@5 = (?<(@valZ @5) a> a) +@7 = (?<(@valZ @7) a> a) @main = a -& @5 ~ (#1 a) +& @val ~ (#1 a) +@val = (?<(@valZ @7) a> a) @valZ = #0 diff --git a/tests/snapshots/compile_file__fst.hvm.snap b/tests/snapshots/compile_file__fst.hvm.snap index bdc506f5b1..44c3145d32 100644 --- a/tests/snapshots/compile_file__fst.hvm.snap +++ b/tests/snapshots/compile_file__fst.hvm.snap @@ -2,7 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/fst.hvm --- -@3 = ([a *] a) +@Fst = ([a *] a) @main = a -& @3 ~ ([#4 #8] a) +& @Fst ~ ([#4 #8] a) diff --git a/tests/snapshots/compile_file__fst_fst.hvm.snap b/tests/snapshots/compile_file__fst_fst.hvm.snap index 88ba1a0e1a..8358edff5a 100644 --- a/tests/snapshots/compile_file__fst_fst.hvm.snap +++ b/tests/snapshots/compile_file__fst_fst.hvm.snap @@ -2,7 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/fst_fst.hvm --- -@5 = ([a *] ([b *] [a b])) +@FstFst = ([a *] ([b *] [a b])) @main = a -& @5 ~ ([#3 #9] ([#4 #12] a)) +& @FstFst ~ ([#3 #9] ([#4 #12] a)) diff --git a/tests/snapshots/compile_file__let_adt_destructuring.hvm.snap b/tests/snapshots/compile_file__let_adt_destructuring.hvm.snap index f2c842fb03..5fcf05e065 100644 --- a/tests/snapshots/compile_file__let_adt_destructuring.hvm.snap +++ b/tests/snapshots/compile_file__let_adt_destructuring.hvm.snap @@ -2,10 +2,10 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/let_adt_destructuring.hvm --- -@4 = ({2 @6 a} a) @6 = {4 a a} @Box = (a {2 {4 a b} b}) +@Unbox = ({2 @6 a} a) @main = a -& @4 ~ (b a) +& @Unbox ~ (b a) & @Box ~ (#1 b) diff --git a/tests/snapshots/compile_file__linearize_match.hvm.snap b/tests/snapshots/compile_file__linearize_match.hvm.snap index 1bedde2f8b..c6effdaa58 100644 --- a/tests/snapshots/compile_file__linearize_match.hvm.snap +++ b/tests/snapshots/compile_file__linearize_match.hvm.snap @@ -2,7 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/linearize_match.hvm --- +@2 = (?<(@3 @4) a> a) @3 = (a a) @4 = (<+ a b> (a b)) -@main = (?<(@3 @4) a> a) +@main = (a (b c)) +& @2 ~ (a (b c)) diff --git a/tests/snapshots/compile_file__list_merge_sort.hvm.snap b/tests/snapshots/compile_file__list_merge_sort.hvm.snap index 955086e6ee..148d4b3692 100644 --- a/tests/snapshots/compile_file__list_merge_sort.hvm.snap +++ b/tests/snapshots/compile_file__list_merge_sort.hvm.snap @@ -11,7 +11,7 @@ input_file: tests/golden_tests/compile_file/list_merge_sort.hvm @Pure = (a {4 {8 a {6 @Nil b}} {4 * b}}) @Q = {8 a {6 {4 @i {4 @j (b (a c))}} (b c)}} @R = (* @Nil) -@S = (a ({4 @Q {4 @R (a b)}} b)) +@Unpack = (a ({4 @Q {4 @R (a b)}} b)) @V = {8 a {6 {4 @o {4 @p (b (a c))}} (b c)}} @W = (* @Nil) @b = {8 {15 a {17 b c}} {6 {19 {4 @b {4 @c (d (e (f g)))}} h} ({5 d {7 i (j (c {2 @F {2 @G ({4 {8 k {6 l m}} {4 * m}} ({4 {8 a {6 g n}} {4 * n}} o))}}))}} ({9 e {11 k j}} ({13 f {4 @d {4 @e (i ({4 {8 b {6 h p}} {4 * p}} l))}}} o)))}} @@ -21,10 +21,10 @@ input_file: tests/golden_tests/compile_file/list_merge_sort.hvm @i = {8 a {6 {4 @V {4 @W (b {4 @i {4 @j (c (d e))}})}} ({21 {23 b f} c} ({4 @d {4 @e (f (a d))}} e))}} @j = (* (a a)) @main = (a (b c)) -& @S ~ (a (d c)) +& @Unpack ~ (a (d c)) & @Map ~ (b (@Pure d)) @o = {8 a {6 {4 @V {4 @W (b c)}} ({23 b d} ({4 @d {4 @e (d (a e))}} {4 {8 e {6 c f}} {4 * f}}))}} -@p = (* @t) +@p = (* @u) @s = (a (b {4 {8 a {6 b c}} {4 * c}})) -@t = (a {4 {8 a {6 @Nil b}} {4 * b}}) +@u = (a {4 {8 a {6 @Nil b}} {4 * b}}) diff --git a/tests/snapshots/compile_file__match_mult_linearization.hvm.snap b/tests/snapshots/compile_file__match_mult_linearization.hvm.snap index e576f3ba23..fa3ffb69f3 100644 --- a/tests/snapshots/compile_file__match_mult_linearization.hvm.snap +++ b/tests/snapshots/compile_file__match_mult_linearization.hvm.snap @@ -2,7 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/match_mult_linearization.hvm --- +@2 = (?<(@3 @4) a> a) @3 = (<+ a <+ b c>> (a (b c))) @4 = (<+ a <+ b <+ c d>>> (a (b (c d)))) -@main = (?<(@3 @4) a> a) +@main = (a (b (c (d e)))) +& @2 ~ (a (b (c (d e)))) diff --git a/tests/snapshots/compile_file__match_num_explicit_bind.hvm.snap b/tests/snapshots/compile_file__match_num_explicit_bind.hvm.snap index 5ac06e9cec..507b97ebef 100644 --- a/tests/snapshots/compile_file__match_num_explicit_bind.hvm.snap +++ b/tests/snapshots/compile_file__match_num_explicit_bind.hvm.snap @@ -2,9 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/match_num_explicit_bind.hvm --- -@3 = (?<(@4 @5) a> a) @4 = #0 @5 = (a a) @main = a -& @3 ~ (#4 a) +& @pred ~ (#4 a) +@pred = (?<(@4 @5) a> a) diff --git a/tests/snapshots/compile_file__match_tup.hvm.snap b/tests/snapshots/compile_file__match_tup.hvm.snap index 3a29e10e08..dde1ae8cfb 100644 --- a/tests/snapshots/compile_file__match_tup.hvm.snap +++ b/tests/snapshots/compile_file__match_tup.hvm.snap @@ -2,7 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/match_tup.hvm --- -@3 = ([<+ a b> a] b) +@Sum = ([<+ a b> a] b) @main = a -& @3 ~ ([#7 #3] a) +& @Sum ~ ([#7 #3] a) diff --git a/tests/snapshots/compile_file__nested_eta.hvm.snap b/tests/snapshots/compile_file__nested_eta.hvm.snap deleted file mode 100644 index 587a490d7d..0000000000 --- a/tests/snapshots/compile_file__nested_eta.hvm.snap +++ /dev/null @@ -1,6 +0,0 @@ ---- -source: tests/golden_tests.rs -input_file: tests/golden_tests/compile_file/nested_eta.hvm ---- -@main = (a a) - diff --git a/tests/snapshots/compile_file__scrutinee_reconstruction.hvm.snap b/tests/snapshots/compile_file__scrutinee_reconstruction.hvm.snap index 13346ec39d..9f012d0e78 100644 --- a/tests/snapshots/compile_file__scrutinee_reconstruction.hvm.snap +++ b/tests/snapshots/compile_file__scrutinee_reconstruction.hvm.snap @@ -6,7 +6,7 @@ input_file: tests/golden_tests/compile_file/scrutinee_reconstruction.hvm @8 = {4 * @A} @A = (a (* a)) @None = {2 * {2 a a}} -@Option.or = ({3 a {2 @8 {2 @7 (a b)}}} b) +@Option.or = ({3 a {2 @8 {2 @7 (a (b c))}}} (b c)) @Some = (a {2 {4 a b} {2 * b}}) @main = a & @Option.or ~ (b (@None a)) diff --git a/tests/snapshots/compile_file__snd.hvm.snap b/tests/snapshots/compile_file__snd.hvm.snap index 4cd3240861..6381267f00 100644 --- a/tests/snapshots/compile_file__snd.hvm.snap +++ b/tests/snapshots/compile_file__snd.hvm.snap @@ -2,7 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/snd.hvm --- -@4 = ([* a] a) @main = a -& @4 ~ ([#0 #42] a) +& @snd ~ ([#0 #42] a) +@snd = ([* a] a) diff --git a/tests/snapshots/compile_file__sum_predicates.hvm.snap b/tests/snapshots/compile_file__sum_predicates.hvm.snap index 16a0bcd274..c95fa71c23 100644 --- a/tests/snapshots/compile_file__sum_predicates.hvm.snap +++ b/tests/snapshots/compile_file__sum_predicates.hvm.snap @@ -2,13 +2,13 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/sum_predicates.hvm --- -@3 = (?<(@6 @7) a> a) -@5 = (?<(@3 @F) a> a) @6 = #0 @7 = (a a) @A = (a a) @B = (a (<+ a b> b)) +@E = (?<(@6 @7) a> a) @F = (a (?<(@A @B) (a b)> b)) @main = a -& @5 ~ (#8 (#5 a)) +& @sum_pred ~ (#8 (#5 a)) +@sum_pred = (?<(@E @F) (a b)> (a b)) diff --git a/tests/snapshots/compile_file__unapplied_eta.hvm.snap b/tests/snapshots/compile_file__unapplied_eta.hvm.snap new file mode 100644 index 0000000000..efc47f9a4c --- /dev/null +++ b/tests/snapshots/compile_file__unapplied_eta.hvm.snap @@ -0,0 +1,8 @@ +--- +source: tests/golden_tests.rs +input_file: tests/golden_tests/compile_file/unapplied_eta.hvm +--- +@Id = (a a) +@main = (a b) +& @Id ~ (a b) + diff --git a/tests/snapshots/run_file__linearize_match.hvm.snap b/tests/snapshots/run_file__linearize_match.hvm.snap index 8d30a906fc..8b4810b86b 100644 --- a/tests/snapshots/run_file__linearize_match.hvm.snap +++ b/tests/snapshots/run_file__linearize_match.hvm.snap @@ -2,4 +2,4 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/run_file/linearize_match.hvm --- -λa match a { 0: λb b; +a-1: λd (+ a-1 d) } +λa λb (match a { 0: λc c; +a-1: λe (+ a-1 e) } b) diff --git a/tests/snapshots/run_file__match_mult_linearization.hvm.snap b/tests/snapshots/run_file__match_mult_linearization.hvm.snap index 5e86ba2203..e5610d1788 100644 --- a/tests/snapshots/run_file__match_mult_linearization.hvm.snap +++ b/tests/snapshots/run_file__match_mult_linearization.hvm.snap @@ -2,4 +2,4 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/run_file/match_mult_linearization.hvm --- -λa match a { 0: λb λc λd (+ (+ b c) d); +a-1: λf λg λh (+ (+ (+ a-1 f) g) h) } +λa λb λc λd (match a { 0: λe λf λg (+ (+ e f) g); +a-1: λi λj λk (+ (+ (+ a-1 i) j) k) } b c d)