From 285cab867c665d1355fe53f5ec13a8ffa13654d4 Mon Sep 17 00:00:00 2001 From: Nicolas Abril Date: Tue, 12 Mar 2024 19:58:29 +0100 Subject: [PATCH] [sc-507] Update generated name of floated combinators --- src/term/transform/float_combinators.rs | 2 +- tests/snapshots/cli__compile_all.hvm.snap | 4 +-- .../cli__desugar_float_combinators.hvm.snap | 4 +-- ...pile_file__match_num_all_patterns.hvm.snap | 12 +++---- ...le_file__unscoped_supercombinator.hvm.snap | 7 ++-- ...ompile_file_o_all__adt_option_and.hvm.snap | 8 ++--- .../compile_file_o_all__and.hvm.snap | 5 ++- .../compile_file_o_all__ex2.hvm.snap | 5 ++- .../compile_file_o_all__expr.hvm.snap | 10 +++--- ...mpile_file_o_all__list_merge_sort.hvm.snap | 34 +++++++++---------- .../compile_file_o_all__list_reverse.hvm.snap | 6 ++-- ...all__match_dup_and_reconstruction.hvm.snap | 4 +-- ..._file_o_all__num_pattern_with_var.hvm.snap | 6 ++-- ...ll__recursive_combinator_inactive.hvm.snap | 5 ++- ...le_o_all__repeated_name_trucation.hvm.snap | 6 ++-- ...e_o_all__scrutinee_reconstruction.hvm.snap | 8 ++--- ...ompile_file_o_all__sum_predicates.hvm.snap | 9 +++-- .../compile_file_o_all__weekday.hvm.snap | 13 ++++--- .../snapshots/mutual_recursion__len.hvm.snap | 6 ++-- 19 files changed, 74 insertions(+), 80 deletions(-) diff --git a/src/term/transform/float_combinators.rs b/src/term/transform/float_combinators.rs index 7a3267a84..9c0cfb859 100644 --- a/src/term/transform/float_combinators.rs +++ b/src/term/transform/float_combinators.rs @@ -66,7 +66,7 @@ impl<'d> TermInfo<'d> { } fn detach_term(&mut self, term: &mut Term) { - let comb_name = Name::new(format!("{}$S{}", self.def_name, self.counter)); + let comb_name = Name::new(format!("{}$C{}", self.def_name, self.counter)); self.counter += 1; let comb_var = Term::Ref { nam: comb_name.clone() }; diff --git a/tests/snapshots/cli__compile_all.hvm.snap b/tests/snapshots/cli__compile_all.hvm.snap index e5dbf3122..c3176e4ea 100644 --- a/tests/snapshots/cli__compile_all.hvm.snap +++ b/tests/snapshots/cli__compile_all.hvm.snap @@ -3,8 +3,8 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/cli/compile_all.hvm --- @Pair = (a (b {2 {2 a {2 b c}} c})) -@Pair.get = (a ({2 @Pair.get$S0 (a b)} b)) -@Pair.get$S0 = {2 a {2 b ((a (b c)) c)}} +@Pair.get = (a ({2 @Pair.get$C0 (a b)} b)) +@Pair.get$C0 = {2 a {2 b ((a (b c)) c)}} @main = a & @Pair.get ~ ((<+ b c> (b c)) (d a)) & @Pair ~ (#40 (#2 d)) diff --git a/tests/snapshots/cli__desugar_float_combinators.hvm.snap b/tests/snapshots/cli__desugar_float_combinators.hvm.snap index bf760b87d..c7872b3ce 100644 --- a/tests/snapshots/cli__desugar_float_combinators.hvm.snap +++ b/tests/snapshots/cli__desugar_float_combinators.hvm.snap @@ -6,8 +6,8 @@ input_file: tests/golden_tests/cli/desugar_float_combinators.hvm (S) = λa λb let {b b_2} = b; λc (b (a b_2 c)) -(get) = λa (a get$S0 0) +(get) = λa (a get$C0 0) (main) = (get (S (S Z))) -(get$S0) = λb (+ b 1) +(get$C0) = λb (+ b 1) diff --git a/tests/snapshots/compile_file__match_num_all_patterns.hvm.snap b/tests/snapshots/compile_file__match_num_all_patterns.hvm.snap index 0534e916c..801a0e584 100644 --- a/tests/snapshots/compile_file__match_num_all_patterns.hvm.snap +++ b/tests/snapshots/compile_file__match_num_all_patterns.hvm.snap @@ -28,9 +28,9 @@ In definition 'zero_var_succ': @main = #0 @succ_var = (?<(#0 (a a)) b> b) -@succ_var_zero = (?<(a @succ_var_zero$S0) b> b) +@succ_var_zero = (?<(a @succ_var_zero$C0) b> b) & #0 ~ <+ #1 a> -@succ_var_zero$S0 = (<+ #2 a> a) +@succ_var_zero$C0 = (<+ #2 a> a) @succ_zero = (?<(#0 (a a)) b> b) @succ_zero_succ = (?<(#0 (a a)) b> b) @succ_zero_var = (?<(#0 (a a)) b> b) @@ -38,7 +38,7 @@ In definition 'zero_var_succ': @var_zero = (a a) @zero_succ = (?<(#0 (a a)) b> b) @zero_succ_var = (?<(#0 (a a)) b> b) -@zero_var = (?<(#0 @zero_var$S0) a> a) -@zero_var$S0 = (<+ #1 <- #1 a>> a) -@zero_var_succ = (?<(#0 @zero_var_succ$S0) a> a) -@zero_var_succ$S0 = (<+ #1 <- #1 a>> a) +@zero_var = (?<(#0 @zero_var$C0) a> a) +@zero_var$C0 = (<+ #1 <- #1 a>> a) +@zero_var_succ = (?<(#0 @zero_var_succ$C0) a> a) +@zero_var_succ$C0 = (<+ #1 <- #1 a>> a) diff --git a/tests/snapshots/compile_file__unscoped_supercombinator.hvm.snap b/tests/snapshots/compile_file__unscoped_supercombinator.hvm.snap index af8a12b27..b043039ea 100644 --- a/tests/snapshots/compile_file__unscoped_supercombinator.hvm.snap +++ b/tests/snapshots/compile_file__unscoped_supercombinator.hvm.snap @@ -2,9 +2,8 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file/unscoped_supercombinator.hvm --- -@Foo = ((@Foo$S0 (@Foo$S1 a)) a) -@Foo$S0 = (a ((a b) b)) -@Foo$S1 = (a ((a b) b)) +@Foo = ((@Foo$C0 (@Foo$C1 a)) a) +@Foo$C0 = (a ((a b) b)) +@Foo$C1 = (a ((a b) b)) @main = a & @Foo ~ (* a) - diff --git a/tests/snapshots/compile_file_o_all__adt_option_and.hvm.snap b/tests/snapshots/compile_file_o_all__adt_option_and.hvm.snap index 783be64b8..d01cbac5e 100644 --- a/tests/snapshots/compile_file_o_all__adt_option_and.hvm.snap +++ b/tests/snapshots/compile_file_o_all__adt_option_and.hvm.snap @@ -3,10 +3,10 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/adt_option_and.hvm --- @None = {2 * {2 a a}} -@Option.and = ({2 @Option.and$S2 {2 @Option.and$S3_$_Option.and$S1 a}} a) -@Option.and$S0 = {2 a (b {2 {2 [b a] c} {2 * c}})} -@Option.and$S2 = {2 a ({2 @Option.and$S0 {2 @Option.and$S3_$_Option.and$S1 (a b)}} b)} -@Option.and$S3_$_Option.and$S1 = (* @None) +@Option.and = ({2 @Option.and$C2 {2 @Option.and$C3_$_Option.and$C1 a}} a) +@Option.and$C0 = {2 a (b {2 {2 [b a] c} {2 * c}})} +@Option.and$C2 = {2 a ({2 @Option.and$C0 {2 @Option.and$C3_$_Option.and$C1 (a b)}} b)} +@Option.and$C3_$_Option.and$C1 = (* @None) @Some = (a {2 {2 a b} {2 * b}}) @main = a & @Option.and ~ (b (c a)) diff --git a/tests/snapshots/compile_file_o_all__and.hvm.snap b/tests/snapshots/compile_file_o_all__and.hvm.snap index 423d19677..56f19d7fd 100644 --- a/tests/snapshots/compile_file_o_all__and.hvm.snap +++ b/tests/snapshots/compile_file_o_all__and.hvm.snap @@ -2,10 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/and.hvm --- -@and = (a ({2 (b b) {2 @and$S0 (a c)}} c)) -@and$S0 = (* @false) +@and = (a ({2 (b b) {2 @and$C0 (a c)}} c)) +@and$C0 = (* @false) @false = {2 * {2 a a}} @main = a & @and ~ (@true (@false a)) @true = {2 a {2 * a}} - diff --git a/tests/snapshots/compile_file_o_all__ex2.hvm.snap b/tests/snapshots/compile_file_o_all__ex2.hvm.snap index 81889dba7..266e66b18 100644 --- a/tests/snapshots/compile_file_o_all__ex2.hvm.snap +++ b/tests/snapshots/compile_file_o_all__ex2.hvm.snap @@ -2,8 +2,8 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/ex2.hvm --- -@E = (* @E$S0) -@E$S0 = (* (a a)) +@E = (* @E$C0) +@E$C0 = (* (a a)) @I = (a (* ((a b) (* b)))) @c2 = ({3 (a b) (c a)} (c b)) @decO = ((@decO (@low (@E a))) (* ((a b) (* b)))) @@ -16,4 +16,3 @@ input_file: tests/golden_tests/compile_file_o_all/ex2.hvm @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) - diff --git a/tests/snapshots/compile_file_o_all__expr.hvm.snap b/tests/snapshots/compile_file_o_all__expr.hvm.snap index 63f6022ad..06634c3e2 100644 --- a/tests/snapshots/compile_file_o_all__expr.hvm.snap +++ b/tests/snapshots/compile_file_o_all__expr.hvm.snap @@ -5,13 +5,13 @@ input_file: tests/golden_tests/compile_file_o_all/expr.hvm @App = (a (b {4 * {4 * {4 {4 a {4 b c}} {4 * {4 * {4 * {4 * {4 * {4 * c}}}}}}}}})) @Dup = (a (b (c (d {4 * {4 * {4 * {4 * {4 * {4 * {4 {4 a {4 b {4 c {4 d e}}}} {4 * {4 * e}}}}}}}}})))) @Let = (a (b (c {4 * {4 * {4 * {4 * {4 * {4 {4 a {4 b {4 c d}}} {4 * {4 * {4 * d}}}}}}}}}))) -@Mul = {2 * @Mul$S1} -@Mul$S0 = {2 a {2 * a}} -@Mul$S1 = {2 * @Mul$S0} +@Mul = {2 * @Mul$C1} +@Mul$C0 = {2 a {2 * a}} +@Mul$C1 = {2 * @Mul$C0} @Num = (a {4 * {4 {4 a b} {4 * {4 * {4 * {4 * {4 * {4 * {4 * b}}}}}}}}}) @Op2 = (a (b (c {4 * {4 * {4 * {4 * {4 * {4 * {4 * {4 * {4 {4 a {4 b {4 c d}}} d}}}}}}}}}))) -@Sub = {2 * @Sub$S0} -@Sub$S0 = {2 a {2 * {2 * a}}} +@Sub = {2 * @Sub$C0} +@Sub$C0 = {2 a {2 * {2 * a}}} @Var = (a {4 {4 a b} {4 * {4 * {4 * {4 * {4 * {4 * {4 * {4 * b}}}}}}}}}) @main = a & @Let ~ (b (c (d a))) diff --git a/tests/snapshots/compile_file_o_all__list_merge_sort.hvm.snap b/tests/snapshots/compile_file_o_all__list_merge_sort.hvm.snap index ee7f9c2af..6c3946472 100644 --- a/tests/snapshots/compile_file_o_all__list_merge_sort.hvm.snap +++ b/tests/snapshots/compile_file_o_all__list_merge_sort.hvm.snap @@ -3,25 +3,25 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/list_merge_sort.hvm --- @Cons = (a (b {4 {4 a {4 b c}} {4 * c}})) -@If$S0 = (a (* a)) -@If$S1 = (* (a a)) -@Map = ({4 @Map$S0 {4 @Unpack$S3_$_MergePair$S4_$_Map$S1 a}} a) -@Map$S0 = {4 a {4 {4 @Map$S0 {4 @Unpack$S3_$_MergePair$S4_$_Map$S1 (b c)}} ({5 (a d) b} {4 {4 d {4 c e}} {4 * e}})}} -@Merge$S0 = {4 {9 a {9 b c}} {4 {7 d {4 @Merge$S0 {4 @Merge$S1 (e (f (g h)))}}} ({15 (i (a {2 @If$S0 {2 @If$S1 ({4 {4 j {4 k l}} {4 * l}} ({4 {4 c {4 h m}} {4 * m}} n))}})) {15 o e}} ({13 i {13 j f}} ({11 {4 @Merge$S2 {4 @Merge$S3 (o ({4 {4 b {4 d p}} {4 * p}} k))}} g} n)))}} -@Merge$S1 = (* @Cons) -@Merge$S2 = {4 a {4 b (c ({4 @Merge$S0 {4 @Merge$S1 (c (a (b d)))}} d))}} -@Merge$S3 = (* (a a)) -@MergePair$S0 = {4 a {4 {4 @MergePair$S3 {4 @Unpack$S3_$_MergePair$S4_$_Map$S1 (b c)}} ({17 d b} ({4 @Merge$S2 {4 @Merge$S3 (d (a e))}} {4 {4 e {4 c f}} {4 * f}}))}} -@MergePair$S1 = (a {4 {4 a {4 @Nil b}} {4 * b}}) -@MergePair$S2 = (* @MergePair$S1) -@MergePair$S3 = {4 a {4 {4 @MergePair$S0 {4 @MergePair$S2 (b (a c))}} (b c)}} +@If$C0 = (a (* a)) +@If$C1 = (* (a a)) +@Map = ({4 @Map$C0 {4 @Unpack$C3_$_MergePair$C4_$_Map$C1 a}} a) +@Map$C0 = {4 a {4 {4 @Map$C0 {4 @Unpack$C3_$_MergePair$C4_$_Map$C1 (b c)}} ({5 (a d) b} {4 {4 d {4 c e}} {4 * e}})}} +@Merge$C0 = {4 {9 a {9 b c}} {4 {7 d {4 @Merge$C0 {4 @Merge$C1 (e (f (g h)))}}} ({15 (i (a {2 @If$C0 {2 @If$C1 ({4 {4 j {4 k l}} {4 * l}} ({4 {4 c {4 h m}} {4 * m}} n))}})) {15 o e}} ({13 i {13 j f}} ({11 {4 @Merge$C2 {4 @Merge$C3 (o ({4 {4 b {4 d p}} {4 * p}} k))}} g} n)))}} +@Merge$C1 = (* @Cons) +@Merge$C2 = {4 a {4 b (c ({4 @Merge$C0 {4 @Merge$C1 (c (a (b d)))}} d))}} +@Merge$C3 = (* (a a)) +@MergePair$C0 = {4 a {4 {4 @MergePair$C3 {4 @Unpack$C3_$_MergePair$C4_$_Map$C1 (b c)}} ({17 d b} ({4 @Merge$C2 {4 @Merge$C3 (d (a e))}} {4 {4 e {4 c f}} {4 * f}}))}} +@MergePair$C1 = (a {4 {4 a {4 @Nil b}} {4 * b}}) +@MergePair$C2 = (* @MergePair$C1) +@MergePair$C3 = {4 a {4 {4 @MergePair$C0 {4 @MergePair$C2 (b (a c))}} (b c)}} @Nil = {4 * {4 a a}} @Pure = (a {4 {4 a {4 @Nil b}} {4 * b}}) -@Unpack = (a ({4 @Unpack$S2 {4 @Unpack$S3_$_MergePair$S4_$_Map$S1 (a b)}} b)) -@Unpack$S0 = {4 a {4 {4 @MergePair$S3 {4 @Unpack$S3_$_MergePair$S4_$_Map$S1 (b {4 @Unpack$S0 {4 @Unpack$S1 (c (d e))}})}} ({3 c {17 f b}} ({4 @Merge$S2 {4 @Merge$S3 (f (a d))}} e))}} -@Unpack$S1 = (* (a a)) -@Unpack$S2 = {4 a {4 {4 @Unpack$S0 {4 @Unpack$S1 (b (a c))}} (b c)}} -@Unpack$S3_$_MergePair$S4_$_Map$S1 = (* @Nil) +@Unpack = (a ({4 @Unpack$C2 {4 @Unpack$C3_$_MergePair$C4_$_Map$C1 (a b)}} b)) +@Unpack$C0 = {4 a {4 {4 @MergePair$C3 {4 @Unpack$C3_$_MergePair$C4_$_Map$C1 (b {4 @Unpack$C0 {4 @Unpack$C1 (c (d e))}})}} ({3 c {17 f b}} ({4 @Merge$C2 {4 @Merge$C3 (f (a d))}} e))}} +@Unpack$C1 = (* (a a)) +@Unpack$C2 = {4 a {4 {4 @Unpack$C0 {4 @Unpack$C1 (b (a c))}} (b c)}} +@Unpack$C3_$_MergePair$C4_$_Map$C1 = (* @Nil) @main = (a (b c)) & @Unpack ~ (a (d c)) & @Map ~ (b (@Pure d)) diff --git a/tests/snapshots/compile_file_o_all__list_reverse.hvm.snap b/tests/snapshots/compile_file_o_all__list_reverse.hvm.snap index 74937e580..4bd9dfe4d 100644 --- a/tests/snapshots/compile_file_o_all__list_reverse.hvm.snap +++ b/tests/snapshots/compile_file_o_all__list_reverse.hvm.snap @@ -2,7 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/list_reverse.hvm --- -@concat$S0 = {2 a {2 {2 @concat$S0 {2 (b b) (c d)}} (c {2 {2 a {2 d e}} {2 * e}})}} +@concat$C0 = {2 a {2 {2 @concat$C0 {2 (b b) (c d)}} (c {2 {2 a {2 d e}} {2 * e}})}} @cons = (a (b {2 {2 a {2 b c}} {2 * c}})) @main = a & @reverse ~ (b a) @@ -10,5 +10,5 @@ input_file: tests/golden_tests/compile_file_o_all/list_reverse.hvm & @cons ~ (#2 (d c)) & @cons ~ (#1 (@nil d)) @nil = {2 * {2 a a}} -@reverse = ({2 @reverse$S0 {2 @nil a}} a) -@reverse$S0 = {2 a {2 {2 @reverse$S0 {2 @nil {2 @concat$S0 {2 (b b) ({2 {2 a {2 @nil c}} {2 * c}} d)}}}} d}} +@reverse = ({2 @reverse$C0 {2 @nil a}} a) +@reverse$C0 = {2 a {2 {2 @reverse$C0 {2 @nil {2 @concat$C0 {2 (b b) ({2 {2 a {2 @nil c}} {2 * c}} d)}}}} d}} diff --git a/tests/snapshots/compile_file_o_all__match_dup_and_reconstruction.hvm.snap b/tests/snapshots/compile_file_o_all__match_dup_and_reconstruction.hvm.snap index 47977d7dc..13ff38021 100644 --- a/tests/snapshots/compile_file_o_all__match_dup_and_reconstruction.hvm.snap +++ b/tests/snapshots/compile_file_o_all__match_dup_and_reconstruction.hvm.snap @@ -3,8 +3,8 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/match_dup_and_reconstruction.hvm --- @Boxed = (a {2 {2 a b} b}) -@Got = ({3 {2 @Got$S0 (a b)} a} b) -@Got$S0 = {2 a (b [b a])} +@Got = ({3 {2 @Got$C0 (a b)} a} b) +@Got$C0 = {2 a (b [b a])} @main = a & @Got ~ (b a) & @Boxed ~ (#10 b) diff --git a/tests/snapshots/compile_file_o_all__num_pattern_with_var.hvm.snap b/tests/snapshots/compile_file_o_all__num_pattern_with_var.hvm.snap index 370013f57..66198c5c3 100644 --- a/tests/snapshots/compile_file_o_all__num_pattern_with_var.hvm.snap +++ b/tests/snapshots/compile_file_o_all__num_pattern_with_var.hvm.snap @@ -2,9 +2,9 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/num_pattern_with_var.hvm --- -@Foo = ({2 (* #0) {2 @Foo$S3 a}} a) -@Foo$S2 = (a (* a)) -@Foo$S3 = (?<((* #0) @Foo$S2) (* a)> a) +@Foo = ({2 (* #0) {2 @Foo$C3 a}} a) +@Foo$C2 = (a (* a)) +@Foo$C3 = (?<((* #0) @Foo$C2) (* a)> a) @main = a & @Foo ~ (@true (#3 a)) @true = {2 * {2 a a}} diff --git a/tests/snapshots/compile_file_o_all__recursive_combinator_inactive.hvm.snap b/tests/snapshots/compile_file_o_all__recursive_combinator_inactive.hvm.snap index 71b978a5d..6bd511965 100644 --- a/tests/snapshots/compile_file_o_all__recursive_combinator_inactive.hvm.snap +++ b/tests/snapshots/compile_file_o_all__recursive_combinator_inactive.hvm.snap @@ -2,8 +2,7 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/recursive_combinator_inactive.hvm --- -@Foo = (?<({3 @Foo @Foo} @Foo$S0) a> a) -@Foo$S0 = (a (* a)) +@Foo = (?<({3 @Foo @Foo} @Foo$C0) a> a) +@Foo$C0 = (a (* a)) @main = a & @Foo ~ (#0 a) - diff --git a/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap b/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap index 91f264757..46aca4049 100644 --- a/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap +++ b/tests/snapshots/compile_file_o_all__repeated_name_trucation.hvm.snap @@ -4,11 +4,11 @@ input_file: tests/golden_tests/compile_file_o_all/repeated_name_trucation.hvm --- Warnings: Mutual recursion cycle detected in compiled functions: - Cycle 1: long_name_that_truncates -> long_name_that_truncates$S0 -> long_name_that_truncates + Cycle 1: long_name_that_truncates -> long_name_that_truncates$C0 -> long_name_that_truncates This program will expand infinitely in strict evaluation mode. Read https://github.com/HigherOrderCO/hvm-lang/blob/main/docs/lazy-definitions.md for more information. -@long_name_that_truncates = (* @long_name_that_truncates$S0) -@long_name_that_truncates$S0 = (* @long_name_that_truncates) +@long_name_that_truncates = (* @long_name_that_truncates$C0) +@long_name_that_truncates$C0 = (* @long_name_that_truncates) @main = a & @long_name_that_truncates ~ ((b b) a) diff --git a/tests/snapshots/compile_file_o_all__scrutinee_reconstruction.hvm.snap b/tests/snapshots/compile_file_o_all__scrutinee_reconstruction.hvm.snap index 8616b3606..a7acef5d5 100644 --- a/tests/snapshots/compile_file_o_all__scrutinee_reconstruction.hvm.snap +++ b/tests/snapshots/compile_file_o_all__scrutinee_reconstruction.hvm.snap @@ -3,10 +3,10 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/scrutinee_reconstruction.hvm --- @None = {2 * {2 a a}} -@Option.or = ({3 {2 @Option.or$S1 {2 @Option.or$S2 (a b)}} a} b) -@Option.or$S0 = (a (* a)) -@Option.or$S1 = {2 * @Option.or$S0} -@Option.or$S2 = (* (a a)) +@Option.or = ({3 {2 @Option.or$C1 {2 @Option.or$C2 (a b)}} a} b) +@Option.or$C0 = (a (* a)) +@Option.or$C1 = {2 * @Option.or$C0} +@Option.or$C2 = (* (a a)) @Some = (a {2 {2 a b} {2 * b}}) @main = a & @Option.or ~ (b (@None a)) diff --git a/tests/snapshots/compile_file_o_all__sum_predicates.hvm.snap b/tests/snapshots/compile_file_o_all__sum_predicates.hvm.snap index 893932c3d..04660372d 100644 --- a/tests/snapshots/compile_file_o_all__sum_predicates.hvm.snap +++ b/tests/snapshots/compile_file_o_all__sum_predicates.hvm.snap @@ -4,8 +4,7 @@ input_file: tests/golden_tests/compile_file_o_all/sum_predicates.hvm --- @main = a & @sum_pred ~ (#8 (#5 a)) -@sum_pred = (?<(@sum_pred$S0 @sum_pred$S2) a> a) -@sum_pred$S0 = (?<(#0 (a a)) b> b) -@sum_pred$S1 = (a (<+ a b> b)) -@sum_pred$S2 = (a (?<((b b) @sum_pred$S1) (a c)> c)) - +@sum_pred = (?<(@sum_pred$C0 @sum_pred$C2) a> a) +@sum_pred$C0 = (?<(#0 (a a)) b> b) +@sum_pred$C1 = (a (<+ a b> b)) +@sum_pred$C2 = (a (?<((b b) @sum_pred$C1) (a c)> c)) diff --git a/tests/snapshots/compile_file_o_all__weekday.hvm.snap b/tests/snapshots/compile_file_o_all__weekday.hvm.snap index c1fec5ed2..d636b34f7 100644 --- a/tests/snapshots/compile_file_o_all__weekday.hvm.snap +++ b/tests/snapshots/compile_file_o_all__weekday.hvm.snap @@ -2,12 +2,11 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/compile_file_o_all/weekday.hvm --- -@Saturday = {2 * @Saturday$S4} -@Saturday$S0 = {2 a {2 * a}} -@Saturday$S1 = {2 * @Saturday$S0} -@Saturday$S2 = {2 * @Saturday$S1} -@Saturday$S3 = {2 * @Saturday$S2} -@Saturday$S4 = {2 * @Saturday$S3} +@Saturday = {2 * @Saturday$C4} +@Saturday$C0 = {2 a {2 * a}} +@Saturday$C1 = {2 * @Saturday$C0} +@Saturday$C2 = {2 * @Saturday$C1} +@Saturday$C3 = {2 * @Saturday$C2} +@Saturday$C4 = {2 * @Saturday$C3} @main = a & (b b) ~ (@Saturday a) - diff --git a/tests/snapshots/mutual_recursion__len.hvm.snap b/tests/snapshots/mutual_recursion__len.hvm.snap index 30694a096..8b7625d31 100644 --- a/tests/snapshots/mutual_recursion__len.hvm.snap +++ b/tests/snapshots/mutual_recursion__len.hvm.snap @@ -2,11 +2,11 @@ source: tests/golden_tests.rs input_file: tests/golden_tests/mutual_recursion/len.hvm --- -@Len = ({2 @Len$S1 {2 #0 a}} a) -@Len$S0 = {2 a b} +@Len = ({2 @Len$C1 {2 #0 a}} a) +@Len$C0 = {2 a b} & #1 ~ <+ c b> & @Len ~ (a c) -@Len$S1 = {2 * @Len$S0} +@Len$C1 = {2 * @Len$C0} @List.cons = (a (b {2 {2 a {2 b c}} {2 * c}})) @List.nil = {2 * {2 a a}} @main = a