From 71e2600275949f7756f188739f0b308c3873109a Mon Sep 17 00:00:00 2001 From: Nicolas Abril Date: Sun, 6 Oct 2024 21:19:49 +0200 Subject: [PATCH] Small cleanups --- src/fun/builtins.bend | 6 +- src/fun/transform/encode_adts.rs | 32 ++---- src/fun/transform/encode_match_terms.rs | 4 +- src/fun/transform/fix_match_terms.rs | 24 +++-- src/fun/transform/float_combinators.rs | 11 +- .../desugar_file__ask_branch.bend.snap | 24 ++--- .../desugar_file__bind_syntax.bend.snap | 24 ++--- .../desugar_file__combinators.bend.snap | 12 +-- .../desugar_file__deref_loop.bend.snap | 12 +-- .../desugar_file__mapper_syntax.bend.snap | 12 +-- .../desugar_file__tree_syntax.bend.snap | 12 +-- ...ncode_pattern_match__adt_tup_era.bend.snap | 6 +- .../encode_pattern_match__and3.bend.snap | 12 +-- .../encode_pattern_match__bool.bend.snap | 12 +-- .../encode_pattern_match__bool_tup.bend.snap | 12 +-- .../encode_pattern_match__box.bend.snap | 6 +- .../encode_pattern_match__common.bend.snap | 102 +++++++++--------- .../encode_pattern_match__concat.bend.snap | 12 +-- ...encode_pattern_match__concat_def.bend.snap | 12 +-- ..._pattern_match__definition_merge.bend.snap | 24 ++--- .../encode_pattern_match__expr.bend.snap | 78 +++++++------- .../encode_pattern_match__full_map.bend.snap | 12 +-- ...code_pattern_match__is_some_some.bend.snap | 12 +-- ...e_pattern_match__list_merge_sort.bend.snap | 24 ++--- ...match__match_adt_unscoped_in_arm.bend.snap | 12 +-- ...match__match_adt_unscoped_lambda.bend.snap | 12 +-- ...rn_match__match_adt_unscoped_var.bend.snap | 12 +-- ..._match__match_auto_linearization.bend.snap | 6 +- ..._match__match_num_adt_tup_parser.bend.snap | 24 ++--- ...code_pattern_match__match_syntax.bend.snap | 12 +-- ...tern_match__non_matching_fst_arg.bend.snap | 12 +-- ...rn_match__pattern_match_encoding.bend.snap | 30 +++--- .../encode_pattern_match__var_only.bend.snap | 12 +-- .../encode_pattern_match__weekday.bend.snap | 42 ++++---- tests/snapshots/parse_file__imp_map.bend.snap | 12 +-- .../parse_file__imp_program.bend.snap | 42 ++++---- .../parse_file__multi_line_comment.bend.snap | 18 ++-- .../parse_file__scape_chars.bend.snap | 12 +-- .../parse_file__tuple_need_parens.bend.snap | 12 +-- .../simplify_matches__adt_tup_era.bend.snap | 6 +- .../simplify_matches__already_flat.bend.snap | 54 +++++----- .../simplify_matches__bits_dec.bend.snap | 18 ++-- ...plify_matches__complex_with_case.bend.snap | 12 +-- ...plify_matches__double_unwrap_box.bend.snap | 6 +- ...ify_matches__double_unwrap_maybe.bend.snap | 12 +-- ...y_matches__flatten_with_terminal.bend.snap | 12 +-- ...ify_matches__linearize_match_all.bend.snap | 12 +-- .../simplify_matches__nested.bend.snap | 30 +++--- .../simplify_matches__nested2.bend.snap | 12 +-- .../simplify_matches__nested_0ary.bend.snap | 12 +-- 50 files changed, 471 insertions(+), 482 deletions(-) diff --git a/src/fun/builtins.bend b/src/fun/builtins.bend index 520928cd3..baa3a102e 100644 --- a/src/fun/builtins.bend +++ b/src/fun/builtins.bend @@ -109,7 +109,7 @@ def DiffList/append(diff: List(T) -> List(T), val: T) -> (List(T) -> List(T)): # Concatenates two difference lists. def DiffList/concat( left: List(T) -> List(T), - right: List(T) -> List(T) + right: List(T) -> List(T) ) -> (List(T) -> List(T)): return lambda x: left(right(x)) @@ -263,7 +263,7 @@ def IO/bind(a: IO(A), b: ((Id -> Id) -> A -> IO(B))) -> IO(B): # Calls an IO by its name with the given arguments. # # The arguments are untyped and not checked for type correctness. -# If type safety is desired, this function should be wrapped with +# If type safety is desired, this function should be wrapped with # another that checks the types of the arguments and of the return. # # Always returns a `Result` where the error is an `IOError`, a type @@ -427,7 +427,7 @@ def IO/FS/write_file(path: String, bytes: List(u24)) -> IO(Result(None, u24)): res_f <- IO/FS/open(path, "w") match res_f: case Result/Ok: - f = res_f.val + f = res_f.val res1 <- IO/FS/write(f, bytes) res2 <- IO/FS/close(f) return wrap(Result/and(res2, res1)) diff --git a/src/fun/transform/encode_adts.rs b/src/fun/transform/encode_adts.rs index 5dad66381..7a612f7af 100644 --- a/src/fun/transform/encode_adts.rs +++ b/src/fun/transform/encode_adts.rs @@ -1,5 +1,5 @@ use crate::{ - fun::{Book, Definition, Name, Num, Pattern, Rule, Source, SourceKind, Term, Type}, + fun::{Book, Definition, Name, Num, Pattern, Rule, Source, Term}, AdtEncoding, }; @@ -7,20 +7,17 @@ impl Book { /// Defines a function for each constructor in each ADT in the book. pub fn encode_adts(&mut self, adt_encoding: AdtEncoding) { let mut defs = vec![]; - let mut tags = vec![]; - for (adt_name, adt) in self.adts.iter() { + for (_, adt) in self.adts.iter() { for (ctr_idx, (ctr_name, ctr)) in adt.ctrs.iter().enumerate() { let ctrs: Vec<_> = adt.ctrs.keys().cloned().collect(); let body = match adt_encoding { AdtEncoding::Scott => encode_ctr_scott(ctr.fields.iter().map(|f| &f.nam), ctrs, ctr_name), AdtEncoding::NumScott => { - let tag = make_tag(adt_name == ctr_name, ctr_name); - let body = encode_ctr_num_scott(ctr.fields.iter().map(|f| &f.nam), &tag); - let tag_def = make_tag_def(ctr_idx, &tag, adt.source.clone()); - tags.push((tag, tag_def)); - body + let tag = encode_num_scott_tag(ctr_idx as u32, ctr_name, adt.source.clone()); + defs.push((tag.name.clone(), tag.clone())); + encode_ctr_num_scott(ctr.fields.iter().map(|f| &f.nam), &tag.name) } }; @@ -36,16 +33,6 @@ impl Book { } } self.defs.extend(defs); - self.defs.extend(tags); - } -} - -fn make_tag(is_object: bool, ctr_name: &Name) -> Name { - if is_object { - Name::new(format!("{ctr_name}/tag")) - } else { - let (typ, ctr) = ctr_name.rsplit_once('/').expect("To split at '/'"); - Name::new(format!("{typ}/{ctr}/tag")) } } @@ -71,9 +58,8 @@ fn encode_ctr_num_scott<'a>(ctr_args: impl DoubleEndedIterator Term::rfold_lams(term, ctr_args.cloned().map(Some)) } -fn make_tag_def(ctr_idx: usize, tag: &Name, source: Source) -> Definition { - let rules = vec![Rule { pats: vec![], body: Term::Num { val: Num::U24(ctr_idx as u32) } }]; - let kind = if source.is_builtin() { SourceKind::Builtin } else { SourceKind::Generated }; - let source = Source { kind, ..source }; - Definition { name: tag.clone(), typ: Type::U24, check: true, rules, source } +fn encode_num_scott_tag(tag : u32, ctr_name: &Name, source: Source) -> Definition { + let tag_nam = Name::new(format!("{ctr_name}/tag")); + let rules = vec![Rule { pats: vec![], body: Term::Num { val: Num::U24(tag) } }]; + Definition::new_gen(tag_nam.clone(), rules, source, true) } diff --git a/src/fun/transform/encode_match_terms.rs b/src/fun/transform/encode_match_terms.rs index 84ed5f673..5d5614734 100644 --- a/src/fun/transform/encode_match_terms.rs +++ b/src/fun/transform/encode_match_terms.rs @@ -5,13 +5,11 @@ use crate::{ impl Book { /// Encodes pattern matching expressions in the book into their - /// native/core form. Must be run after [`Ctr::fix_match_terms`]. + /// core form. Must be run after [`Ctr::fix_match_terms`]. /// /// ADT matches are encoded based on `adt_encoding`. /// /// Num matches are encoded as a sequence of native num matches (on 0 and 1+). - /// - /// Var and pair matches become a let expression. pub fn encode_matches(&mut self, adt_encoding: AdtEncoding) { for def in self.defs.values_mut() { for rule in &mut def.rules { diff --git a/src/fun/transform/fix_match_terms.rs b/src/fun/transform/fix_match_terms.rs index 6467ddb38..66f410dbc 100644 --- a/src/fun/transform/fix_match_terms.rs +++ b/src/fun/transform/fix_match_terms.rs @@ -16,9 +16,10 @@ enum FixMatchErr { impl Ctx<'_> { /// Convert all match and switch expressions to a normalized form. /// * For matches, resolve the constructors and create the name of the field variables. - /// * For switches, resolve the succ case ("_") and create the name of the pred variable. - /// * If the match arg is not a variable, it is separated into a let expression and bound to "%matched" + /// * For switches, the resolution and name bind is already done during parsing. /// * Check for redundant arms and non-exhaustive matches. + /// * Converts the initial bind to an alias on every arm, rebuilding the eliminated constructor + /// * Since the bind is not needed anywhere else, it's erased from the term. /// /// Example: /// For the program @@ -26,19 +27,22 @@ impl Ctx<'_> { /// data MyList = (Cons h t) | Nil /// match x { /// Cons: (A x.h x.t) - /// Nil: switch (Foo y) { 0: B; 1: C; _: D } + /// Nil: switch %arg = (Foo y) { 0: B; 1: C; _ %arg-2: D } /// } /// ``` /// The following AST transformations will be made: /// * The binds `x.h` and `x.t` will be generated and stored in the match term. - /// * `(Foo y)`` will be put in a let expression, bound to the variable `%matched`; - /// * The bind `%matched-2` will be generated and stored in the switch term. - /// * If either was missing one of the match cases (a number or a constructor), we'd get an error. - /// * If either included one of the cases more than once (including wildcard patterns), we'd get a warning. + /// * If it was missing one of the match cases, we'd get an error. + /// * If it included one of the cases more than once (including wildcard patterns), we'd get a warning. /// ```hvm - /// match x { - /// Cons x.h x.t: (A x.h x.t) - /// Nil: let %matched = (Foo y); switch %matched { 0: B; 1: C; _: D } + /// match * = x { + /// Cons x.h x.t: use x = (Cons x.h x.t); (A x.h x.t) + /// Nil: use x = Nil; + /// switch * = (Foo y) { + /// 0: use %arg = 0; B; + /// 1: use %arg = 1; C; + /// _: use %arg = (+ %arg-2 2); D + /// } /// } /// ``` pub fn fix_match_terms(&mut self) -> Result<(), Diagnostics> { diff --git a/src/fun/transform/float_combinators.rs b/src/fun/transform/float_combinators.rs index 2476adf35..d092065fa 100644 --- a/src/fun/transform/float_combinators.rs +++ b/src/fun/transform/float_combinators.rs @@ -170,8 +170,7 @@ impl Term { // Check if the function it's referring to is safe let safe = if let Some(def) = ctx.book.defs.get(nam) { - let ref_safe = def.rule().body.is_safe(ctx); - ref_safe + def.rule().body.is_safe(ctx) } else if let Some((safe, _)) = ctx.combinators.get(nam) { *safe } else { @@ -187,13 +186,15 @@ impl Term { }) } - /// Checks if the term is a lambda sequence with the body being a variable in the scope or a reference. + /// Checks if the term is a lambda sequence with a safe body. + /// If the body is a variable bound in the lambdas, it's a nullary constructor. + /// If the body is a reference, it's in inactive position, so always safe. fn is_safe_lambda(&self, ctx: &mut FloatCombinatorsCtx) -> bool { let mut current = self; let mut scope = Vec::new(); - while let Term::Lam { bod, .. } = current { - scope.extend(current.pattern().unwrap().binds().filter_map(|x| x.as_ref())); + while let Term::Lam { pat, bod, .. } = current { + scope.extend(pat.binds().filter_map(|x| x.as_ref())); current = bod; } diff --git a/tests/snapshots/desugar_file__ask_branch.bend.snap b/tests/snapshots/desugar_file__ask_branch.bend.snap index dc7177059..27e80ee09 100644 --- a/tests/snapshots/desugar_file__ask_branch.bend.snap +++ b/tests/snapshots/desugar_file__ask_branch.bend.snap @@ -17,30 +17,30 @@ undefer: (((a -> a) -> b) -> b) unchecked main: Any (main) = (IO/bind (Bool/T λa switch a { 0: (IO/wrap 0); _: λ* (IO/wrap 0); }) λb (b λc λd (c d) IO/wrap)) -IO/Done: ((u24, u24) -> a -> (IO a)) -(IO/Done) = λa λb λc (c IO/Done/tag a b) - -IO/Call: ((u24, u24) -> String -> Any -> ((Result Any (IOError Any)) -> (IO a)) -> (IO a)) -(IO/Call) = λa λb λc λd λe (e IO/Call/tag a b c d) - -Bool/T: Bool -(Bool/T) = λa (a Bool/T/tag) - -Bool/F: Bool -(Bool/F) = λa (a Bool/F/tag) - IO/Done/tag: u24 (IO/Done/tag) = 0 +IO/Done: ((u24, u24) -> a -> (IO a)) +(IO/Done) = λa λb λc (c IO/Done/tag a b) + IO/Call/tag: u24 (IO/Call/tag) = 1 +IO/Call: ((u24, u24) -> String -> Any -> ((Result Any (IOError Any)) -> (IO a)) -> (IO a)) +(IO/Call) = λa λb λc λd λe (e IO/Call/tag a b c d) + Bool/T/tag: u24 (Bool/T/tag) = 0 +Bool/T: Bool +(Bool/T) = λa (a Bool/T/tag) + Bool/F/tag: u24 (Bool/F/tag) = 1 +Bool/F: Bool +(Bool/F) = λa (a Bool/F/tag) + IO/bind__C0: _ (IO/bind__C0) = λ* λa λb (undefer b a) diff --git a/tests/snapshots/desugar_file__bind_syntax.bend.snap b/tests/snapshots/desugar_file__bind_syntax.bend.snap index 55b6fd2b7..4197a0525 100644 --- a/tests/snapshots/desugar_file__bind_syntax.bend.snap +++ b/tests/snapshots/desugar_file__bind_syntax.bend.snap @@ -17,30 +17,30 @@ unchecked Main: Any undefer: (((a -> a) -> b) -> b) (undefer) = λa (a λb b) -String/Nil: String -(String/Nil) = λa (a String/Nil/tag) - -String/Cons: (u24 -> String -> String) -(String/Cons) = λa λb λc (c String/Cons/tag a b) - -Result/Ok: (b -> (Result b a)) -(Result/Ok) = λa λb (b Result/Ok/tag a) - -Result/Err: (a -> (Result b a)) -(Result/Err) = λa λb (b Result/Err/tag a) - String/Nil/tag: u24 (String/Nil/tag) = 0 +String/Nil: String +(String/Nil) = λa (a String/Nil/tag) + String/Cons/tag: u24 (String/Cons/tag) = 1 +String/Cons: (u24 -> String -> String) +(String/Cons) = λa λb λc (c String/Cons/tag a b) + Result/Ok/tag: u24 (Result/Ok/tag) = 0 +Result/Ok: (b -> (Result b a)) +(Result/Ok) = λa λb (b Result/Ok/tag a) + Result/Err/tag: u24 (Result/Err/tag) = 1 +Result/Err: (a -> (Result b a)) +(Result/Err) = λa λb (b Result/Err/tag a) + unchecked Result/bind__C0: _ (Result/bind__C0) = λa λb (undefer b a) diff --git a/tests/snapshots/desugar_file__combinators.bend.snap b/tests/snapshots/desugar_file__combinators.bend.snap index e261f6ac9..6358da1b3 100644 --- a/tests/snapshots/desugar_file__combinators.bend.snap +++ b/tests/snapshots/desugar_file__combinators.bend.snap @@ -35,18 +35,18 @@ unchecked B: Any unchecked Main: Any (Main) = (List/Cons 0 (List/Cons list List/Nil)) -List/Nil: (List a) -(List/Nil) = λa (a List/Nil/tag) - -List/Cons: (a -> (List a) -> (List a)) -(List/Cons) = λa λb λc (c List/Cons/tag a b) - List/Nil/tag: u24 (List/Nil/tag) = 0 +List/Nil: (List a) +(List/Nil) = λa (a List/Nil/tag) + List/Cons/tag: u24 (List/Cons/tag) = 1 +List/Cons: (a -> (List a) -> (List a)) +(List/Cons) = λa λb λc (c List/Cons/tag a b) + unchecked A__C0: _ (A__C0) = let {a b} = A; λc (a b c) diff --git a/tests/snapshots/desugar_file__deref_loop.bend.snap b/tests/snapshots/desugar_file__deref_loop.bend.snap index 33630f986..9f0812138 100644 --- a/tests/snapshots/desugar_file__deref_loop.bend.snap +++ b/tests/snapshots/desugar_file__deref_loop.bend.snap @@ -11,18 +11,18 @@ unchecked bar: Any unchecked main: Any (main) = (foo 0) -nat/succ: (Any -> nat) -(nat/succ) = λa λb (b nat/succ/tag a) - -nat/zero: nat -(nat/zero) = λa (a nat/zero/tag) - nat/succ/tag: u24 (nat/succ/tag) = 0 +nat/succ: (Any -> nat) +(nat/succ) = λa λb (b nat/succ/tag a) + nat/zero/tag: u24 (nat/zero/tag) = 1 +nat/zero: nat +(nat/zero) = λa (a nat/zero/tag) + unchecked foo__C0: _ (foo__C0) = λ* (bar 0) diff --git a/tests/snapshots/desugar_file__mapper_syntax.bend.snap b/tests/snapshots/desugar_file__mapper_syntax.bend.snap index 060499a74..bc98f9b83 100644 --- a/tests/snapshots/desugar_file__mapper_syntax.bend.snap +++ b/tests/snapshots/desugar_file__mapper_syntax.bend.snap @@ -20,18 +20,18 @@ unreachable: Any unchecked main: Any (main) = let (c, d) = (Map/get (Map/map (Map/map (Map/set (Map/set Map/empty 0 3) 1 4) 1 λa (+ a 1)) 1 λb (* b 2)) 1); let (e, *) = (Map/get d 0); ((λf (+ f 1) 1), c, e) -Map/Node: (a -> (Map a) -> (Map a) -> (Map a)) -(Map/Node) = λa λb λc λd (d Map/Node/tag a b c) - -Map/Leaf: (Map a) -(Map/Leaf) = λa (a Map/Leaf/tag) - Map/Node/tag: u24 (Map/Node/tag) = 0 +Map/Node: (a -> (Map a) -> (Map a) -> (Map a)) +(Map/Node) = λa λb λc λd (d Map/Node/tag a b c) + Map/Leaf/tag: u24 (Map/Leaf/tag) = 1 +Map/Leaf: (Map a) +(Map/Leaf) = λa (a Map/Leaf/tag) + Map/get__C0: _ (Map/get__C0) = λa λb λc λd let (e, f) = (Map/get c (/ a 2)); (e, (Map/Node b f d)) diff --git a/tests/snapshots/desugar_file__tree_syntax.bend.snap b/tests/snapshots/desugar_file__tree_syntax.bend.snap index ac61c380b..5a35009d4 100644 --- a/tests/snapshots/desugar_file__tree_syntax.bend.snap +++ b/tests/snapshots/desugar_file__tree_syntax.bend.snap @@ -35,18 +35,18 @@ unchecked imp3: Any unchecked imp4: (Any -> Any) (imp4) = λa switch a { 0: (Tree/Leaf 0); _: imp4__C0; } -Tree/Node: ((Tree a) -> (Tree a) -> (Tree a)) -(Tree/Node) = λa λb λc (c Tree/Node/tag a b) - -Tree/Leaf: (a -> (Tree a)) -(Tree/Leaf) = λa λb (b Tree/Leaf/tag a) - Tree/Node/tag: u24 (Tree/Node/tag) = 0 +Tree/Node: ((Tree a) -> (Tree a) -> (Tree a)) +(Tree/Node) = λa λb λc (c Tree/Node/tag a b) + Tree/Leaf/tag: u24 (Tree/Leaf/tag) = 1 +Tree/Leaf: (a -> (Tree a)) +(Tree/Leaf) = λa λb (b Tree/Leaf/tag a) + unchecked fun4__C0: _ (fun4__C0) = λa let {b c} = a; (Tree/Node (fun4 b) (fun4 c)) diff --git a/tests/snapshots/encode_pattern_match__adt_tup_era.bend.snap b/tests/snapshots/encode_pattern_match__adt_tup_era.bend.snap index f1125de0e..c464844f3 100644 --- a/tests/snapshots/encode_pattern_match__adt_tup_era.bend.snap +++ b/tests/snapshots/encode_pattern_match__adt_tup_era.bend.snap @@ -19,8 +19,8 @@ unchecked Foo: Any unchecked Main: Any (Main) = (Foo (Tuple/Pair 1 5)) +Tuple/Pair/tag: _ +(Tuple/Pair/tag) = 0 + Tuple/Pair: (Any -> Any -> Tuple) (Tuple/Pair) = λa λb λc (c Tuple/Pair/tag a b) - -Tuple/Pair/tag: u24 -(Tuple/Pair/tag) = 0 diff --git a/tests/snapshots/encode_pattern_match__and3.bend.snap b/tests/snapshots/encode_pattern_match__and3.bend.snap index 372d1ec55..1b6a84c82 100644 --- a/tests/snapshots/encode_pattern_match__and3.bend.snap +++ b/tests/snapshots/encode_pattern_match__and3.bend.snap @@ -22,14 +22,14 @@ unchecked And: Any unchecked main: Any (main) = (And (Bool/F, Bool/T, Bool/F)) +Bool/T/tag: _ +(Bool/T/tag) = 0 + Bool/T: Bool (Bool/T) = λa (a Bool/T/tag) +Bool/F/tag: _ +(Bool/F/tag) = 1 + Bool/F: Bool (Bool/F) = λa (a Bool/F/tag) - -Bool/T/tag: u24 -(Bool/T/tag) = 0 - -Bool/F/tag: u24 -(Bool/F/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__bool.bend.snap b/tests/snapshots/encode_pattern_match__bool.bend.snap index fe60384ad..b19852766 100644 --- a/tests/snapshots/encode_pattern_match__bool.bend.snap +++ b/tests/snapshots/encode_pattern_match__bool.bend.snap @@ -40,14 +40,14 @@ unchecked and3: Any unchecked and4: Any (and4) = λa (a λb switch b { 0: λc (c λe switch e { 0: bool/true; _: λ* bool/false; }); _: λ* λf let * = f; bool/false; }) +bool/true/tag: _ +(bool/true/tag) = 0 + bool/true: bool (bool/true) = λa (a bool/true/tag) +bool/false/tag: _ +(bool/false/tag) = 1 + bool/false: bool (bool/false) = λa (a bool/false/tag) - -bool/true/tag: u24 -(bool/true/tag) = 0 - -bool/false/tag: u24 -(bool/false/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__bool_tup.bend.snap b/tests/snapshots/encode_pattern_match__bool_tup.bend.snap index ce956fc53..ae4e71b54 100644 --- a/tests/snapshots/encode_pattern_match__bool_tup.bend.snap +++ b/tests/snapshots/encode_pattern_match__bool_tup.bend.snap @@ -22,14 +22,14 @@ unchecked foo: Any unchecked main: Any (main) = (foo (Bool/F, Bool/T)) +Bool/T/tag: _ +(Bool/T/tag) = 0 + Bool/T: Bool (Bool/T) = λa (a Bool/T/tag) +Bool/F/tag: _ +(Bool/F/tag) = 1 + Bool/F: Bool (Bool/F) = λa (a Bool/F/tag) - -Bool/T/tag: u24 -(Bool/T/tag) = 0 - -Bool/F/tag: u24 -(Bool/F/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__box.bend.snap b/tests/snapshots/encode_pattern_match__box.bend.snap index 214ba620e..6a13970d9 100644 --- a/tests/snapshots/encode_pattern_match__box.bend.snap +++ b/tests/snapshots/encode_pattern_match__box.bend.snap @@ -13,8 +13,8 @@ NumScott unchecked unbox: Any (unbox) = λa (a λb switch b { 0: λc c; _: *; }) +box/new/tag: _ +(box/new/tag) = 0 + box/new: (Any -> box) (box/new) = λa λb (b box/new/tag a) - -box/new/tag: u24 -(box/new/tag) = 0 diff --git a/tests/snapshots/encode_pattern_match__common.bend.snap b/tests/snapshots/encode_pattern_match__common.bend.snap index 2b9fb1647..8ba0880f0 100644 --- a/tests/snapshots/encode_pattern_match__common.bend.snap +++ b/tests/snapshots/encode_pattern_match__common.bend.snap @@ -55,104 +55,104 @@ Direction/West: Direction (Direction/West) = λ* λ* λ* λd d NumScott +Box/Filled/tag: _ +(Box/Filled/tag) = 0 + Box/Filled: (Any -> Box) (Box/Filled) = λa λb (b Box/Filled/tag a) +Box/Empty/tag: _ +(Box/Empty/tag) = 1 + Box/Empty: Box (Box/Empty) = λa (a Box/Empty/tag) +Option/Some/tag: _ +(Option/Some/tag) = 0 + Option/Some: (Any -> Option) (Option/Some) = λa λb (b Option/Some/tag a) +Option/None/tag: _ +(Option/None/tag) = 1 + Option/None: Option (Option/None) = λa (a Option/None/tag) +Result_/Ok/tag: _ +(Result_/Ok/tag) = 0 + Result_/Ok: (Any -> Result_) (Result_/Ok) = λa λb (b Result_/Ok/tag a) +Result_/Err/tag: _ +(Result_/Err/tag) = 1 + Result_/Err: (Any -> Result_) (Result_/Err) = λa λb (b Result_/Err/tag a) +List_/Cons/tag: _ +(List_/Cons/tag) = 0 + List_/Cons: (Any -> Any -> List_) (List_/Cons) = λa λb λc (c List_/Cons/tag a b) +List_/Nil/tag: _ +(List_/Nil/tag) = 1 + List_/Nil: List_ (List_/Nil) = λa (a List_/Nil/tag) +Bool/True/tag: _ +(Bool/True/tag) = 0 + Bool/True: Bool (Bool/True) = λa (a Bool/True/tag) +Bool/False/tag: _ +(Bool/False/tag) = 1 + Bool/False: Bool (Bool/False) = λa (a Bool/False/tag) +Light/Red/tag: _ +(Light/Red/tag) = 0 + Light/Red: Light (Light/Red) = λa (a Light/Red/tag) +Light/Yellow/tag: _ +(Light/Yellow/tag) = 1 + Light/Yellow: Light (Light/Yellow) = λa (a Light/Yellow/tag) +Light/Green/tag: _ +(Light/Green/tag) = 2 + Light/Green: Light (Light/Green) = λa (a Light/Green/tag) +Direction/North/tag: _ +(Direction/North/tag) = 0 + Direction/North: Direction (Direction/North) = λa (a Direction/North/tag) +Direction/South/tag: _ +(Direction/South/tag) = 1 + Direction/South: Direction (Direction/South) = λa (a Direction/South/tag) +Direction/East/tag: _ +(Direction/East/tag) = 2 + Direction/East: Direction (Direction/East) = λa (a Direction/East/tag) +Direction/West/tag: _ +(Direction/West/tag) = 3 + Direction/West: Direction (Direction/West) = λa (a Direction/West/tag) - -Box/Filled/tag: u24 -(Box/Filled/tag) = 0 - -Box/Empty/tag: u24 -(Box/Empty/tag) = 1 - -Option/Some/tag: u24 -(Option/Some/tag) = 0 - -Option/None/tag: u24 -(Option/None/tag) = 1 - -Result_/Ok/tag: u24 -(Result_/Ok/tag) = 0 - -Result_/Err/tag: u24 -(Result_/Err/tag) = 1 - -List_/Cons/tag: u24 -(List_/Cons/tag) = 0 - -List_/Nil/tag: u24 -(List_/Nil/tag) = 1 - -Bool/True/tag: u24 -(Bool/True/tag) = 0 - -Bool/False/tag: u24 -(Bool/False/tag) = 1 - -Light/Red/tag: u24 -(Light/Red/tag) = 0 - -Light/Yellow/tag: u24 -(Light/Yellow/tag) = 1 - -Light/Green/tag: u24 -(Light/Green/tag) = 2 - -Direction/North/tag: u24 -(Direction/North/tag) = 0 - -Direction/South/tag: u24 -(Direction/South/tag) = 1 - -Direction/East/tag: u24 -(Direction/East/tag) = 2 - -Direction/West/tag: u24 -(Direction/West/tag) = 3 diff --git a/tests/snapshots/encode_pattern_match__concat.bend.snap b/tests/snapshots/encode_pattern_match__concat.bend.snap index 6e87c70fc..c5a1312fb 100644 --- a/tests/snapshots/encode_pattern_match__concat.bend.snap +++ b/tests/snapshots/encode_pattern_match__concat.bend.snap @@ -22,14 +22,14 @@ unchecked String/concat: Any unchecked main: Any (main) = (String/concat (String/Cons 97 (String/Cons 98 String/Nil)) (String/Cons 99 (String/Cons 100 String/Nil))) +String/Nil/tag: _ +(String/Nil/tag) = 0 + String/Nil: String (String/Nil) = λa (a String/Nil/tag) +String/Cons/tag: _ +(String/Cons/tag) = 1 + String/Cons: (u24 -> String -> String) (String/Cons) = λa λb λc (c String/Cons/tag a b) - -String/Nil/tag: u24 -(String/Nil/tag) = 0 - -String/Cons/tag: u24 -(String/Cons/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__concat_def.bend.snap b/tests/snapshots/encode_pattern_match__concat_def.bend.snap index 8ae37a61c..688dc369b 100644 --- a/tests/snapshots/encode_pattern_match__concat_def.bend.snap +++ b/tests/snapshots/encode_pattern_match__concat_def.bend.snap @@ -22,14 +22,14 @@ unchecked concat: Any unchecked main: Any (main) = (concat (String/Cons 97 (String/Cons 98 String/Nil)) (String/Cons 99 (String/Cons 100 String/Nil))) +String/Nil/tag: _ +(String/Nil/tag) = 0 + String/Nil: String (String/Nil) = λa (a String/Nil/tag) +String/Cons/tag: _ +(String/Cons/tag) = 1 + String/Cons: (u24 -> String -> String) (String/Cons) = λa λb λc (c String/Cons/tag a b) - -String/Nil/tag: u24 -(String/Nil/tag) = 0 - -String/Cons/tag: u24 -(String/Cons/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__definition_merge.bend.snap b/tests/snapshots/encode_pattern_match__definition_merge.bend.snap index 48f8b8b29..ba5305920 100644 --- a/tests/snapshots/encode_pattern_match__definition_merge.bend.snap +++ b/tests/snapshots/encode_pattern_match__definition_merge.bend.snap @@ -22,26 +22,26 @@ NumScott unchecked Foo: Any (Foo) = λa (a λb switch b { 0: λc (c λd switch d { 0: λe (e λh switch h { 0: λi (i λj switch j { 0: 1; _: λ* 1; }); _: λ* λk (k λl switch l { 0: 2; _: λ* 2; }); }); _: λ* λm (m λp switch p { 0: λq (q λr switch r { 0: 1; _: λ* 1; }); _: λ* λs (s λt switch t { 0: 2; _: λ* 2; }); }); }); _: λ* λu (u λv switch v { 0: λw (w λz switch z { 0: λab (ab λbb switch bb { 0: 3; _: λ* 3; }); _: λ* λcb (cb λdb switch db { 0: 3; _: λ* 3; }); }); _: λ* λeb (eb λhb switch hb { 0: λib (ib λjb switch jb { 0: 3; _: λ* 3; }); _: λ* λkb (kb λlb switch lb { 0: 3; _: λ* 3; }); }); }); }) +Either/Left/tag: _ +(Either/Left/tag) = 0 + Either/Left: (Any -> Either) (Either/Left) = λa λb (b Either/Left/tag a) +Either/Right/tag: _ +(Either/Right/tag) = 1 + Either/Right: (Any -> Either) (Either/Right) = λa λb (b Either/Right/tag a) +Bool/True/tag: _ +(Bool/True/tag) = 0 + Bool/True: Bool (Bool/True) = λa (a Bool/True/tag) +Bool/False/tag: _ +(Bool/False/tag) = 1 + Bool/False: Bool (Bool/False) = λa (a Bool/False/tag) - -Either/Left/tag: u24 -(Either/Left/tag) = 0 - -Either/Right/tag: u24 -(Either/Right/tag) = 1 - -Bool/True/tag: u24 -(Bool/True/tag) = 0 - -Bool/False/tag: u24 -(Bool/False/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__expr.bend.snap b/tests/snapshots/encode_pattern_match__expr.bend.snap index 4b4ce406b..a77eea690 100644 --- a/tests/snapshots/encode_pattern_match__expr.bend.snap +++ b/tests/snapshots/encode_pattern_match__expr.bend.snap @@ -43,80 +43,80 @@ Op/Div: Op (Op/Div) = λ* λ* λ* λd d NumScott +Expr/Var/tag: _ +(Expr/Var/tag) = 0 + Expr/Var: (Any -> Expr) (Expr/Var) = λa λb (b Expr/Var/tag a) +Expr/Num/tag: _ +(Expr/Num/tag) = 1 + Expr/Num: (Any -> Expr) (Expr/Num) = λa λb (b Expr/Num/tag a) +Expr/App/tag: _ +(Expr/App/tag) = 2 + Expr/App: (Any -> Any -> Expr) (Expr/App) = λa λb λc (c Expr/App/tag a b) +Expr/Fun/tag: _ +(Expr/Fun/tag) = 3 + Expr/Fun: (Any -> Any -> Expr) (Expr/Fun) = λa λb λc (c Expr/Fun/tag a b) +Expr/If/tag: _ +(Expr/If/tag) = 4 + Expr/If: (Any -> Any -> Any -> Expr) (Expr/If) = λa λb λc λd (d Expr/If/tag a b c) +Expr/Let/tag: _ +(Expr/Let/tag) = 5 + Expr/Let: (Any -> Any -> Any -> Expr) (Expr/Let) = λa λb λc λd (d Expr/Let/tag a b c) +Expr/Dup/tag: _ +(Expr/Dup/tag) = 6 + Expr/Dup: (Any -> Any -> Any -> Any -> Expr) (Expr/Dup) = λa λb λc λd λe (e Expr/Dup/tag a b c d) +Expr/Tup/tag: _ +(Expr/Tup/tag) = 7 + Expr/Tup: (Any -> Any -> Expr) (Expr/Tup) = λa λb λc (c Expr/Tup/tag a b) +Expr/Op2/tag: _ +(Expr/Op2/tag) = 8 + Expr/Op2: (Any -> Any -> Any -> Expr) (Expr/Op2) = λa λb λc λd (d Expr/Op2/tag a b c) +Op/Add/tag: _ +(Op/Add/tag) = 0 + Op/Add: Op (Op/Add) = λa (a Op/Add/tag) +Op/Sub/tag: _ +(Op/Sub/tag) = 1 + Op/Sub: Op (Op/Sub) = λa (a Op/Sub/tag) +Op/Mul/tag: _ +(Op/Mul/tag) = 2 + Op/Mul: Op (Op/Mul) = λa (a Op/Mul/tag) +Op/Div/tag: _ +(Op/Div/tag) = 3 + Op/Div: Op (Op/Div) = λa (a Op/Div/tag) - -Expr/Var/tag: u24 -(Expr/Var/tag) = 0 - -Expr/Num/tag: u24 -(Expr/Num/tag) = 1 - -Expr/App/tag: u24 -(Expr/App/tag) = 2 - -Expr/Fun/tag: u24 -(Expr/Fun/tag) = 3 - -Expr/If/tag: u24 -(Expr/If/tag) = 4 - -Expr/Let/tag: u24 -(Expr/Let/tag) = 5 - -Expr/Dup/tag: u24 -(Expr/Dup/tag) = 6 - -Expr/Tup/tag: u24 -(Expr/Tup/tag) = 7 - -Expr/Op2/tag: u24 -(Expr/Op2/tag) = 8 - -Op/Add/tag: u24 -(Op/Add/tag) = 0 - -Op/Sub/tag: u24 -(Op/Sub/tag) = 1 - -Op/Mul/tag: u24 -(Op/Mul/tag) = 2 - -Op/Div/tag: u24 -(Op/Div/tag) = 3 diff --git a/tests/snapshots/encode_pattern_match__full_map.bend.snap b/tests/snapshots/encode_pattern_match__full_map.bend.snap index ea9797b3b..1bc0768c6 100644 --- a/tests/snapshots/encode_pattern_match__full_map.bend.snap +++ b/tests/snapshots/encode_pattern_match__full_map.bend.snap @@ -52,18 +52,18 @@ unchecked test: (Any -> Any) unchecked main: Any (main) = (test fullMap) +Map/Node/tag: _ +(Map/Node/tag) = 0 + Map/Node: (T -> (Map T) -> (Map T) -> (Map T)) (Map/Node) = λa λb λc λd (d Map/Node/tag a b c) +Map/Leaf/tag: _ +(Map/Leaf/tag) = 1 + Map/Leaf: (Map T) (Map/Leaf) = λa (a Map/Leaf/tag) -Map/Node/tag: u24 -(Map/Node/tag) = 0 - -Map/Leaf/tag: u24 -(Map/Leaf/tag) = 1 - unchecked fullMap__bend0: _ (fullMap__bend0) = λa let {a a_2 a_3} = a; switch (> a 0) { 0: Map/Leaf; _: λ* (Map/Node 1 (fullMap__bend0 (- a_2 1)) (fullMap__bend0 (- a_3 1))); } diff --git a/tests/snapshots/encode_pattern_match__is_some_some.bend.snap b/tests/snapshots/encode_pattern_match__is_some_some.bend.snap index 0a3d13e9c..00b779cae 100644 --- a/tests/snapshots/encode_pattern_match__is_some_some.bend.snap +++ b/tests/snapshots/encode_pattern_match__is_some_some.bend.snap @@ -22,14 +22,14 @@ unchecked some_some: Any unchecked main: Any (main) = (some_some (Option/Some 1)) +Option/Some/tag: _ +(Option/Some/tag) = 0 + Option/Some: (Any -> Option) (Option/Some) = λa λb (b Option/Some/tag a) +Option/None/tag: _ +(Option/None/tag) = 1 + Option/None: Option (Option/None) = λa (a Option/None/tag) - -Option/Some/tag: u24 -(Option/Some/tag) = 0 - -Option/None/tag: u24 -(Option/None/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__list_merge_sort.bend.snap b/tests/snapshots/encode_pattern_match__list_merge_sort.bend.snap index ab9648b40..d1e56e142 100644 --- a/tests/snapshots/encode_pattern_match__list_merge_sort.bend.snap +++ b/tests/snapshots/encode_pattern_match__list_merge_sort.bend.snap @@ -58,26 +58,26 @@ unchecked MergePair: Any unchecked Merge: Any (Merge) = λa λb (b λc switch c { 0: λd λe λf λg (g λi switch i { 0: λj let {j j_2 j_3} = j; λk let {k k_2} = k; λl let {l l_2 l_3} = l; λm let {m m_2 m_3} = m; λn let {n n_2} = n; (If (l m j) (List_/Cons m_2 (Merge l_2 n (List_/Cons j_2 k))) (List_/Cons j_3 (Merge l_3 (List_/Cons m_3 n_2) k_2))); _: λ* λ* λr λs (List_/Cons r s); } f d e); _: λ* λ* λu u; } a) +Bool/True/tag: _ +(Bool/True/tag) = 0 + Bool/True: Bool (Bool/True) = λa (a Bool/True/tag) +Bool/False/tag: _ +(Bool/False/tag) = 1 + Bool/False: Bool (Bool/False) = λa (a Bool/False/tag) +List_/Cons/tag: _ +(List_/Cons/tag) = 0 + List_/Cons: (Any -> Any -> List_) (List_/Cons) = λa λb λc (c List_/Cons/tag a b) +List_/Nil/tag: _ +(List_/Nil/tag) = 1 + List_/Nil: List_ (List_/Nil) = λa (a List_/Nil/tag) - -Bool/True/tag: u24 -(Bool/True/tag) = 0 - -Bool/False/tag: u24 -(Bool/False/tag) = 1 - -List_/Cons/tag: u24 -(List_/Cons/tag) = 0 - -List_/Nil/tag: u24 -(List_/Nil/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_adt_unscoped_in_arm.bend.snap b/tests/snapshots/encode_pattern_match__match_adt_unscoped_in_arm.bend.snap index 2f78b566f..caeb781b2 100644 --- a/tests/snapshots/encode_pattern_match__match_adt_unscoped_in_arm.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_adt_unscoped_in_arm.bend.snap @@ -16,14 +16,14 @@ NumScott unchecked main: Any (main) = λ* λ$x $x +bool/T/tag: _ +(bool/T/tag) = 0 + bool/T: bool (bool/T) = λa (a bool/T/tag) +bool/F/tag: _ +(bool/F/tag) = 1 + bool/F: bool (bool/F) = λa (a bool/F/tag) - -bool/T/tag: u24 -(bool/T/tag) = 0 - -bool/F/tag: u24 -(bool/F/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_adt_unscoped_lambda.bend.snap b/tests/snapshots/encode_pattern_match__match_adt_unscoped_lambda.bend.snap index 74e369db9..d53c30f3c 100644 --- a/tests/snapshots/encode_pattern_match__match_adt_unscoped_lambda.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_adt_unscoped_lambda.bend.snap @@ -16,14 +16,14 @@ NumScott unchecked main: Any (main) = (Maybe/Some 1 λa switch a { 0: λ$x *; _: λ* λb b; } $x) +Maybe/None/tag: _ +(Maybe/None/tag) = 0 + Maybe/None: Maybe (Maybe/None) = λa (a Maybe/None/tag) +Maybe/Some/tag: _ +(Maybe/Some/tag) = 1 + Maybe/Some: (Any -> Maybe) (Maybe/Some) = λa λb (b Maybe/Some/tag a) - -Maybe/None/tag: u24 -(Maybe/None/tag) = 0 - -Maybe/Some/tag: u24 -(Maybe/Some/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_adt_unscoped_var.bend.snap b/tests/snapshots/encode_pattern_match__match_adt_unscoped_var.bend.snap index b983ba126..d79b401c3 100644 --- a/tests/snapshots/encode_pattern_match__match_adt_unscoped_var.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_adt_unscoped_var.bend.snap @@ -28,14 +28,14 @@ unchecked Bar: Any unchecked main: Any (main) = * +Maybe/None/tag: _ +(Maybe/None/tag) = 0 + Maybe/None: Maybe (Maybe/None) = λa (a Maybe/None/tag) +Maybe/Some/tag: _ +(Maybe/Some/tag) = 1 + Maybe/Some: (Any -> Maybe) (Maybe/Some) = λa λb (b Maybe/Some/tag a) - -Maybe/None/tag: u24 -(Maybe/None/tag) = 0 - -Maybe/Some/tag: u24 -(Maybe/Some/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_auto_linearization.bend.snap b/tests/snapshots/encode_pattern_match__match_auto_linearization.bend.snap index 0f9c26225..fed556488 100644 --- a/tests/snapshots/encode_pattern_match__match_auto_linearization.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_auto_linearization.bend.snap @@ -31,8 +31,8 @@ unchecked switch_shadowed_field: Any unchecked match_shadowed_field: Any (match_shadowed_field) = λa (a λb switch b { 0: λc λd (List/Cons c d); _: λ* λe λf λ* λ* (List/Cons e f); }) +List/Cons/tag: _ +(List/Cons/tag) = 1 + List/Cons: (T -> (List T) -> (List T)) (List/Cons) = λa λb λc (c List/Cons/tag a b) - -List/Cons/tag: u24 -(List/Cons/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_num_adt_tup_parser.bend.snap b/tests/snapshots/encode_pattern_match__match_num_adt_tup_parser.bend.snap index 6a7c7b57c..2920e8c4e 100644 --- a/tests/snapshots/encode_pattern_match__match_num_adt_tup_parser.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_num_adt_tup_parser.bend.snap @@ -28,26 +28,26 @@ unchecked Parse: Any unchecked main: Any (main) = (Parse * (String/Cons 40 (String/Cons 43 String/Nil)) λc switch c { 0: λd let (e, f, g) = d; (e, (Parse g f)); _: λ* λh (Result_/Err h); }) +String/Nil/tag: _ +(String/Nil/tag) = 0 + String/Nil: String (String/Nil) = λa (a String/Nil/tag) +String/Cons/tag: _ +(String/Cons/tag) = 1 + String/Cons: (u24 -> String -> String) (String/Cons) = λa λb λc (c String/Cons/tag a b) +Result_/Ok/tag: _ +(Result_/Ok/tag) = 0 + Result_/Ok: (Any -> Result_) (Result_/Ok) = λa λb (b Result_/Ok/tag a) +Result_/Err/tag: _ +(Result_/Err/tag) = 1 + Result_/Err: (Any -> Result_) (Result_/Err) = λa λb (b Result_/Err/tag a) - -String/Nil/tag: u24 -(String/Nil/tag) = 0 - -String/Cons/tag: u24 -(String/Cons/tag) = 1 - -Result_/Ok/tag: u24 -(Result_/Ok/tag) = 0 - -Result_/Err/tag: u24 -(Result_/Err/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__match_syntax.bend.snap b/tests/snapshots/encode_pattern_match__match_syntax.bend.snap index be146e147..066a1043b 100644 --- a/tests/snapshots/encode_pattern_match__match_syntax.bend.snap +++ b/tests/snapshots/encode_pattern_match__match_syntax.bend.snap @@ -16,14 +16,14 @@ NumScott unchecked head: Any (head) = λa (a λb switch b { 0: λc λ* c; _: λ* List_/Nil; }) +List_/Cons/tag: _ +(List_/Cons/tag) = 0 + List_/Cons: (Any -> Any -> List_) (List_/Cons) = λa λb λc (c List_/Cons/tag a b) +List_/Nil/tag: _ +(List_/Nil/tag) = 1 + List_/Nil: List_ (List_/Nil) = λa (a List_/Nil/tag) - -List_/Cons/tag: u24 -(List_/Cons/tag) = 0 - -List_/Nil/tag: u24 -(List_/Nil/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__non_matching_fst_arg.bend.snap b/tests/snapshots/encode_pattern_match__non_matching_fst_arg.bend.snap index b438c6c19..af6b4ef8f 100644 --- a/tests/snapshots/encode_pattern_match__non_matching_fst_arg.bend.snap +++ b/tests/snapshots/encode_pattern_match__non_matching_fst_arg.bend.snap @@ -16,14 +16,14 @@ NumScott unchecked Foo: Any (Foo) = λa λb (b λc switch c { 0: λd let {d d_2} = d; (Foo d d_2); _: λ* λe e; } a) +bool/true/tag: _ +(bool/true/tag) = 0 + bool/true: bool (bool/true) = λa (a bool/true/tag) +bool/false/tag: _ +(bool/false/tag) = 1 + bool/false: bool (bool/false) = λa (a bool/false/tag) - -bool/true/tag: u24 -(bool/true/tag) = 0 - -bool/false/tag: u24 -(bool/false/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__pattern_match_encoding.bend.snap b/tests/snapshots/encode_pattern_match__pattern_match_encoding.bend.snap index a28748f6b..e8c3994f0 100644 --- a/tests/snapshots/encode_pattern_match__pattern_match_encoding.bend.snap +++ b/tests/snapshots/encode_pattern_match__pattern_match_encoding.bend.snap @@ -31,32 +31,32 @@ unchecked Foo: Any unchecked main: Any (main) = (Foo MyType/A 2) +MyType/A/tag: _ +(MyType/A/tag) = 0 + MyType/A: (Any -> MyType) (MyType/A) = λa λb (b MyType/A/tag a) +MyType/B/tag: _ +(MyType/B/tag) = 1 + MyType/B: (Any -> MyType) (MyType/B) = λa λb (b MyType/B/tag a) +MyType/C/tag: _ +(MyType/C/tag) = 2 + MyType/C: (Any -> MyType) (MyType/C) = λa λb (b MyType/C/tag a) +MyType/D/tag: _ +(MyType/D/tag) = 3 + MyType/D: (Any -> Any -> MyType) (MyType/D) = λa λb λc (c MyType/D/tag a b) +MyType/E/tag: _ +(MyType/E/tag) = 4 + MyType/E: (Any -> Any -> MyType) (MyType/E) = λa λb λc (c MyType/E/tag a b) - -MyType/A/tag: u24 -(MyType/A/tag) = 0 - -MyType/B/tag: u24 -(MyType/B/tag) = 1 - -MyType/C/tag: u24 -(MyType/C/tag) = 2 - -MyType/D/tag: u24 -(MyType/D/tag) = 3 - -MyType/E/tag: u24 -(MyType/E/tag) = 4 diff --git a/tests/snapshots/encode_pattern_match__var_only.bend.snap b/tests/snapshots/encode_pattern_match__var_only.bend.snap index 8ef45eb22..9780a609b 100644 --- a/tests/snapshots/encode_pattern_match__var_only.bend.snap +++ b/tests/snapshots/encode_pattern_match__var_only.bend.snap @@ -22,14 +22,14 @@ unchecked Foo: Any unchecked main: Any (main) = λ* Foo +Bool/False/tag: _ +(Bool/False/tag) = 0 + Bool/False: Bool (Bool/False) = λa (a Bool/False/tag) +Bool/True/tag: _ +(Bool/True/tag) = 1 + Bool/True: Bool (Bool/True) = λa (a Bool/True/tag) - -Bool/False/tag: u24 -(Bool/False/tag) = 0 - -Bool/True/tag: u24 -(Bool/True/tag) = 1 diff --git a/tests/snapshots/encode_pattern_match__weekday.bend.snap b/tests/snapshots/encode_pattern_match__weekday.bend.snap index 4ab9c2349..3ecad5d11 100644 --- a/tests/snapshots/encode_pattern_match__weekday.bend.snap +++ b/tests/snapshots/encode_pattern_match__weekday.bend.snap @@ -31,44 +31,44 @@ NumScott unchecked main: Any (main) = (λa a Weekday/Saturday) +Weekday/Monday/tag: _ +(Weekday/Monday/tag) = 0 + Weekday/Monday: Weekday (Weekday/Monday) = λa (a Weekday/Monday/tag) +Weekday/Tuesday/tag: _ +(Weekday/Tuesday/tag) = 1 + Weekday/Tuesday: Weekday (Weekday/Tuesday) = λa (a Weekday/Tuesday/tag) +Weekday/Wednesday/tag: _ +(Weekday/Wednesday/tag) = 2 + Weekday/Wednesday: Weekday (Weekday/Wednesday) = λa (a Weekday/Wednesday/tag) +Weekday/Thursday/tag: _ +(Weekday/Thursday/tag) = 3 + Weekday/Thursday: Weekday (Weekday/Thursday) = λa (a Weekday/Thursday/tag) +Weekday/Friday/tag: _ +(Weekday/Friday/tag) = 4 + Weekday/Friday: Weekday (Weekday/Friday) = λa (a Weekday/Friday/tag) +Weekday/Saturday/tag: _ +(Weekday/Saturday/tag) = 5 + Weekday/Saturday: Weekday (Weekday/Saturday) = λa (a Weekday/Saturday/tag) +Weekday/Sunday/tag: _ +(Weekday/Sunday/tag) = 6 + Weekday/Sunday: Weekday (Weekday/Sunday) = λa (a Weekday/Sunday/tag) - -Weekday/Monday/tag: u24 -(Weekday/Monday/tag) = 0 - -Weekday/Tuesday/tag: u24 -(Weekday/Tuesday/tag) = 1 - -Weekday/Wednesday/tag: u24 -(Weekday/Wednesday/tag) = 2 - -Weekday/Thursday/tag: u24 -(Weekday/Thursday/tag) = 3 - -Weekday/Friday/tag: u24 -(Weekday/Friday/tag) = 4 - -Weekday/Saturday/tag: u24 -(Weekday/Saturday/tag) = 5 - -Weekday/Sunday/tag: u24 -(Weekday/Sunday/tag) = 6 diff --git a/tests/snapshots/parse_file__imp_map.bend.snap b/tests/snapshots/parse_file__imp_map.bend.snap index 053384a3c..0aec833ca 100644 --- a/tests/snapshots/parse_file__imp_map.bend.snap +++ b/tests/snapshots/parse_file__imp_map.bend.snap @@ -17,14 +17,14 @@ unreachable: Any unchecked main: Any (main) = let x = (Map/set (Map/set Map/empty 2 1) 3 2); let (map/get%1, x) = (Map/get x 2); let y = (id map/get%1); let z = 4; let x = (Map/set x z 4); let (map/get%0, x) = (Map/get x z); (+ y map/get%0) +Map/Node/tag: _ +(Map/Node/tag) = 0 + Map/Node: (T -> (Map T) -> (Map T) -> (Map T)) (Map/Node) = λvalue λleft λright λ%x (%x Map/Node/tag value left right) +Map/Leaf/tag: _ +(Map/Leaf/tag) = 1 + Map/Leaf: (Map T) (Map/Leaf) = λ%x (%x Map/Leaf/tag) - -Map/Node/tag: u24 -(Map/Node/tag) = 0 - -Map/Leaf/tag: u24 -(Map/Leaf/tag) = 1 diff --git a/tests/snapshots/parse_file__imp_program.bend.snap b/tests/snapshots/parse_file__imp_program.bend.snap index 88f5b969d..6ff1327a6 100644 --- a/tests/snapshots/parse_file__imp_program.bend.snap +++ b/tests/snapshots/parse_file__imp_program.bend.snap @@ -59,44 +59,44 @@ unchecked sup: Any unchecked main: Any (main) = with IO { ask x = IO.read; x } +List/Nil/tag: _ +(List/Nil/tag) = 0 + List/Nil: (List T) (List/Nil) = λ%x (%x List/Nil/tag) +List/Cons/tag: _ +(List/Cons/tag) = 1 + List/Cons: (T -> (List T) -> (List T)) (List/Cons) = λhead λtail λ%x (%x List/Cons/tag head tail) +Map/Node/tag: _ +(Map/Node/tag) = 0 + Map/Node: (T -> (Map T) -> (Map T) -> (Map T)) (Map/Node) = λvalue λleft λright λ%x (%x Map/Node/tag value left right) +Map/Leaf/tag: _ +(Map/Leaf/tag) = 1 + Map/Leaf: (Map T) (Map/Leaf) = λ%x (%x Map/Leaf/tag) +Point/Point/tag: _ +(Point/Point/tag) = 0 + Point/Point: (Any -> Any -> Point) (Point/Point) = λx λy λ%x (%x Point/Point/tag x y) +Bool/True/tag: _ +(Bool/True/tag) = 0 + Bool/True: Bool (Bool/True) = λ%x (%x Bool/True/tag) +Bool/False/tag: _ +(Bool/False/tag) = 1 + Bool/False: Bool (Bool/False) = λ%x (%x Bool/False/tag) - -List/Nil/tag: u24 -(List/Nil/tag) = 0 - -List/Cons/tag: u24 -(List/Cons/tag) = 1 - -Map/Node/tag: u24 -(Map/Node/tag) = 0 - -Map/Leaf/tag: u24 -(Map/Leaf/tag) = 1 - -Point/Point/tag: u24 -(Point/Point/tag) = 0 - -Bool/True/tag: u24 -(Bool/True/tag) = 0 - -Bool/False/tag: u24 -(Bool/False/tag) = 1 diff --git a/tests/snapshots/parse_file__multi_line_comment.bend.snap b/tests/snapshots/parse_file__multi_line_comment.bend.snap index 9c672edde..dc7378cb4 100644 --- a/tests/snapshots/parse_file__multi_line_comment.bend.snap +++ b/tests/snapshots/parse_file__multi_line_comment.bend.snap @@ -14,20 +14,20 @@ unchecked main: Any unchecked String/not_empty: (Any -> Any) (String/not_empty s) = match s = s { String/Nil: 0; String/Cons: 1; } +Foo/Foo/tag: _ +(Foo/Foo/tag) = 0 + Foo/Foo: (Any -> Foo) (Foo/Foo) = λfoo λ%x (%x Foo/Foo/tag foo) +Bar/tag: _ +(Bar/tag) = 0 + Bar: (Any -> Bar) (Bar) = λbar λ%x (%x Bar/tag bar) +V/V/tag: _ +(V/V/tag) = 0 + V/V: V (V/V) = λ%x (%x V/V/tag) - -Foo/Foo/tag: u24 -(Foo/Foo/tag) = 0 - -Bar/tag: u24 -(Bar/tag) = 0 - -V/V/tag: u24 -(V/V/tag) = 0 diff --git a/tests/snapshots/parse_file__scape_chars.bend.snap b/tests/snapshots/parse_file__scape_chars.bend.snap index 8d84f22fa..bfd382e0b 100644 --- a/tests/snapshots/parse_file__scape_chars.bend.snap +++ b/tests/snapshots/parse_file__scape_chars.bend.snap @@ -5,14 +5,14 @@ input_file: tests/golden_tests/parse_file/scape_chars.bend unchecked main: Any (main) = (String/Cons 92 (String/Cons 32 (String/Cons 10 (String/Cons 32 (String/Cons 9 (String/Cons 32 (String/Cons 34 String/Nil))))))) +String/Nil/tag: _ +(String/Nil/tag) = 0 + String/Nil: String (String/Nil) = λ%x (%x String/Nil/tag) +String/Cons/tag: _ +(String/Cons/tag) = 1 + String/Cons: (u24 -> String -> String) (String/Cons) = λhead λtail λ%x (%x String/Cons/tag head tail) - -String/Nil/tag: u24 -(String/Nil/tag) = 0 - -String/Cons/tag: u24 -(String/Cons/tag) = 1 diff --git a/tests/snapshots/parse_file__tuple_need_parens.bend.snap b/tests/snapshots/parse_file__tuple_need_parens.bend.snap index 9b8c1fcb4..f0e136d87 100644 --- a/tests/snapshots/parse_file__tuple_need_parens.bend.snap +++ b/tests/snapshots/parse_file__tuple_need_parens.bend.snap @@ -5,14 +5,14 @@ input_file: tests/golden_tests/parse_file/tuple_need_parens.bend unchecked main: Any (main) = switch %pred = (1, 2) { 0: (String/Cons 104 (String/Cons 109 (String/Cons 109 (String/Cons 109 String/Nil)))); _ %pred-1: (String/Cons 110 (String/Cons 111 (String/Cons 116 String/Nil))); } +String/Nil/tag: _ +(String/Nil/tag) = 0 + String/Nil: String (String/Nil) = λ%x (%x String/Nil/tag) +String/Cons/tag: _ +(String/Cons/tag) = 1 + String/Cons: (u24 -> String -> String) (String/Cons) = λhead λtail λ%x (%x String/Cons/tag head tail) - -String/Nil/tag: u24 -(String/Nil/tag) = 0 - -String/Cons/tag: u24 -(String/Cons/tag) = 1 diff --git a/tests/snapshots/simplify_matches__adt_tup_era.bend.snap b/tests/snapshots/simplify_matches__adt_tup_era.bend.snap index 323df4bdb..8666664b2 100644 --- a/tests/snapshots/simplify_matches__adt_tup_era.bend.snap +++ b/tests/snapshots/simplify_matches__adt_tup_era.bend.snap @@ -8,8 +8,8 @@ unchecked Foo: Any unchecked Main: Any (Main) = (Foo (Tuple/Pair 1 5)) +Tuple/Pair/tag: _ +(Tuple/Pair/tag) = 0 + Tuple/Pair: (Any -> Any -> Tuple) (Tuple/Pair) = λa λb λc (c Tuple/Pair/tag a b) - -Tuple/Pair/tag: u24 -(Tuple/Pair/tag) = 0 diff --git a/tests/snapshots/simplify_matches__already_flat.bend.snap b/tests/snapshots/simplify_matches__already_flat.bend.snap index 276be4380..c6e0ba5c2 100644 --- a/tests/snapshots/simplify_matches__already_flat.bend.snap +++ b/tests/snapshots/simplify_matches__already_flat.bend.snap @@ -20,56 +20,56 @@ unchecked Rule5: Any unchecked Rule6: Any (Rule6) = λa a +Foo/CtrA/tag: _ +(Foo/CtrA/tag) = 0 + Foo/CtrA: Foo (Foo/CtrA) = λa (a Foo/CtrA/tag) +Foo/CtrB/tag: _ +(Foo/CtrB/tag) = 1 + Foo/CtrB: (Any -> Foo) (Foo/CtrB) = λa λb (b Foo/CtrB/tag a) +Bar/CtrA1/tag: _ +(Bar/CtrA1/tag) = 0 + Bar/CtrA1: (Any -> Bar) (Bar/CtrA1) = λa λb (b Bar/CtrA1/tag a) +Bar/CtrA2/tag: _ +(Bar/CtrA2/tag) = 1 + Bar/CtrA2: (Any -> Any -> Bar) (Bar/CtrA2) = λa λb λc (c Bar/CtrA2/tag a b) +Bar/CtrA3/tag: _ +(Bar/CtrA3/tag) = 2 + Bar/CtrA3: (Any -> Bar) (Bar/CtrA3) = λa λb (b Bar/CtrA3/tag a) +Baz/CtrB0/tag: _ +(Baz/CtrB0/tag) = 0 + Baz/CtrB0: Baz (Baz/CtrB0) = λa (a Baz/CtrB0/tag) +Baz/CtrB1/tag: _ +(Baz/CtrB1/tag) = 1 + Baz/CtrB1: (Any -> Baz) (Baz/CtrB1) = λa λb (b Baz/CtrB1/tag a) +Baz/CtrB2/tag: _ +(Baz/CtrB2/tag) = 2 + Baz/CtrB2: (Any -> Baz) (Baz/CtrB2) = λa λb (b Baz/CtrB2/tag a) +Baz/CtrB3/tag: _ +(Baz/CtrB3/tag) = 3 + Baz/CtrB3: (Any -> Baz) (Baz/CtrB3) = λa λb (b Baz/CtrB3/tag a) - -Foo/CtrA/tag: u24 -(Foo/CtrA/tag) = 0 - -Foo/CtrB/tag: u24 -(Foo/CtrB/tag) = 1 - -Bar/CtrA1/tag: u24 -(Bar/CtrA1/tag) = 0 - -Bar/CtrA2/tag: u24 -(Bar/CtrA2/tag) = 1 - -Bar/CtrA3/tag: u24 -(Bar/CtrA3/tag) = 2 - -Baz/CtrB0/tag: u24 -(Baz/CtrB0/tag) = 0 - -Baz/CtrB1/tag: u24 -(Baz/CtrB1/tag) = 1 - -Baz/CtrB2/tag: u24 -(Baz/CtrB2/tag) = 2 - -Baz/CtrB3/tag: u24 -(Baz/CtrB3/tag) = 3 diff --git a/tests/snapshots/simplify_matches__bits_dec.bend.snap b/tests/snapshots/simplify_matches__bits_dec.bend.snap index 12adb4c6b..d561067c0 100644 --- a/tests/snapshots/simplify_matches__bits_dec.bend.snap +++ b/tests/snapshots/simplify_matches__bits_dec.bend.snap @@ -5,20 +5,20 @@ input_file: tests/golden_tests/simplify_matches/bits_dec.bend unchecked Data.Bits.dec: Any (Data.Bits.dec) = λa match a { Data/Bits/e: Data/Bits/e; Data/Bits/o b: match b { Data/Bits/e: Data/Bits/e; Data/Bits/o c: (Data/Bits/i (Data.Bits.dec c)); Data/Bits/i d: (Data/Bits/i (Data.Bits.dec d)); }; Data/Bits/i e: match e { Data/Bits/e: (Data/Bits/o Data/Bits/e); Data/Bits/o f: (Data/Bits/o f); Data/Bits/i g: (Data/Bits/o g); }; } +Data/Bits/e/tag: _ +(Data/Bits/e/tag) = 0 + Data/Bits/e: Data/Bits (Data/Bits/e) = λa (a Data/Bits/e/tag) +Data/Bits/o/tag: _ +(Data/Bits/o/tag) = 1 + Data/Bits/o: (Any -> Data/Bits) (Data/Bits/o) = λa λb (b Data/Bits/o/tag a) +Data/Bits/i/tag: _ +(Data/Bits/i/tag) = 2 + Data/Bits/i: (Any -> Data/Bits) (Data/Bits/i) = λa λb (b Data/Bits/i/tag a) - -Data/Bits/e/tag: u24 -(Data/Bits/e/tag) = 0 - -Data/Bits/o/tag: u24 -(Data/Bits/o/tag) = 1 - -Data/Bits/i/tag: u24 -(Data/Bits/i/tag) = 2 diff --git a/tests/snapshots/simplify_matches__complex_with_case.bend.snap b/tests/snapshots/simplify_matches__complex_with_case.bend.snap index e21173c2e..79fee2de3 100644 --- a/tests/snapshots/simplify_matches__complex_with_case.bend.snap +++ b/tests/snapshots/simplify_matches__complex_with_case.bend.snap @@ -8,14 +8,14 @@ unchecked map: Any unchecked main: Any (main) = map +Tree_/Node/tag: _ +(Tree_/Node/tag) = 0 + Tree_/Node: (Any -> Any -> Any -> Any -> Tree_) (Tree_/Node) = λa λb λc λd λe (e Tree_/Node/tag a b c d) +Tree_/Leaf/tag: _ +(Tree_/Leaf/tag) = 1 + Tree_/Leaf: (Any -> Tree_) (Tree_/Leaf) = λa λb (b Tree_/Leaf/tag a) - -Tree_/Node/tag: u24 -(Tree_/Node/tag) = 0 - -Tree_/Leaf/tag: u24 -(Tree_/Leaf/tag) = 1 diff --git a/tests/snapshots/simplify_matches__double_unwrap_box.bend.snap b/tests/snapshots/simplify_matches__double_unwrap_box.bend.snap index de945c1f6..d3856a5f3 100644 --- a/tests/snapshots/simplify_matches__double_unwrap_box.bend.snap +++ b/tests/snapshots/simplify_matches__double_unwrap_box.bend.snap @@ -8,8 +8,8 @@ unchecked DoubleUnbox: Any unchecked Main: Any (Main) = (DoubleUnbox (Boxed/Box (Boxed/Box 0)) 5) +Boxed/Box/tag: _ +(Boxed/Box/tag) = 0 + Boxed/Box: (Any -> Boxed) (Boxed/Box) = λa λb (b Boxed/Box/tag a) - -Boxed/Box/tag: u24 -(Boxed/Box/tag) = 0 diff --git a/tests/snapshots/simplify_matches__double_unwrap_maybe.bend.snap b/tests/snapshots/simplify_matches__double_unwrap_maybe.bend.snap index 12acb88c8..601e2008e 100644 --- a/tests/snapshots/simplify_matches__double_unwrap_maybe.bend.snap +++ b/tests/snapshots/simplify_matches__double_unwrap_maybe.bend.snap @@ -8,14 +8,14 @@ unchecked DoubleUnwrap: Any unchecked Main: Any (Main) = (DoubleUnwrap (Maybe/Some Maybe/None) 5) +Maybe/Some/tag: _ +(Maybe/Some/tag) = 0 + Maybe/Some: (Any -> Maybe) (Maybe/Some) = λa λb (b Maybe/Some/tag a) +Maybe/None/tag: _ +(Maybe/None/tag) = 1 + Maybe/None: Maybe (Maybe/None) = λa (a Maybe/None/tag) - -Maybe/Some/tag: u24 -(Maybe/Some/tag) = 0 - -Maybe/None/tag: u24 -(Maybe/None/tag) = 1 diff --git a/tests/snapshots/simplify_matches__flatten_with_terminal.bend.snap b/tests/snapshots/simplify_matches__flatten_with_terminal.bend.snap index addcb36b1..3a9483fd6 100644 --- a/tests/snapshots/simplify_matches__flatten_with_terminal.bend.snap +++ b/tests/snapshots/simplify_matches__flatten_with_terminal.bend.snap @@ -8,14 +8,14 @@ unchecked Foo: Any unchecked main: Any (main) = (Foo 2 (A_t/A B_t/B)) +A_t/A/tag: _ +(A_t/A/tag) = 0 + A_t/A: (Any -> A_t) (A_t/A) = λa λb (b A_t/A/tag a) +B_t/B/tag: _ +(B_t/B/tag) = 0 + B_t/B: B_t (B_t/B) = λa (a B_t/B/tag) - -A_t/A/tag: u24 -(A_t/A/tag) = 0 - -B_t/B/tag: u24 -(B_t/B/tag) = 0 diff --git a/tests/snapshots/simplify_matches__linearize_match_all.bend.snap b/tests/snapshots/simplify_matches__linearize_match_all.bend.snap index 5e74ffce1..4016e9bdf 100644 --- a/tests/snapshots/simplify_matches__linearize_match_all.bend.snap +++ b/tests/snapshots/simplify_matches__linearize_match_all.bend.snap @@ -32,14 +32,14 @@ unchecked D2: Any unchecked main: Any (main) = * +ConsList/Cons/tag: _ +(ConsList/Cons/tag) = 0 + ConsList/Cons: (Any -> Any -> ConsList) (ConsList/Cons) = λa λb λc (c ConsList/Cons/tag a b) +ConsList/Nil/tag: _ +(ConsList/Nil/tag) = 1 + ConsList/Nil: ConsList (ConsList/Nil) = λa (a ConsList/Nil/tag) - -ConsList/Cons/tag: u24 -(ConsList/Cons/tag) = 0 - -ConsList/Nil/tag: u24 -(ConsList/Nil/tag) = 1 diff --git a/tests/snapshots/simplify_matches__nested.bend.snap b/tests/snapshots/simplify_matches__nested.bend.snap index 0f4e03554..36a661f72 100644 --- a/tests/snapshots/simplify_matches__nested.bend.snap +++ b/tests/snapshots/simplify_matches__nested.bend.snap @@ -5,32 +5,32 @@ input_file: tests/golden_tests/simplify_matches/nested.bend unchecked Rule: Any (Rule) = λa match a { Foo/CtrA b c: (match c { Bar/CtrB1 d: λe (e d); Bar/CtrB2 f g: λh (match f { Baz/CtrC: λi λj (i j); } h g); } b); Foo/CtrB k: k; } +Foo/CtrA/tag: _ +(Foo/CtrA/tag) = 0 + Foo/CtrA: (Any -> Any -> Foo) (Foo/CtrA) = λa λb λc (c Foo/CtrA/tag a b) +Foo/CtrB/tag: _ +(Foo/CtrB/tag) = 1 + Foo/CtrB: (Any -> Foo) (Foo/CtrB) = λa λb (b Foo/CtrB/tag a) +Bar/CtrB1/tag: _ +(Bar/CtrB1/tag) = 0 + Bar/CtrB1: (Any -> Bar) (Bar/CtrB1) = λa λb (b Bar/CtrB1/tag a) +Bar/CtrB2/tag: _ +(Bar/CtrB2/tag) = 1 + Bar/CtrB2: (Any -> Any -> Bar) (Bar/CtrB2) = λa λb λc (c Bar/CtrB2/tag a b) +Baz/CtrC/tag: _ +(Baz/CtrC/tag) = 0 + Baz/CtrC: Baz (Baz/CtrC) = λa (a Baz/CtrC/tag) - -Foo/CtrA/tag: u24 -(Foo/CtrA/tag) = 0 - -Foo/CtrB/tag: u24 -(Foo/CtrB/tag) = 1 - -Bar/CtrB1/tag: u24 -(Bar/CtrB1/tag) = 0 - -Bar/CtrB2/tag: u24 -(Bar/CtrB2/tag) = 1 - -Baz/CtrC/tag: u24 -(Baz/CtrC/tag) = 0 diff --git a/tests/snapshots/simplify_matches__nested2.bend.snap b/tests/snapshots/simplify_matches__nested2.bend.snap index 1ec4282ea..5cc7538aa 100644 --- a/tests/snapshots/simplify_matches__nested2.bend.snap +++ b/tests/snapshots/simplify_matches__nested2.bend.snap @@ -5,14 +5,14 @@ input_file: tests/golden_tests/simplify_matches/nested2.bend unchecked Foo: Any (Foo) = λa λb (match b { List/Nil: λc (c List/Nil); List/Cons d e: λf (match e { List/Nil: λg λh (g (List/Cons h List/Nil)); List/Cons i j: λk λl (k l i j); } f d); } a) +List/Nil/tag: _ +(List/Nil/tag) = 0 + List/Nil: (List T) (List/Nil) = λa (a List/Nil/tag) +List/Cons/tag: _ +(List/Cons/tag) = 1 + List/Cons: (T -> (List T) -> (List T)) (List/Cons) = λa λb λc (c List/Cons/tag a b) - -List/Nil/tag: u24 -(List/Nil/tag) = 0 - -List/Cons/tag: u24 -(List/Cons/tag) = 1 diff --git a/tests/snapshots/simplify_matches__nested_0ary.bend.snap b/tests/snapshots/simplify_matches__nested_0ary.bend.snap index 60efc52cc..1e7083939 100644 --- a/tests/snapshots/simplify_matches__nested_0ary.bend.snap +++ b/tests/snapshots/simplify_matches__nested_0ary.bend.snap @@ -5,14 +5,14 @@ input_file: tests/golden_tests/simplify_matches/nested_0ary.bend unchecked Unpack: Any (Unpack) = λa λb (match b { list/Cons c d: λe (match d { list/Cons f g: λh λi (h (list/Cons i (list/Cons f g))); list/Nil: λj λk k; } e c); list/Nil: λl list/Nil; } a) +list/Cons/tag: _ +(list/Cons/tag) = 0 + list/Cons: (Any -> Any -> list) (list/Cons) = λa λb λc (c list/Cons/tag a b) +list/Nil/tag: _ +(list/Nil/tag) = 1 + list/Nil: list (list/Nil) = λa (a list/Nil/tag) - -list/Cons/tag: u24 -(list/Cons/tag) = 0 - -list/Nil/tag: u24 -(list/Nil/tag) = 1