From 9717747a544d2e7804b1b92a556a31c5fd7f4656 Mon Sep 17 00:00:00 2001 From: kilianv Date: Wed, 14 Sep 2022 20:47:17 +0200 Subject: [PATCH] Update tests not all tests pass yet. Will look at them with Ayaz. --- crates/compiler/solve/tests/solve_expr.rs | 32 ++++---- crates/compiler/test_gen/src/gen_compare.rs | 8 +- crates/compiler/test_gen/src/gen_list.rs | 55 ++++++-------- crates/compiler/test_gen/src/gen_num.rs | 2 +- .../compiler/test_gen/src/gen_primitives.rs | 76 ++++++++++--------- crates/compiler/test_gen/src/gen_records.rs | 8 +- crates/compiler/test_gen/src/gen_refcount.rs | 2 +- crates/compiler/test_gen/src/gen_result.rs | 2 +- crates/compiler/test_gen/src/gen_tags.rs | 62 +++++++-------- .../compiler/test_mono/generated/encode.txt | 8 +- .../generated/guard_pattern_true.txt | 42 +++++----- .../if_guard_bind_variable_false.txt | 4 +- .../test_mono/generated/if_multi_branch.txt | 28 ++++--- .../test_mono/generated/ir_when_idiv.txt | 20 ++--- .../compiler/test_mono/generated/is_nil.txt | 36 +++++---- .../test_mono/generated/issue_3669.txt | 4 +- .../test_mono/generated/list_append.txt | 8 +- .../generated/list_append_closure.txt | 8 +- .../test_mono/generated/monomorphized_tag.txt | 7 +- .../monomorphized_tag_with_aliased_args.txt | 18 +++-- .../recursive_call_capturing_function.txt | 30 ++++---- .../test_mono/generated/simple_if.txt | 16 ++-- .../generated/specialize_closures.txt | 51 +++++++------ .../generated/specialize_lowlevel.txt | 40 +++++----- crates/compiler/test_mono/src/tests.rs | 38 +++++----- 25 files changed, 321 insertions(+), 284 deletions(-) diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs index bef37cf3e6..91808ecf54 100644 --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -1385,7 +1385,7 @@ mod solve_expr { infer_eq( indoc!( r#" - if True then + if Bool.true then 42 else 24 @@ -3812,7 +3812,7 @@ mod solve_expr { when x is 2 | 3 -> 0 a if a < 20 -> 1 - 3 | 4 if False -> 2 + 3 | 4 if Bool.false -> 2 _ -> 3 "# ), @@ -4054,7 +4054,7 @@ mod solve_expr { r#" \rec -> { x, y } : { x : I64, y ? Bool }* - { x, y ? False } = rec + { x, y ? Bool.false } = rec { x, y } "# @@ -5015,7 +5015,7 @@ mod solve_expr { infer_eq_without_problem( indoc!( r#" - badComics: Bool -> [CowTools _, Thagomizer _] + badComics: [True, False] -> [CowTools _, Thagomizer _] badComics = \c -> when c is True -> CowTools "The Far Side" @@ -5023,7 +5023,7 @@ mod solve_expr { badComics "# ), - "Bool -> [CowTools Str, Thagomizer Str]", + "[False, True] -> [CowTools Str, Thagomizer Str]", ) } @@ -5929,7 +5929,7 @@ mod solve_expr { infer_eq_without_problem( indoc!( r#" - if True then List.first [] else Str.toI64 "" + if Bool.true then List.first [] else Str.toI64 "" "# ), "Result I64 [InvalidNumStr, ListWasEmpty]*", @@ -6220,7 +6220,7 @@ mod solve_expr { r#" app "test" provides [foo] to "./platform" - foo : Bool -> Str + foo : [True, False] -> Str foo = \ob -> # ^^ when ob is @@ -6232,8 +6232,8 @@ mod solve_expr { "# ), @r###" - ob : Bool - ob : Bool + ob : [False, True] + ob : [False, True] True : [False, True] False : [False, True] "### @@ -6912,7 +6912,7 @@ mod solve_expr { indoc!( r#" f : _ -> _ - f = \_ -> if False then "" else f "" + f = \_ -> if Bool.false then "" else f "" f "# @@ -6928,7 +6928,7 @@ mod solve_expr { r#" f : _ -> Str f = \s -> g s - g = \s -> if True then s else f s + g = \s -> if Bool.true then s else f s g "# @@ -7430,7 +7430,7 @@ mod solve_expr { # ^^ (f A (@C {}) (@D {})) # ^ - if True + if Bool.true then it (@E {}) # ^^ else it (@F {}) @@ -7741,8 +7741,8 @@ mod solve_expr { infer_queries!( indoc!( r#" - x = True - y = False + x = Bool.true + y = Bool.false a = "foo" b = "bar" @@ -7756,8 +7756,8 @@ mod solve_expr { "# ), @r###" - foo : {} -[[foo(5) [True]* [False]* Str Str]]-> Str - bar : {} -[[bar(6) [True]* [False]* Str Str]]-> Str + foo : {} -[[foo(5) Bool Bool Str Str]]-> Str + bar : {} -[[bar(6) Bool Bool Str Str]]-> Str "### ); } diff --git a/crates/compiler/test_gen/src/gen_compare.rs b/crates/compiler/test_gen/src/gen_compare.rs index 31db80dddd..eaa780d018 100644 --- a/crates/compiler/test_gen/src/gen_compare.rs +++ b/crates/compiler/test_gen/src/gen_compare.rs @@ -118,9 +118,9 @@ fn eq_bool_tag() { indoc!( r#" true : Bool - true = True + true = Bool.true - true == True + true == Bool.rue "# ), true, @@ -135,9 +135,9 @@ fn neq_bool_tag() { indoc!( r#" true : Bool - true = True + true = Bool.true - true == False + true == Bool.false "# ), false, diff --git a/crates/compiler/test_gen/src/gen_list.rs b/crates/compiler/test_gen/src/gen_list.rs index 68b08156e6..10116a75d8 100644 --- a/crates/compiler/test_gen/src/gen_list.rs +++ b/crates/compiler/test_gen/src/gen_list.rs @@ -54,15 +54,10 @@ fn int_list_literal() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn bool_list_literal() { - // NOTE: make sure to explicitly declare the elements to be of type bool, or - // use both True and False; only using one of them causes the list to in practice be - // of type `List [True]` or `List [False]`, those are tag unions with one constructor - // and not fields, and don't have a runtime representation. assert_evals_to!( indoc!( r#" - false : Bool - false = False + false = Bool.false [false] "# @@ -72,7 +67,7 @@ fn bool_list_literal() { ); assert_evals_to!( - "[True, False, True]", + "[Bool.true, Bool.false, Bool.true]", RocList::from_slice(&[true, false, true]), RocList ); @@ -81,7 +76,7 @@ fn bool_list_literal() { indoc!( r#" false : Bool - false = False + false = Bool.false [false] "# @@ -94,7 +89,7 @@ fn bool_list_literal() { indoc!( r#" true : Bool - true = True + true = Bool.true List.repeat true 23 "# @@ -107,7 +102,7 @@ fn bool_list_literal() { indoc!( r#" true : Bool - true = True + true = Bool.true List.repeat { x: true, y: true } 23 "# @@ -120,7 +115,7 @@ fn bool_list_literal() { indoc!( r#" true : Bool - true = True + true = Bool.true List.repeat { x: true, y: true, a: true, b: true, c: true, d : true, e: true, f: true } 23 "# @@ -501,7 +496,7 @@ fn list_drop_at_shared() { indoc!( r#" list : List I64 - list = [if True then 4 else 4, 5, 6] + list = [if Bool.true then 4 else 4, 5, 6] { newList: List.dropAt list 0, original: list } "# @@ -525,7 +520,7 @@ fn list_drop_if_empty_list_of_int() { empty : List I64 empty = [] - List.dropIf empty \_ -> True + List.dropIf empty \_ -> Bool.true "# ), RocList::::from_slice(&[]), @@ -540,7 +535,7 @@ fn list_drop_if_empty_list() { indoc!( r#" alwaysTrue : I64 -> Bool - alwaysTrue = \_ -> True + alwaysTrue = \_ -> Bool.true List.dropIf [] alwaysTrue "# @@ -556,7 +551,7 @@ fn list_drop_if_always_false_for_non_empty_list() { assert_evals_to!( indoc!( r#" - List.dropIf [1,2,3,4,5,6,7,8] (\_ -> False) + List.dropIf [1,2,3,4,5,6,7,8] (\_ -> Bool.false) "# ), RocList::from_slice(&[1, 2, 3, 4, 5, 6, 7, 8]), @@ -570,7 +565,7 @@ fn list_drop_if_always_true_for_non_empty_list() { assert_evals_to!( indoc!( r#" - List.dropIf [1,2,3,4,5,6,7,8] (\_ -> True) + List.dropIf [1,2,3,4,5,6,7,8] (\_ -> Bool.true) "# ), RocList::::from_slice(&[]), @@ -633,7 +628,7 @@ fn list_drop_last_mutable() { indoc!( r#" list : List I64 - list = [if True then 4 else 4, 5, 6] + list = [if Bool.true then 4 else 4, 5, 6] { newList: List.dropLast list, original: list } "# @@ -732,7 +727,7 @@ fn list_append_to_empty_list_of_int() { #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn list_append_bools() { assert_evals_to!( - "List.append [True, False] True", + "List.append [Bool.true, Bool.false] Bool.true", RocList::from_slice(&[true, false, true]), RocList ); @@ -791,7 +786,7 @@ fn list_prepend() { #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn list_prepend_bools() { assert_evals_to!( - "List.prepend [True, False] True", + "List.prepend [Bool.true, Bool.false] Bool.true", RocList::from_slice(&[true, true, false]), RocList ); @@ -969,7 +964,7 @@ fn list_keep_if_empty_list_of_int() { empty = [] - List.keepIf empty \_ -> True + List.keepIf empty \_ -> Bool.true "# ), RocList::::from_slice(&[]), @@ -985,7 +980,7 @@ fn list_keep_if_empty_list() { r#" alwaysTrue : I64 -> Bool alwaysTrue = \_ -> - True + Bool.true List.keepIf [] alwaysTrue @@ -1004,7 +999,7 @@ fn list_keep_if_always_true_for_non_empty_list() { r#" alwaysTrue : I64 -> Bool alwaysTrue = \_ -> - True + Bool.true oneThroughEight : List I64 oneThroughEight = @@ -1026,7 +1021,7 @@ fn list_keep_if_always_false_for_non_empty_list() { r#" alwaysFalse : I64 -> Bool alwaysFalse = \_ -> - False + Bool.false List.keepIf [1,2,3,4,5,6,7,8] alwaysFalse "# @@ -2306,7 +2301,7 @@ fn quicksort() { partitionHelp : Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))] partitionHelp = \i, j, list, high, pivot -> # if j < high then - if False then + if Bool.false then when List.get list j is Ok value -> if value <= pivot then @@ -2789,7 +2784,7 @@ fn list_any() { #[test] #[cfg(any(feature = "gen-llvm"))] fn list_any_empty_with_unknown_element_type() { - assert_evals_to!("List.any [] (\\_ -> True)", false, bool); + assert_evals_to!("List.any [] (\\_ -> Bool.true)", false, bool); } #[test] @@ -2804,7 +2799,7 @@ fn list_all() { #[test] #[cfg(any(feature = "gen-llvm"))] fn list_all_empty_with_unknown_element_type() { - assert_evals_to!("List.all [] (\\_ -> True)", true, bool); + assert_evals_to!("List.all [] (\\_ -> Bool.true)", true, bool); } #[test] @@ -2823,7 +2818,7 @@ fn lists_with_incompatible_type_param_in_if() { list2 = [""] - x = if True then list1 else list2 + x = if Bool.true then list1 else list2 "" "# @@ -2862,7 +2857,7 @@ fn empty_list_of_function_type() { myClosure = \_ -> "bar" choose = - if False then + if Bool.false then myList else [myClosure] @@ -3001,7 +2996,7 @@ fn list_find_empty_layout() { assert_evals_to!( indoc!( r#" - List.findFirst [] \_ -> True + List.findFirst [] \_ -> Bool.true "# ), RocResult::err(()), @@ -3011,7 +3006,7 @@ fn list_find_empty_layout() { assert_evals_to!( indoc!( r#" - List.findLast [] \_ -> True + List.findLast [] \_ -> Bool.true "# ), RocResult::err(()), diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index d6d32c986a..045ae3dd5d 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -3800,7 +3800,7 @@ fn condition_polymorphic_num_becomes_float() { assert_evals_to!( indoc!( r#" - x = if True then 2 else 3 + x = if Bool.true then 2 else 3 x * 5f32 "# ), diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index 50031f4a6e..dba4f0d594 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -983,7 +983,7 @@ fn undefined_variable() { assert_evals_to!( indoc!( r#" - if True then + if Bool.true then x + z else y + z @@ -1262,10 +1262,10 @@ fn linked_list_is_singleton() { isSingleton = \list -> when list is Cons _ Nil -> - True + Bool.true _ -> - False + Bool.false main : Bool main = @@ -1297,10 +1297,10 @@ fn linked_list_is_empty_1() { isEmpty = \list -> when list is Cons _ _ -> - False + Bool.false Nil -> - True + Bool.true main : Bool main = @@ -1329,10 +1329,10 @@ fn linked_list_is_empty_2() { isEmpty = \list -> when list is Cons _ _ -> - False + Bool.false Nil -> - True + Bool.true main : Bool main = @@ -2006,9 +2006,9 @@ fn hof_conditional() { assert_evals_to!( indoc!( r#" - passTrue = \f -> f True + passTrue = \f -> f Bool.true - passTrue (\trueVal -> if trueVal then False else True) + passTrue (\trueVal -> if trueVal then Bool.false else Bool.true) "# ), 0, @@ -2087,8 +2087,8 @@ fn fingertree_basic() { main : Bool main = when cons 0x1 Nil is - Unit 1 -> True - _ -> False + Unit 1 -> Bool.true + _ -> Bool.false "# ), true, @@ -2136,8 +2136,8 @@ fn rosetree_basic() { x : Tree F64 x = singleton 3 when x is - Tree 3.0 _ -> True - _ -> False + Tree 3.0 _ -> Bool.true + _ -> Bool.false "# ), true, @@ -2338,7 +2338,7 @@ fn multiple_increment() { leaf = Leaf m : Map - m = Node Black (Node Black leaf 10 False leaf) 11 False (Node Black leaf 12 False (Node Red leaf 13 False leaf)) + m = Node Black (Node Black leaf 10 Bool.false leaf) 11 Bool.false (Node Black leaf 12 Bool.false (Node Red leaf 13 Bool.false leaf)) when m is Leaf -> 0 @@ -2550,7 +2550,7 @@ fn increment_or_double_closure() { two = 2 b : Bool - b = True + b = Bool.true increment : I64 -> I64 increment = \x -> x + one @@ -2558,7 +2558,7 @@ fn increment_or_double_closure() { double : I64 -> I64 double = \x -> if b then x * two else x - f = (if True then increment else double) + f = (if Bool.true then increment else double) apply f 42 "# @@ -2879,7 +2879,7 @@ fn unresolved_tvar_when_capture_is_unused() { main : I64 main = r : Bool - r = False + r = Bool.false p1 = (\_ -> r == (1 == 1)) oneOfResult = List.map [p1] (\p -> p Green) @@ -3399,7 +3399,7 @@ fn polymorphic_lambda_set_usage() { r#" id1 = \x -> x id2 = \y -> y - id = if True then id1 else id2 + id = if Bool.true then id1 else id2 id 9u8 "# @@ -3417,7 +3417,7 @@ fn polymorphic_lambda_set_multiple_specializations() { r#" id1 = \x -> x id2 = \y -> y - id = if True then id1 else id2 + id = if Bool.true then id1 else id2 (id 9u8) + Num.toU8 (id 16u16) "# @@ -3458,14 +3458,14 @@ fn mutual_recursion_top_level_defs() { isEven = \n -> when n is - 0 -> True - 1 -> False + 0 -> Bool.true + 1 -> Bool.false _ -> isOdd (n - 1) isOdd = \n -> when n is - 0 -> False - 1 -> True + 0 -> Bool.false + 1 -> Bool.true _ -> isEven (n - 1) main = isOdd 11 @@ -3486,7 +3486,7 @@ fn polymorphic_lambda_captures_polymorphic_value() { f1 = \_ -> x - f = if True then f1 else f1 + f = if Bool.true then f1 else f1 f {} "# ), @@ -3506,13 +3506,14 @@ fn lambda_capture_niche_u64_vs_u8_capture() { \{} -> Num.toStr val - x : [True, False] - x = True + x : Bool + x = Bool.true fun = - when x is - True -> capture 123u64 - False -> capture 18u8 + if x then + capture 123u64 + else + capture 18u8 fun {} "# @@ -3608,12 +3609,13 @@ fn lambda_capture_niches_have_captured_function_in_closure() { fun = \x -> h = - when x is - True -> after (\{} -> "") f - False -> after (\{} -> {s1: "s1"}) g + if x then + after (\{} -> "") f + else + after (\{} -> {s1: "s1"}) g h {} - {a: fun False, b: fun True} + {a: fun Bool.false, b: fun Bool.true} "# ), (RocStr::from("s1"), RocStr::from("fun f")), @@ -4007,10 +4009,10 @@ fn mutually_recursive_captures() { indoc!( r#" x : Bool - x = True + x = Bool.true y : Bool - y = False + y = Bool.false a = "foo" b = "bar" @@ -4035,9 +4037,9 @@ fn monomorphization_sees_polymorphic_recursion() { foo : a, Bool -> Str foo = \in, b -> if b then "done" else bar in - bar = \_ -> foo {} True + bar = \_ -> foo {} Bool.true - foo "" False + foo "" Bool.false "# ), RocStr::from("done"), diff --git a/crates/compiler/test_gen/src/gen_records.rs b/crates/compiler/test_gen/src/gen_records.rs index d339ba24a7..823b260955 100644 --- a/crates/compiler/test_gen/src/gen_records.rs +++ b/crates/compiler/test_gen/src/gen_records.rs @@ -309,7 +309,7 @@ fn f64_record2_literal() { // indoc!( // r#" // record : { a : Bool, b : Bool, c : Bool, d : Bool } -// record = { a: True, b: True, c : True, d : Bool } +// record = { a: Bool.true, b: Bool.true, c : Bool.true, d : Bool } // record // "# @@ -366,7 +366,7 @@ fn bool_literal() { indoc!( r#" x : Bool - x = True + x = Bool.true x "# @@ -894,7 +894,9 @@ fn booleans_in_record() { #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn alignment_in_record() { assert_evals_to!( - indoc!("{ c: 32, b: if True then Red else if True then Green else Blue, a: 1 == 1 }"), + indoc!( + "{ c: 32, b: if Bool.true then Red else if Bool.true then Green else Blue, a: 1 == 1 }" + ), (32i64, true, 2u8), (i64, bool, u8) ); diff --git a/crates/compiler/test_gen/src/gen_refcount.rs b/crates/compiler/test_gen/src/gen_refcount.rs index 905b4b4267..dad781e82a 100644 --- a/crates/compiler/test_gen/src/gen_refcount.rs +++ b/crates/compiler/test_gen/src/gen_refcount.rs @@ -483,7 +483,7 @@ fn boxed_str_dec() { s = Str.concat "A long enough string " "to be heap-allocated" b = Box.box s - if False then + if Bool.false then ReturnTheBox b else DeallocateEverything diff --git a/crates/compiler/test_gen/src/gen_result.rs b/crates/compiler/test_gen/src/gen_result.rs index a8dba91329..53cc8aaf76 100644 --- a/crates/compiler/test_gen/src/gen_result.rs +++ b/crates/compiler/test_gen/src/gen_result.rs @@ -264,7 +264,7 @@ fn roc_result_err() { fn issue_2583_specialize_errors_behind_unified_branches() { assert_evals_to!( r#" - if True then List.first [15] else Str.toI64 "" + if Bool.true then List.first [15] else Str.toI64 "" "#, RocResult::ok(15i64), RocResult diff --git a/crates/compiler/test_gen/src/gen_tags.rs b/crates/compiler/test_gen/src/gen_tags.rs index eda3643fdf..7070031e3b 100644 --- a/crates/compiler/test_gen/src/gen_tags.rs +++ b/crates/compiler/test_gen/src/gen_tags.rs @@ -115,8 +115,8 @@ fn true_is_true() { assert_evals_to!( indoc!( r#" - bool : [True, False] - bool = True + bool : Bool + bool = Bool.true bool "# @@ -132,8 +132,8 @@ fn false_is_false() { assert_evals_to!( indoc!( r#" - bool : [True, False] - bool = False + bool : Bool + bool = Bool.false bool "# @@ -214,8 +214,8 @@ fn basic_enum() { // isEmpty : LinkedList a -> Bool // isEmpty = \list -> // when list is -// Nil -> True -// Cons _ _ -> False +// Nil -> Bool.true +// Cons _ _ -> Bool.false // // isEmpty (Cons 4 Nil) // "# @@ -232,14 +232,14 @@ fn even_odd() { r#" even = \n -> when n is - 0 -> True - 1 -> False + 0 -> Bool.true + 1 -> Bool.false _ -> odd (n - 1) odd = \n -> when n is - 0 -> False - 1 -> True + 0 -> Bool.false + 1 -> Bool.true _ -> even (n - 1) odd 5 && even 42 @@ -256,7 +256,7 @@ fn gen_literal_true() { assert_evals_to!( indoc!( r#" - if True then -1 else 1 + if Bool.true then -1 else 1 "# ), -1, @@ -270,7 +270,7 @@ fn gen_if_float() { assert_evals_to!( indoc!( r#" - if True then -1.0 else 1.0 + if Bool.true then -1.0 else 1.0 "# ), -1.0, @@ -424,8 +424,8 @@ fn maybe_is_just_not_nested() { isJust : Maybe a -> Bool isJust = \list -> when list is - Nothing -> False - Just _ -> True + Nothing -> Bool.false + Just _ -> Bool.true main = isJust (Just 42) @@ -447,8 +447,8 @@ fn maybe_is_just_nested() { isJust : Maybe a -> Bool isJust = \list -> when list is - Nothing -> False - Just _ -> True + Nothing -> Bool.false + Just _ -> Bool.true isJust (Just 42) "# @@ -601,7 +601,7 @@ fn if_guard_pattern_false() { r#" wrapper = \{} -> when 2 is - 2 if False -> 0 + 2 if Bool.false -> 0 _ -> 42 wrapper {} @@ -620,7 +620,7 @@ fn if_guard_switch() { r#" wrapper = \{} -> when 2 is - 2 | 3 if False -> 0 + 2 | 3 if Bool.false -> 0 _ -> 42 wrapper {} @@ -639,7 +639,7 @@ fn if_guard_pattern_true() { r#" wrapper = \{} -> when 2 is - 2 if True -> 42 + 2 if Bool.true -> 42 _ -> 0 wrapper {} @@ -658,7 +658,7 @@ fn if_guard_exhaustiveness() { r#" wrapper = \{} -> when 2 is - _ if False -> 0 + _ if Bool.false -> 0 _ -> 42 wrapper {} @@ -814,7 +814,7 @@ fn join_point_if() { indoc!( r#" x = - if True then 1 else 2 + if Bool.true then 1 else 2 x "# @@ -895,7 +895,7 @@ fn alignment_in_single_tag_construction() { assert_evals_to!(indoc!("Three (1 == 1) 32"), (32i64, true), (i64, bool)); assert_evals_to!( - indoc!("Three (1 == 1) (if True then Red else if True then Green else Blue) 32"), + indoc!("Three (1 == 1) (if Bool.true then Red else if Bool.true then Green else Blue) 32"), (32i64, true, 2u8), (i64, bool, u8) ); @@ -921,7 +921,7 @@ fn alignment_in_single_tag_pattern_match() { assert_evals_to!( indoc!( r"# - x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32 + x = Three (1 == 1) (if Bool.true then Red else if Bool.true then Green else Blue) 32 when x is Three bool color int -> @@ -958,7 +958,7 @@ fn alignment_in_multi_tag_construction_three() { indoc!( r"# x : [Three Bool [Red, Green, Blue] I64, Empty] - x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32 + x = Three (1 == 1) (if Bool.true then Red else if Bool.true then Green else Blue) 32 x #" @@ -982,7 +982,7 @@ fn alignment_in_multi_tag_pattern_match() { { bool, int } Empty -> - { bool: False, int: 0 } + { bool: Bool.false, int: 0 } #" ), (32i64, true), @@ -993,13 +993,13 @@ fn alignment_in_multi_tag_pattern_match() { indoc!( r"# x : [Three Bool [Red, Green, Blue] I64, Empty] - x = Three (1 == 1) (if True then Red else if True then Green else Blue) 32 + x = Three (1 == 1) (if Bool.true then Red else if Bool.true then Green else Blue) 32 when x is Three bool color int -> { bool, color, int } Empty -> - { bool: False, color: Red, int: 0 } + { bool: Bool.false, color: Red, int: 0 } #" ), (32i64, true, 2u8), @@ -1237,8 +1237,8 @@ fn monomorphized_tag() { assert_evals_to!( indoc!( r#" - b = False - f : Bool, [True, False, Idk] -> U8 + b = Bar + f : [Foo, Bar], [Bar, Baz] -> U8 f = \_, _ -> 18 f b b "# @@ -1853,10 +1853,10 @@ fn error_type_in_tag_union_payload() { r#" f : ([] -> Bool) -> Bool f = \fun -> - if True then + if Bool.true then fun 42 else - False + Bool.false f (\x -> x) "# diff --git a/crates/compiler/test_mono/generated/encode.txt b/crates/compiler/test_mono/generated/encode.txt index 03cb371d02..016be573d8 100644 --- a/crates/compiler/test_mono/generated/encode.txt +++ b/crates/compiler/test_mono/generated/encode.txt @@ -1,6 +1,6 @@ procedure List.4 (List.101, List.102): - let List.387 : U64 = 1i64; - let List.386 : List U8 = CallByName List.70 List.101 List.387; + let List.388 : U64 = 1i64; + let List.386 : List U8 = CallByName List.70 List.101 List.388; let List.385 : List U8 = CallByName List.71 List.386 List.102; ret List.385; @@ -9,8 +9,8 @@ procedure List.70 (#Attr.2, #Attr.3): ret List.389; procedure List.71 (#Attr.2, #Attr.3): - let List.388 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.388; + let List.387 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.387; procedure Test.23 (Test.24, Test.35, Test.22): let Test.37 : List U8 = CallByName List.4 Test.24 Test.22; diff --git a/crates/compiler/test_mono/generated/guard_pattern_true.txt b/crates/compiler/test_mono/generated/guard_pattern_true.txt index 47bfc64e1f..f535579130 100644 --- a/crates/compiler/test_mono/generated/guard_pattern_true.txt +++ b/crates/compiler/test_mono/generated/guard_pattern_true.txt @@ -1,25 +1,29 @@ -procedure Test.1 (Test.3): - let Test.6 : I64 = 2i64; - joinpoint Test.11: - let Test.10 : I64 = 0i64; - ret Test.10; +procedure Bool.1 (): + let Bool.11 : Int1 = false; + ret Bool.11; + +procedure Test.1 (Test.2): + let Test.5 : I64 = 2i64; + joinpoint Test.10: + let Test.9 : I64 = 0i64; + ret Test.9; in - let Test.13 : I64 = 2i64; - let Test.14 : Int1 = lowlevel Eq Test.13 Test.6; - if Test.14 then - joinpoint Test.8 Test.12: - if Test.12 then - let Test.7 : I64 = 42i64; - ret Test.7; + let Test.12 : I64 = 2i64; + let Test.13 : Int1 = lowlevel Eq Test.12 Test.5; + if Test.13 then + joinpoint Test.7 Test.11: + if Test.11 then + let Test.6 : I64 = 42i64; + ret Test.6; else - jump Test.11; + jump Test.10; in - let Test.9 : Int1 = false; - jump Test.8 Test.9; + let Test.8 : Int1 = CallByName Bool.1; + jump Test.7 Test.8; else - jump Test.11; + jump Test.10; procedure Test.0 (): - let Test.5 : {} = Struct {}; - let Test.4 : I64 = CallByName Test.1 Test.5; - ret Test.4; + let Test.4 : {} = Struct {}; + let Test.3 : I64 = CallByName Test.1 Test.4; + ret Test.3; diff --git a/crates/compiler/test_mono/generated/if_guard_bind_variable_false.txt b/crates/compiler/test_mono/generated/if_guard_bind_variable_false.txt index 7d73011b72..1565f25f88 100644 --- a/crates/compiler/test_mono/generated/if_guard_bind_variable_false.txt +++ b/crates/compiler/test_mono/generated/if_guard_bind_variable_false.txt @@ -1,6 +1,6 @@ procedure Bool.7 (#Attr.2, #Attr.3): - let Bool.9 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.9; + let Bool.11 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.11; procedure Test.1 (Test.3): let Test.6 : I64 = 10i64; diff --git a/crates/compiler/test_mono/generated/if_multi_branch.txt b/crates/compiler/test_mono/generated/if_multi_branch.txt index 6178c6a0db..36dddc2fe9 100644 --- a/crates/compiler/test_mono/generated/if_multi_branch.txt +++ b/crates/compiler/test_mono/generated/if_multi_branch.txt @@ -1,13 +1,21 @@ +procedure Bool.1 (): + let Bool.11 : Int1 = false; + ret Bool.11; + +procedure Bool.2 (): + let Bool.12 : Int1 = true; + ret Bool.12; + procedure Test.0 (): - let Test.6 : Int1 = true; - if Test.6 then - let Test.7 : I64 = 1i64; - ret Test.7; + let Test.4 : Int1 = CallByName Bool.2; + if Test.4 then + let Test.5 : I64 = 1i64; + ret Test.5; else - let Test.4 : Int1 = false; - if Test.4 then - let Test.5 : I64 = 2i64; - ret Test.5; - else - let Test.3 : I64 = 3i64; + let Test.2 : Int1 = CallByName Bool.1; + if Test.2 then + let Test.3 : I64 = 2i64; ret Test.3; + else + let Test.1 : I64 = 3i64; + ret Test.1; diff --git a/crates/compiler/test_mono/generated/ir_when_idiv.txt b/crates/compiler/test_mono/generated/ir_when_idiv.txt index a53679812c..6ab0065bc7 100644 --- a/crates/compiler/test_mono/generated/ir_when_idiv.txt +++ b/crates/compiler/test_mono/generated/ir_when_idiv.txt @@ -1,18 +1,18 @@ procedure Bool.7 (#Attr.2, #Attr.3): - let Bool.9 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.9; + let Bool.11 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.11; procedure Num.39 (#Attr.2, #Attr.3): - let Num.263 : I64 = lowlevel NumDivUnchecked #Attr.2 #Attr.3; - ret Num.263; + let Num.259 : I64 = lowlevel NumDivTruncUnchecked #Attr.2 #Attr.3; + ret Num.259; procedure Num.40 (Num.229, Num.230): - let Num.262 : I64 = 0i64; - let Num.259 : Int1 = CallByName Bool.7 Num.230 Num.262; - if Num.259 then - let Num.261 : {} = Struct {}; - let Num.260 : [C {}, C I64] = TagId(0) Num.261; - ret Num.260; + let Num.263 : I64 = 0i64; + let Num.260 : Int1 = CallByName Bool.7 Num.230 Num.263; + if Num.260 then + let Num.262 : {} = Struct {}; + let Num.261 : [C {}, C I64] = TagId(0) Num.262; + ret Num.261; else let Num.258 : I64 = CallByName Num.39 Num.229 Num.230; let Num.257 : [C {}, C I64] = TagId(1) Num.258; diff --git a/crates/compiler/test_mono/generated/is_nil.txt b/crates/compiler/test_mono/generated/is_nil.txt index 474267831b..aaea58f73a 100644 --- a/crates/compiler/test_mono/generated/is_nil.txt +++ b/crates/compiler/test_mono/generated/is_nil.txt @@ -1,18 +1,26 @@ +procedure Bool.1 (): + let Bool.12 : Int1 = false; + ret Bool.12; + +procedure Bool.2 (): + let Bool.11 : Int1 = true; + ret Bool.11; + procedure Test.2 (Test.4): - let Test.13 : U8 = 1i64; - let Test.14 : U8 = GetTagId Test.4; - let Test.15 : Int1 = lowlevel Eq Test.13 Test.14; - if Test.15 then - let Test.11 : Int1 = true; - ret Test.11; + let Test.11 : U8 = 1i64; + let Test.12 : U8 = GetTagId Test.4; + let Test.13 : Int1 = lowlevel Eq Test.11 Test.12; + if Test.13 then + let Test.9 : Int1 = CallByName Bool.2; + ret Test.9; else - let Test.12 : Int1 = false; - ret Test.12; + let Test.10 : Int1 = CallByName Bool.1; + ret Test.10; procedure Test.0 (): - let Test.16 : I64 = 2i64; - let Test.17 : [, C I64 *self] = TagId(1) ; - let Test.10 : [, C I64 *self] = TagId(0) Test.16 Test.17; - let Test.9 : Int1 = CallByName Test.2 Test.10; - dec Test.10; - ret Test.9; + let Test.14 : I64 = 2i64; + let Test.15 : [, C I64 *self] = TagId(1) ; + let Test.8 : [, C I64 *self] = TagId(0) Test.14 Test.15; + let Test.7 : Int1 = CallByName Test.2 Test.8; + dec Test.8; + ret Test.7; diff --git a/crates/compiler/test_mono/generated/issue_3669.txt b/crates/compiler/test_mono/generated/issue_3669.txt index 5025608363..11d9485149 100644 --- a/crates/compiler/test_mono/generated/issue_3669.txt +++ b/crates/compiler/test_mono/generated/issue_3669.txt @@ -1,6 +1,6 @@ procedure Bool.7 (#Attr.2, #Attr.3): - let Bool.9 : Int1 = lowlevel Eq #Attr.2 #Attr.3; - ret Bool.9; + let Bool.11 : Int1 = lowlevel Eq #Attr.2 #Attr.3; + ret Bool.11; procedure Test.2 (Test.19): joinpoint Test.13 Test.7: diff --git a/crates/compiler/test_mono/generated/list_append.txt b/crates/compiler/test_mono/generated/list_append.txt index 77dd229693..e350fd6aea 100644 --- a/crates/compiler/test_mono/generated/list_append.txt +++ b/crates/compiler/test_mono/generated/list_append.txt @@ -1,6 +1,6 @@ procedure List.4 (List.101, List.102): - let List.387 : U64 = 1i64; - let List.386 : List I64 = CallByName List.70 List.101 List.387; + let List.388 : U64 = 1i64; + let List.386 : List I64 = CallByName List.70 List.101 List.388; let List.385 : List I64 = CallByName List.71 List.386 List.102; ret List.385; @@ -9,8 +9,8 @@ procedure List.70 (#Attr.2, #Attr.3): ret List.389; procedure List.71 (#Attr.2, #Attr.3): - let List.388 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.388; + let List.387 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.387; procedure Test.0 (): let Test.2 : List I64 = Array [1i64]; diff --git a/crates/compiler/test_mono/generated/list_append_closure.txt b/crates/compiler/test_mono/generated/list_append_closure.txt index c2718f77a5..39ccb72c57 100644 --- a/crates/compiler/test_mono/generated/list_append_closure.txt +++ b/crates/compiler/test_mono/generated/list_append_closure.txt @@ -1,6 +1,6 @@ procedure List.4 (List.101, List.102): - let List.387 : U64 = 1i64; - let List.386 : List I64 = CallByName List.70 List.101 List.387; + let List.388 : U64 = 1i64; + let List.386 : List I64 = CallByName List.70 List.101 List.388; let List.385 : List I64 = CallByName List.71 List.386 List.102; ret List.385; @@ -9,8 +9,8 @@ procedure List.70 (#Attr.2, #Attr.3): ret List.389; procedure List.71 (#Attr.2, #Attr.3): - let List.388 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.388; + let List.387 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.387; procedure Test.1 (Test.2): let Test.6 : I64 = 42i64; diff --git a/crates/compiler/test_mono/generated/monomorphized_tag.txt b/crates/compiler/test_mono/generated/monomorphized_tag.txt index 3547954b88..5e2bf5a440 100644 --- a/crates/compiler/test_mono/generated/monomorphized_tag.txt +++ b/crates/compiler/test_mono/generated/monomorphized_tag.txt @@ -1,9 +1,8 @@ procedure Test.2 (Test.4, Test.5): - let Test.8 : U8 = 18i64; - ret Test.8; + let Test.7 : U8 = 18i64; + ret Test.7; procedure Test.0 (): - let Test.7 : U8 = 0u8; let Test.1 : Int1 = false; - let Test.6 : U8 = CallByName Test.2 Test.1 Test.7; + let Test.6 : U8 = CallByName Test.2 Test.1 Test.1; ret Test.6; diff --git a/crates/compiler/test_mono/generated/monomorphized_tag_with_aliased_args.txt b/crates/compiler/test_mono/generated/monomorphized_tag_with_aliased_args.txt index 988d7238fb..fe89b5144c 100644 --- a/crates/compiler/test_mono/generated/monomorphized_tag_with_aliased_args.txt +++ b/crates/compiler/test_mono/generated/monomorphized_tag_with_aliased_args.txt @@ -1,10 +1,14 @@ -procedure Test.4 (Test.8): - let Test.10 : U64 = 1i64; - ret Test.10; +procedure Bool.1 (): + let Bool.12 : Int1 = false; + ret Bool.12; + +procedure Test.4 (Test.6): + let Test.8 : U64 = 1i64; + ret Test.8; procedure Test.0 (): - let Test.1 : Int1 = false; - let Test.2 : Int1 = false; + let Test.1 : Int1 = CallByName Bool.1; + let Test.2 : Int1 = CallByName Bool.1; let Test.3 : {Int1, Int1} = Struct {Test.1, Test.2}; - let Test.9 : U64 = CallByName Test.4 Test.3; - ret Test.9; + let Test.7 : U64 = CallByName Test.4 Test.3; + ret Test.7; diff --git a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt index 95837c3b32..1d0e02c71f 100644 --- a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt +++ b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt @@ -1,24 +1,28 @@ +procedure Bool.2 (): + let Bool.11 : Int1 = true; + ret Bool.11; + procedure Num.19 (#Attr.2, #Attr.3): let Num.257 : U32 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.257; procedure Test.1 (Test.2): - let Test.9 : U32 = 0i64; - let Test.8 : U32 = CallByName Test.3 Test.9 Test.2; - ret Test.8; + let Test.8 : U32 = 0i64; + let Test.7 : U32 = CallByName Test.3 Test.8 Test.2; + ret Test.7; -procedure Test.3 (Test.18, Test.19): - joinpoint Test.10 Test.4 Test.2: - let Test.14 : Int1 = true; - if Test.14 then +procedure Test.3 (Test.17, Test.18): + joinpoint Test.9 Test.4 Test.2: + let Test.13 : Int1 = CallByName Bool.2; + if Test.13 then ret Test.4; else - let Test.12 : U32 = CallByName Num.19 Test.4 Test.2; - jump Test.10 Test.12 Test.2; + let Test.11 : U32 = CallByName Num.19 Test.4 Test.2; + jump Test.9 Test.11 Test.2; in - jump Test.10 Test.18 Test.19; + jump Test.9 Test.17 Test.18; procedure Test.0 (): - let Test.7 : U32 = 6i64; - let Test.6 : U32 = CallByName Test.1 Test.7; - ret Test.6; + let Test.6 : U32 = 6i64; + let Test.5 : U32 = CallByName Test.1 Test.6; + ret Test.5; diff --git a/crates/compiler/test_mono/generated/simple_if.txt b/crates/compiler/test_mono/generated/simple_if.txt index 04a1917375..0ffc888c09 100644 --- a/crates/compiler/test_mono/generated/simple_if.txt +++ b/crates/compiler/test_mono/generated/simple_if.txt @@ -1,8 +1,12 @@ +procedure Bool.2 (): + let Bool.11 : Int1 = true; + ret Bool.11; + procedure Test.0 (): - let Test.3 : Int1 = true; - if Test.3 then - let Test.4 : I64 = 1i64; - ret Test.4; + let Test.2 : Int1 = CallByName Bool.2; + if Test.2 then + let Test.3 : I64 = 1i64; + ret Test.3; else - let Test.2 : I64 = 2i64; - ret Test.2; + let Test.1 : I64 = 2i64; + ret Test.1; diff --git a/crates/compiler/test_mono/generated/specialize_closures.txt b/crates/compiler/test_mono/generated/specialize_closures.txt index 5ed689d7af..9933e249b2 100644 --- a/crates/compiler/test_mono/generated/specialize_closures.txt +++ b/crates/compiler/test_mono/generated/specialize_closures.txt @@ -1,3 +1,7 @@ +procedure Bool.2 (): + let Bool.11 : Int1 = true; + ret Bool.11; + procedure Num.19 (#Attr.2, #Attr.3): let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.258; @@ -7,47 +11,46 @@ procedure Num.21 (#Attr.2, #Attr.3): ret Num.257; procedure Test.1 (Test.2, Test.3): - let Test.17 : U8 = GetTagId Test.2; - joinpoint Test.18 Test.16: - ret Test.16; + let Test.15 : U8 = GetTagId Test.2; + joinpoint Test.16 Test.14: + ret Test.14; in - switch Test.17: + switch Test.15: case 0: - let Test.19 : I64 = CallByName Test.7 Test.3 Test.2; - jump Test.18 Test.19; + let Test.17 : I64 = CallByName Test.7 Test.3 Test.2; + jump Test.16 Test.17; default: - let Test.20 : I64 = CallByName Test.8 Test.3 Test.2; - jump Test.18 Test.20; + let Test.18 : I64 = CallByName Test.8 Test.3 Test.2; + jump Test.16 Test.18; -procedure Test.7 (Test.10, #Attr.12): +procedure Test.7 (Test.9, #Attr.12): let Test.4 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let Test.26 : I64 = CallByName Num.19 Test.10 Test.4; - ret Test.26; + let Test.24 : I64 = CallByName Num.19 Test.9 Test.4; + ret Test.24; -procedure Test.8 (Test.11, #Attr.12): +procedure Test.8 (Test.10, #Attr.12): let Test.6 : Int1 = UnionAtIndex (Id 1) (Index 1) #Attr.12; let Test.5 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12; if Test.6 then - let Test.24 : I64 = CallByName Num.21 Test.11 Test.5; - ret Test.24; + let Test.22 : I64 = CallByName Num.21 Test.10 Test.5; + ret Test.22; else - ret Test.11; + ret Test.10; procedure Test.0 (): let Test.4 : I64 = 1i64; let Test.5 : I64 = 2i64; - let Test.6 : Int1 = true; - joinpoint Test.22 Test.14: - let Test.15 : I64 = 42i64; - let Test.13 : I64 = CallByName Test.1 Test.14 Test.15; - ret Test.13; + joinpoint Test.20 Test.12: + let Test.13 : I64 = 42i64; + let Test.11 : I64 = CallByName Test.1 Test.12 Test.13; + ret Test.11; in - let Test.25 : Int1 = true; - if Test.25 then + let Test.23 : Int1 = CallByName Bool.2; + if Test.23 then let Test.7 : [C I64, C I64 Int1] = TagId(0) Test.4; - jump Test.22 Test.7; + jump Test.20 Test.7; else let Test.8 : [C I64, C I64 Int1] = TagId(1) Test.5 Test.6; - jump Test.22 Test.8; + jump Test.20 Test.8; diff --git a/crates/compiler/test_mono/generated/specialize_lowlevel.txt b/crates/compiler/test_mono/generated/specialize_lowlevel.txt index c022705684..017db92ce7 100644 --- a/crates/compiler/test_mono/generated/specialize_lowlevel.txt +++ b/crates/compiler/test_mono/generated/specialize_lowlevel.txt @@ -1,3 +1,7 @@ +procedure Bool.2 (): + let Bool.11 : Int1 = true; + ret Bool.11; + procedure Num.19 (#Attr.2, #Attr.3): let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.258; @@ -8,37 +12,37 @@ procedure Num.21 (#Attr.2, #Attr.3): procedure Test.6 (Test.8, #Attr.12): let Test.4 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let Test.22 : I64 = CallByName Num.19 Test.8 Test.4; - ret Test.22; + let Test.21 : I64 = CallByName Num.19 Test.8 Test.4; + ret Test.21; procedure Test.7 (Test.9, #Attr.12): let Test.5 : I64 = UnionAtIndex (Id 1) (Index 0) #Attr.12; - let Test.20 : I64 = CallByName Num.21 Test.9 Test.5; - ret Test.20; + let Test.19 : I64 = CallByName Num.21 Test.9 Test.5; + ret Test.19; procedure Test.0 (): let Test.4 : I64 = 1i64; let Test.5 : I64 = 2i64; - let Test.12 : I64 = 42i64; - joinpoint Test.19 Test.13: - let Test.14 : U8 = GetTagId Test.13; - joinpoint Test.15 Test.11: - ret Test.11; + let Test.11 : I64 = 42i64; + joinpoint Test.18 Test.12: + let Test.13 : U8 = GetTagId Test.12; + joinpoint Test.14 Test.10: + ret Test.10; in - switch Test.14: + switch Test.13: case 0: - let Test.16 : I64 = CallByName Test.6 Test.12 Test.13; - jump Test.15 Test.16; + let Test.15 : I64 = CallByName Test.6 Test.11 Test.12; + jump Test.14 Test.15; default: - let Test.17 : I64 = CallByName Test.7 Test.12 Test.13; - jump Test.15 Test.17; + let Test.16 : I64 = CallByName Test.7 Test.11 Test.12; + jump Test.14 Test.16; in - let Test.21 : Int1 = true; - if Test.21 then + let Test.20 : Int1 = CallByName Bool.2; + if Test.20 then let Test.6 : [C I64, C I64] = TagId(0) Test.4; - jump Test.19 Test.6; + jump Test.18 Test.6; else let Test.7 : [C I64, C I64] = TagId(1) Test.5; - jump Test.19 Test.7; + jump Test.18 Test.7; diff --git a/crates/compiler/test_mono/src/tests.rs b/crates/compiler/test_mono/src/tests.rs index bf75667408..d528577e55 100644 --- a/crates/compiler/test_mono/src/tests.rs +++ b/crates/compiler/test_mono/src/tests.rs @@ -325,7 +325,7 @@ fn guard_pattern_true() { r#" wrapper = \{} -> when 2 is - 2 if False -> 42 + 2 if Bool.false -> 42 _ -> 0 wrapper {} @@ -420,7 +420,7 @@ fn when_joinpoint() { #[mono_test] fn simple_if() { r#" - if True then + if Bool.true then 1 else 2 @@ -430,9 +430,9 @@ fn simple_if() { #[mono_test] fn if_multi_branch() { r#" - if True then + if Bool.true then 1 - else if False then + else if Bool.false then 2 else 3 @@ -730,8 +730,8 @@ fn is_nil() { isNil : ConsList a -> Bool isNil = \list -> when list is - Nil -> True - Cons _ _ -> False + Nil -> Bool.true + Cons _ _ -> Bool.false isNil (Cons 0x2 Nil) "# @@ -747,8 +747,8 @@ fn has_none() { hasNone : ConsList (Maybe a) -> Bool hasNone = \list -> when list is - Nil -> False - Cons Nothing _ -> True + Nil -> Bool.false + Cons Nothing _ -> Bool.true Cons (Just _) xs -> hasNone xs hasNone (Cons (Just 3) Nil) @@ -1024,7 +1024,7 @@ fn somehow_drops_definitions() { apply = \f, x -> f x main = - apply (if True then increment else double) 42 + apply (if Bool.true then increment else double) 42 "# ) } @@ -1047,7 +1047,7 @@ fn specialize_closures() { two = 2 b : Bool - b = True + b = Bool.true increment : I64 -> I64 increment = \x -> x + one @@ -1055,7 +1055,7 @@ fn specialize_closures() { double : I64 -> I64 double = \x -> if b then x * two else x - apply (if True then increment else double) 42 + apply (if Bool.true then increment else double) 42 "# ) } @@ -1082,7 +1082,7 @@ fn specialize_lowlevel() { double : I64 -> I64 double = \x -> x * two - (if True then increment else double) 42 + (if Bool.true then increment else double) 42 "# ) } @@ -1102,7 +1102,7 @@ fn empty_list_of_function_type() { myClosure = \_ -> "bar" choose = - if False then + if Bool.false then myList else [myClosure] @@ -1180,8 +1180,8 @@ fn monomorphized_tag() { app "test" provides [main] to "./platform" main = - b = False - f : Bool, [True, False, Idk] -> U8 + b = Bar + f : [Foo, Bar], [Bar, Baz] -> U8 f = \_, _ -> 18 f b b "# @@ -1195,8 +1195,8 @@ fn monomorphized_tag_with_aliased_args() { app "test" provides [main] to "./platform" main = - b = False - c = False + b = Bool.false + c = Bool.false a = A b c f : [A Bool Bool] -> Nat f = \_ -> 1 @@ -1286,7 +1286,7 @@ fn issue_2725_alias_polymorphic_lambda() { fn issue_2583_specialize_errors_behind_unified_branches() { indoc!( r#" - if True then List.first [] else Str.toI64 "" + if Bool.true then List.first [] else Str.toI64 "" "# ) } @@ -1716,7 +1716,7 @@ fn recursive_call_capturing_function() { a = \b -> c : U32 -> U32 c = \d -> - if True then d else c (d+b) + if Bool.true then d else c (d+b) c 0 a 6