From c42d8bf34a789adc87683b045c9dd83e18fd34b0 Mon Sep 17 00:00:00 2001 From: Norbert Hajagos Date: Wed, 8 Jan 2025 21:22:33 +0100 Subject: [PATCH 1/2] with_ascii_lowercased zig builtin --- crates/compiler/builtins/bitcode/src/main.zig | 1 + crates/compiler/builtins/bitcode/src/str.zig | 78 +++- crates/compiler/builtins/roc/Str.roc | 16 + crates/compiler/builtins/src/bitcode.rs | 1 + crates/compiler/can/src/builtins.rs | 1 + crates/compiler/gen_dev/src/lib.rs | 7 + crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 12 + crates/compiler/gen_wasm/src/low_level.rs | 3 + crates/compiler/module/src/low_level.rs | 2 + crates/compiler/module/src/symbol.rs | 1 + .../compiler/mono/src/drop_specialization.rs | 1 + crates/compiler/mono/src/inc_dec.rs | 1 + crates/compiler/solve/tests/solve_expr.rs | 12 + crates/compiler/test_gen/src/gen_str.rs | 26 ++ ...lambda_set_productive_nullable_wrapped.txt | 4 +- .../compiler/test_mono/generated/dbg_expr.txt | 4 +- .../test_mono/generated/dbg_in_expect.txt | 298 +++++++-------- .../test_mono/generated/dbg_inside_string.txt | 292 +++++++-------- .../test_mono/generated/dbg_nested_expr.txt | 4 +- .../generated/dbg_str_followed_by_number.txt | 292 +++++++-------- ...unt_for_usage_after_early_return_in_if.txt | 4 +- .../encode_derived_nested_record_string.txt | 40 +- ...encode_derived_record_one_field_string.txt | 40 +- ...ncode_derived_record_two_field_strings.txt | 40 +- .../generated/encode_derived_string.txt | 40 +- .../encode_derived_tag_one_field_string.txt | 40 +- ...encode_derived_tag_two_payloads_string.txt | 40 +- .../generated/inspect_derived_dict.txt | 342 +++++++++--------- .../generated/inspect_derived_list.txt | 4 +- .../inspect_derived_nested_record_string.txt | 312 ++++++++-------- .../generated/inspect_derived_record.txt | 4 +- ...nspect_derived_record_one_field_string.txt | 306 ++++++++-------- ...spect_derived_record_two_field_strings.txt | 306 ++++++++-------- .../generated/inspect_derived_string.txt | 292 +++++++-------- .../inspect_derived_tag_one_field_string.txt | 312 ++++++++-------- ...nspect_derived_tag_two_payloads_string.txt | 306 ++++++++-------- ...cialize_errors_behind_unified_branches.txt | 34 +- ..._4772_weakened_monomorphic_destructure.txt | 38 +- ...pture_niches_with_other_lambda_capture.txt | 4 +- .../generated/list_map_closure_borrows.txt | 8 +- .../generated/list_map_closure_owns.txt | 4 +- .../test_mono/generated/pizza_dbg.txt | 4 +- .../polymorphic_expression_unification.txt | 4 +- .../generated/recursively_build_effect.txt | 4 +- .../test_mono/generated/return_annotated.txt | 34 +- ...not_duplicate_identical_concrete_types.txt | 8 +- ...types_without_unification_of_unifiable.txt | 8 +- .../specialize/inspect/opaque_automatic.txt | 4 +- .../inspect/opaque_automatic_late.txt | 4 +- 49 files changed, 1891 insertions(+), 1751 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/main.zig b/crates/compiler/builtins/bitcode/src/main.zig index 52a02c75c7d..413e82061e6 100644 --- a/crates/compiler/builtins/bitcode/src/main.zig +++ b/crates/compiler/builtins/bitcode/src/main.zig @@ -211,6 +211,7 @@ comptime { exportStrFn(str.withCapacityC, "with_capacity"); exportStrFn(str.strAllocationPtr, "allocation_ptr"); exportStrFn(str.strReleaseExcessCapacity, "release_excess_capacity"); + exportStrFn(str.strWithAsciiLowercased, "with_ascii_lowercased"); for (INTEGERS) |T| { str.exportFromInt(T, ROC_BUILTINS ++ "." ++ STR ++ ".from_int."); diff --git a/crates/compiler/builtins/bitcode/src/str.zig b/crates/compiler/builtins/bitcode/src/str.zig index 183f934449f..76828a4a718 100644 --- a/crates/compiler/builtins/bitcode/src/str.zig +++ b/crates/compiler/builtins/bitcode/src/str.zig @@ -2,6 +2,7 @@ const utils = @import("utils.zig"); const RocList = @import("list.zig").RocList; const UpdateMode = utils.UpdateMode; const std = @import("std"); +const ascii = std.ascii; const mem = std.mem; const unicode = std.unicode; const testing = std.testing; @@ -374,7 +375,12 @@ pub const RocStr = extern struct { return utils.REFCOUNT_ONE; } - const ptr: [*]usize = @as([*]usize, @ptrCast(@alignCast(self.bytes))); + const data_ptr = if (self.isSeamlessSlice()) + self.getAllocationPtr() + else + self.bytes; + + const ptr: [*]usize = @as([*]usize, @ptrCast(@alignCast(data_ptr))); return (ptr - 1)[0]; } @@ -615,16 +621,6 @@ fn initFromSmallStr(slice_bytes: [*]u8, len: usize, _: usize) RocStr { return RocStr.init(slice_bytes, len); } -// The alloc_ptr must already be shifted to be ready for storing in a seamless slice. -fn initFromBigStr(slice_bytes: [*]u8, len: usize, alloc_ptr: usize) RocStr { - // Here we can make seamless slices instead of copying to a new small str. - return RocStr{ - .bytes = slice_bytes, - .length = len | SEAMLESS_SLICE_BIT, - .capacity_or_alloc_ptr = alloc_ptr, - }; -} - fn strSplitOnHelp(array: [*]RocStr, string: RocStr, delimiter: RocStr) void { if (delimiter.len() == 0) { string.incref(1); @@ -1972,6 +1968,66 @@ fn countTrailingWhitespaceBytes(string: RocStr) usize { return byte_count; } +// Str.with_ascii_lowercased +pub fn strWithAsciiLowercased(string: RocStr) callconv(.C) RocStr { + var new_str = if (string.isUnique()) + string + else blk: { + string.decref(); + break :blk RocStr.fromSlice(string.asSlice()); + }; + + const new_str_bytes = new_str.asU8ptrMut()[0..string.len()]; + for (new_str_bytes) |*c| { + c.* = ascii.toLower(c.*); + } + return new_str; +} + +test "withAsciiLowercased: small str" { + const original = RocStr.fromSlice("cOFFÉ"); + try expect(original.isSmallStr()); + + const expected = RocStr.fromSlice("coffÉ"); + defer expected.decref(); + + const str_result = strWithAsciiLowercased(original); + defer str_result.decref(); + + try expect(str_result.isSmallStr()); + try expect(str_result.eq(expected)); +} + +test "withAsciiLowercased: non small str" { + const original = RocStr.fromSlice("cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ"); + defer original.decref(); + try expect(!original.isSmallStr()); + + const expected = RocStr.fromSlice("coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ"); + defer expected.decref(); + + const str_result = strWithAsciiLowercased(original); + + try expect(!str_result.isSmallStr()); + try expect(str_result.eq(expected)); +} + +test "withAsciiLowercased: seamless slice" { + const l = RocStr.fromSlice("cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ"); + const original = substringUnsafeC(l, 1, l.len() - 1); + defer original.decref(); + + try expect(original.isSeamlessSlice()); + + const expected = RocStr.fromSlice("offÉ coffÉ coffÉ coffÉ coffÉ coffÉ"); + defer expected.decref(); + + const str_result = strWithAsciiLowercased(original); + + try expect(!str_result.isSmallStr()); + try expect(str_result.eq(expected)); +} + fn rcNone(_: ?[*]u8) callconv(.C) void {} fn decStr(ptr: ?[*]u8) callconv(.C) void { diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index 9304559dd3b..dd460a58ea2 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -369,6 +369,7 @@ module [ contains, drop_prefix, drop_suffix, + with_ascii_lowercased, ] import Bool exposing [Bool] @@ -1092,3 +1093,18 @@ drop_suffix = \haystack, suffix -> substring_unsafe(haystack, start, len) else haystack + +## Returns a version of the string with all [ASCII characters](https://en.wikipedia.org/wiki/ASCII) lowercased. Non-ASCII characters are left unmodified. For example: +## +## ```roc +## expect "CAFÉ".with_ascii_lowercased() == "cafÉ" +## ``` +## +## This function is useful for things like [command-line options](https://en.wikipedia.org/wiki/Command-line_interface#Command-line_option) and [environment variables](https://en.wikipedia.org/wiki/Environment_variablewhere you ## know in advance that you're dealing with a hardcoded string containing only ASCII characters. It has better performance than lowercasing operations which take Unicode into account. +## +## That said, strings received from user input can always contain non-ASCII Unicode characters, and lowercasing [Unicode](https://unicode.org) works differently in different languages. For example, the string `"I"lowercases to `"i"## ` in English and to `"ı"` (a [dotless i](https://en.wikipedia.org/wiki/Dotless_I)) in Turkish. These rules can also change in each [Unicode release](https://www.unicode.org/releases/), so we have separate [`unicode` package]## (https://github.com/roc-lang/unicode) for Unicode capitalization that can be upgraded independently from the language's builtins. +## +## To do a case-insensitive comparison of the ASCII characters in a string, use [`caseless_ascii_equals`](#caseless_ascii_equals). +with_ascii_lowercased: Str -> Str + +expect Str.with_ascii_lowercased "cOFFÉ" == "XYZFÉ" diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index cbf1ca73ee1..e1a0d821a46 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -358,6 +358,7 @@ pub const STR_CLONE_TO: &str = "roc_builtins.str.clone_to"; pub const STR_WITH_CAPACITY: &str = "roc_builtins.str.with_capacity"; pub const STR_ALLOCATION_PTR: &str = "roc_builtins.str.allocation_ptr"; pub const STR_RELEASE_EXCESS_CAPACITY: &str = "roc_builtins.str.release_excess_capacity"; +pub const STR_WITH_ASCII_LOWERCASED: &str = "roc_builtins.str.with_ascii_lowercased"; pub const LIST_MAP: &str = "roc_builtins.list.map"; pub const LIST_MAP2: &str = "roc_builtins.list.map2"; diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index 6b4c99ee5e3..82b2e6df736 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -130,6 +130,7 @@ map_symbol_to_lowlevel_and_arity! { StrToNum; STR_TO_NUM; 1, StrWithCapacity; STR_WITH_CAPACITY; 1, StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1, + StrWithAsciiLowercased; STR_WITH_ASCII_LOWERCASED; 1, ListLenUsize; LIST_LEN_USIZE; 1, ListLenU64; LIST_LEN_U64; 1, diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index 8eca9aa5ee3..7fa5ce94484 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1726,6 +1726,13 @@ trait Backend<'a> { arg_layouts, ret_layout, ), + LowLevel::StrWithAsciiLowercased => self.build_fn_call( + sym, + bitcode::STR_WITH_ASCII_LOWERCASED.to_string(), + args, + arg_layouts, + ret_layout, + ), LowLevel::StrToNum => { let number_layout = match self.interner().get_repr(*ret_layout) { LayoutRepr::Struct(field_layouts) => field_layouts[0], // TODO: why is it sometimes a struct? diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 0947b9ee312..aacaaa32e66 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -593,6 +593,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( bitcode::STR_WITH_CAPACITY, ) } + ListLenU64 => { // List.len : List * -> U64 arguments!(list); @@ -635,6 +636,17 @@ pub(crate) fn run_low_level<'a, 'ctx>( list_element_layout!(layout_interner, result_layout), ) } + StrWithAsciiLowercased => { + arguments!(string); + + call_str_bitcode_fn( + env, + &[string], + &[], + BitcodeReturns::Str, + bitcode::STR_WITH_ASCII_LOWERCASED, + ) + } ListConcat => { debug_assert_eq!(args.len(), 2); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 1e4c05c3db6..68322608738 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -258,6 +258,9 @@ impl<'a> LowLevelCall<'a> { self.load_args_and_call_zig(backend, bitcode::STR_SUBSTRING_UNSAFE) } StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY), + StrWithAsciiLowercased => { + self.load_args_and_call_zig(backend, bitcode::STR_WITH_ASCII_LOWERCASED) + } // List ListLenU64 => { diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 2f40c002a8f..ac197c54489 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -26,6 +26,7 @@ pub enum LowLevel { StrReserve, StrWithCapacity, StrReleaseExcessCapacity, + StrWithAsciiLowercased, ListLenUsize, ListLenU64, ListWithCapacity, @@ -267,6 +268,7 @@ map_symbol_to_lowlevel! { StrToNum <= STR_TO_NUM; StrWithCapacity <= STR_WITH_CAPACITY; StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY; + StrWithAsciiLowercased <= STR_WITH_ASCII_LOWERCASED; ListLenU64 <= LIST_LEN_U64; ListLenUsize <= LIST_LEN_USIZE; ListGetCapacity <= LIST_CAPACITY; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 61e8d7dbbb7..fda172e9ce6 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1418,6 +1418,7 @@ define_builtins! { 48 STR_RELEASE_EXCESS_CAPACITY: "release_excess_capacity" 49 STR_DROP_PREFIX: "drop_prefix" 50 STR_DROP_SUFFIX: "drop_suffix" + 51 STR_WITH_ASCII_LOWERCASED: "with_ascii_lowercased" } 6 LIST: "List" => { 0 LIST_LIST: "List" exposed_apply_type=true // the List.List type alias diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index 7490318f17f..dfbe58d41c8 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1549,6 +1549,7 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { ListPrepend => RC::Rc, StrJoinWith => RC::NoRc, ListSortWith => RC::Rc, + StrWithAsciiLowercased => RC::Rc, ListAppendUnsafe | ListReserve diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index 1d9cf29a67d..1fcb88b55b1 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1258,6 +1258,7 @@ pub(crate) fn lowlevel_borrow_signature(op: LowLevel) -> &'static [Ownership] { StrReleaseExcessCapacity => &[OWNED], ListIncref => &[OWNED], ListDecref => &[OWNED], + StrWithAsciiLowercased => &[OWNED], Eq | NotEq => &[BORROWED, BORROWED], diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs index 8c6e02c6e53..403a09a08bd 100644 --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -3824,6 +3824,18 @@ mod solve_expr { ); } + #[test] + fn str_with_ascii_lowercased() { + infer_eq_without_problem( + indoc!( + r" + Str.with_ascii_lowercased + " + ), + "Str -> Str", + ); + } + #[test] fn list_take_first() { infer_eq_without_problem( diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index 15984196a4b..c3b02b26840 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -2060,3 +2060,29 @@ fn str_drop_suffix() { RocStr ); } + +#[test] +#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))] +fn with_ascii_lowercased() { + assert_evals_to!( + r#" + Str.with_ascii_lowercased "cOFFÉ" + "#, + RocStr::from("coffÉ"), + RocStr + ); +} + +#[test] +#[cfg(any(feature = "gen-llvm", feature = "gen-dev", feature = "gen-wasm"))] +fn with_ascii_lowercased_non_zero_refcount() { + assert_evals_to!( + r#" + original = "cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ" + res = Str.with_ascii_lowercased original + Str.dropPrefix res original + "#, + RocStr::from("coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ"), + RocStr + ); +} diff --git a/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt b/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt index e06264f601d..8dfbd6c6e69 100644 --- a/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt +++ b/crates/compiler/test_mono/generated/compose_recursive_lambda_set_productive_nullable_wrapped.txt @@ -41,8 +41,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.283; procedure Str.3 (#Attr.2, #Attr.3): - let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.248; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.1 (Test.5): ret Test.5; diff --git a/crates/compiler/test_mono/generated/dbg_expr.txt b/crates/compiler/test_mono/generated/dbg_expr.txt index 2d8c0f74809..9836ad46c15 100644 --- a/crates/compiler/test_mono/generated/dbg_expr.txt +++ b/crates/compiler/test_mono/generated/dbg_expr.txt @@ -43,8 +43,8 @@ procedure Num.96 (#Attr.2): ret Num.284; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.5 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/dbg_in_expect.txt b/crates/compiler/test_mono/generated/dbg_in_expect.txt index 4e6bd826f2a..25ca4dc4dd3 100644 --- a/crates/compiler/test_mono/generated/dbg_in_expect.txt +++ b/crates/compiler/test_mono/generated/dbg_in_expect.txt @@ -104,181 +104,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; - -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; + +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.349 : U8 = 1i64; - let Str.350 : U8 = GetTagId Str.341; - let Str.351 : Int1 = lowlevel Eq Str.349 Str.350; - if Str.351 then - let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341; - let Str.95 : Str = StructAtIndex 0 Str.348; - let Str.94 : Str = StructAtIndex 1 Str.348; - let Str.346 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.345 : Str = CallByName Str.20 Str.346; - let Str.344 : Str = CallByName Str.3 Str.345 Str.94; - dec Str.94; - let Str.343 : Str = CallByName Str.3 Str.344 Str.93; - let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93; - ret Str.342; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.351 : U8 = 1i64; + let Str.352 : U8 = GetTagId Str.343; + let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; + if Str.353 then + let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; + let Str.96 : Str = StructAtIndex 0 Str.350; + let Str.95 : Str = StructAtIndex 1 Str.350; + let Str.348 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.347 : Str = CallByName Str.20 Str.348; + let Str.346 : Str = CallByName Str.3 Str.347 Str.95; + dec Str.95; + let Str.345 : Str = CallByName Str.3 Str.346 Str.94; + let Str.344 : Str = CallByName Str.57 Str.345 Str.96 Str.93 Str.94; + ret Str.344; else - dec Str.341; - ret Str.91; - -procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else + dec Str.343; + ret Str.92; + +procedure Str.57 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in inc #Derived_gen.7; inc #Derived_gen.8; - jump Str.250 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; + jump Str.252 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; - -procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; + +procedure Str.59 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in + inc #Derived_gen.0; inc #Derived_gen.1; - inc #Derived_gen.2; - jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump Str.280 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3; -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then ret Str.153; - -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; + else + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.1 (): let Test.4 : Str = ""; diff --git a/crates/compiler/test_mono/generated/dbg_inside_string.txt b/crates/compiler/test_mono/generated/dbg_inside_string.txt index 45395b4bdb7..a391939d558 100644 --- a/crates/compiler/test_mono/generated/dbg_inside_string.txt +++ b/crates/compiler/test_mono/generated/dbg_inside_string.txt @@ -100,181 +100,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.315; + let Str.317 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.317; procedure Str.3 (#Attr.2, #Attr.3): - let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.248; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Str.35 (#Attr.2, #Attr.3): - let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.305; + let Str.307 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.307; procedure Str.36 (#Attr.2): - let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.268; + let Str.270 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.270; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.266; + let Str.268 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.268; -procedure Str.38 (Str.112, Str.113): - let Str.262 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.275 : U8 = 1i64; - let Str.276 : U8 = GetTagId Str.262; - let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; - if Str.277 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; - let Str.271 : U64 = CallByName Str.36 Str.112; - let Str.272 : U64 = CallByName Str.36 Str.113; - let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; - let Str.115 : U64 = CallByName Num.20 Str.270 Str.114; - let Str.269 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.269 Str.114; - let Str.267 : U64 = CallByName Str.36 Str.113; - let Str.265 : U64 = CallByName Num.51 Str.114 Str.267; - let Str.117 : Str = CallByName Str.37 Str.112 Str.265 Str.115; - let Str.264 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; - ret Str.263; +procedure Str.38 (Str.113, Str.114): + let Str.264 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.277 : U8 = 1i64; + let Str.278 : U8 = GetTagId Str.264; + let Str.279 : Int1 = lowlevel Eq Str.277 Str.278; + if Str.279 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.264; + let Str.273 : U64 = CallByName Str.36 Str.113; + let Str.274 : U64 = CallByName Str.36 Str.114; + let Str.272 : U64 = CallByName Num.20 Str.273 Str.274; + let Str.116 : U64 = CallByName Num.20 Str.272 Str.115; + let Str.271 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.271 Str.115; + let Str.269 : U64 = CallByName Str.36 Str.114; + let Str.267 : U64 = CallByName Num.51 Str.115 Str.269; + let Str.118 : Str = CallByName Str.37 Str.113 Str.267 Str.116; + let Str.266 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.265 : [C {}, C {Str, Str}] = TagId(1) Str.266; + ret Str.265; else - dec Str.112; - let Str.274 : {} = Struct {}; - let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; - ret Str.273; + dec Str.113; + let Str.276 : {} = Struct {}; + let Str.275 : [C {}, C {Str, Str}] = TagId(0) Str.276; + ret Str.275; -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.351 : U8 = 1i64; - let Str.352 : U8 = GetTagId Str.343; - let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; - if Str.353 then - let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; - let Str.95 : Str = StructAtIndex 0 Str.350; - let Str.94 : Str = StructAtIndex 1 Str.350; - let Str.348 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.347 : Str = CallByName Str.20 Str.348; - let Str.346 : Str = CallByName Str.3 Str.347 Str.94; - dec Str.94; - let Str.345 : Str = CallByName Str.3 Str.346 Str.93; - let Str.344 : Str = CallByName Str.56 Str.345 Str.95 Str.92 Str.93; - ret Str.344; +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.345 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.353 : U8 = 1i64; + let Str.354 : U8 = GetTagId Str.345; + let Str.355 : Int1 = lowlevel Eq Str.353 Str.354; + if Str.355 then + let Str.352 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.345; + let Str.96 : Str = StructAtIndex 0 Str.352; + let Str.95 : Str = StructAtIndex 1 Str.352; + let Str.350 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.349 : Str = CallByName Str.20 Str.350; + let Str.348 : Str = CallByName Str.3 Str.349 Str.95; + dec Str.95; + let Str.347 : Str = CallByName Str.3 Str.348 Str.94; + let Str.346 : Str = CallByName Str.57 Str.347 Str.96 Str.93 Str.94; + ret Str.346; else - dec Str.343; - ret Str.91; + dec Str.345; + ret Str.92; -procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): - joinpoint Str.252 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.259 : U8 = 1i64; - let Str.260 : U8 = GetTagId Str.253; - let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; - if Str.261 then - dec Str.97; - let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; - let Str.101 : Str = StructAtIndex 0 Str.258; - let Str.100 : Str = StructAtIndex 1 Str.258; - let Str.256 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.255 : Str = CallByName Str.3 Str.256 Str.99; - jump Str.252 Str.255 Str.101 Str.98 Str.99; - else +procedure Str.57 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): + joinpoint Str.254 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.255 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.261 : U8 = 1i64; + let Str.262 : U8 = GetTagId Str.255; + let Str.263 : Int1 = lowlevel Eq Str.261 Str.262; + if Str.263 then dec Str.98; + let Str.260 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.255; + let Str.102 : Str = StructAtIndex 0 Str.260; + let Str.101 : Str = StructAtIndex 1 Str.260; + let Str.258 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.257 : Str = CallByName Str.3 Str.258 Str.100; + jump Str.254 Str.257 Str.102 Str.99 Str.100; + else + dec Str.255; + dec Str.100; dec Str.99; - dec Str.253; - let Str.257 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.257; + let Str.259 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.259; in - inc #Derived_gen.7; - inc #Derived_gen.8; - jump Str.252 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; + inc #Derived_gen.3; + inc #Derived_gen.4; + jump Str.254 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.279 : U64 = 0i64; - let Str.278 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.279 Str.125; - ret Str.278; + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.281 : U64 = 0i64; + let Str.280 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.281 Str.126; + ret Str.280; -procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint Str.280 Str.126 Str.127 Str.128 Str.129: - let Str.282 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.282 then - let Str.286 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.286 then +procedure Str.59 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): + joinpoint Str.282 Str.127 Str.128 Str.129 Str.130: + let Str.284 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.284 then + let Str.288 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.288 then dec Str.127; - dec Str.126; - let Str.287 : [C , C U64] = TagId(1) Str.128; - ret Str.287; + dec Str.128; + let Str.289 : [C , C U64] = TagId(1) Str.129; + ret Str.289; else - let Str.285 : U64 = 1i64; - let Str.284 : U64 = CallByName Num.51 Str.128 Str.285; - jump Str.280 Str.126 Str.127 Str.284 Str.129; + let Str.287 : U64 = 1i64; + let Str.286 : U64 = CallByName Num.51 Str.129 Str.287; + jump Str.282 Str.127 Str.128 Str.286 Str.130; else dec Str.127; - dec Str.126; - let Str.281 : [C , C U64] = TagId(0) ; - ret Str.281; + dec Str.128; + let Str.283 : [C , C U64] = TagId(0) ; + ret Str.283; in - inc #Derived_gen.1; - inc #Derived_gen.2; - jump Str.280 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + inc #Derived_gen.5; + inc #Derived_gen.6; + jump Str.282 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; -procedure Str.61 (Str.152, Str.153): - let Str.310 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.310 then - ret Str.152; - else +procedure Str.62 (Str.153, Str.154): + let Str.312 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.312 then ret Str.153; + else + ret Str.154; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.308 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.308 Str.157; - let Str.307 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.307, Str.158}; - let Str.288 : Int1 = CallByName Str.63 Str.289; - ret Str.288; +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.310 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.310 Str.158; + let Str.309 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.309, Str.159}; + let Str.290 : Int1 = CallByName Str.64 Str.291; + ret Str.290; -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.303 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.304 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.303 Str.304; - let Str.293 : U64 = StructAtIndex 0 Str.160; - let Str.294 : Str = StructAtIndex 1 Str.160; - let Str.296 : Str = StructAtIndex 3 Str.160; - let Str.298 : U64 = StructAtIndex 5 Str.160; - let Str.302 : U64 = 1i64; - let Str.300 : U64 = CallByName Num.51 Str.164 Str.302; - let Str.301 : U64 = 1i64; - let Str.299 : U64 = CallByName Num.51 Str.162 Str.301; - let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; - let Str.170 : Int1 = CallByName Str.63 Str.292; - let Str.291 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.291; + let Str.305 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.306 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.305 Str.306; + let Str.295 : U64 = StructAtIndex 0 Str.161; + let Str.296 : Str = StructAtIndex 1 Str.161; + let Str.298 : Str = StructAtIndex 3 Str.161; + let Str.300 : U64 = StructAtIndex 5 Str.161; + let Str.304 : U64 = 1i64; + let Str.302 : U64 = CallByName Num.51 Str.165 Str.304; + let Str.303 : U64 = 1i64; + let Str.301 : U64 = CallByName Num.51 Str.163 Str.303; + let Str.294 : {U64, Str, U64, Str, U64, U64} = Struct {Str.295, Str.296, Str.301, Str.298, Str.302, Str.300}; + let Str.171 : Int1 = CallByName Str.64 Str.294; + let Str.293 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.293; procedure Test.0 (): let Test.5 : Str = "Hello "; diff --git a/crates/compiler/test_mono/generated/dbg_nested_expr.txt b/crates/compiler/test_mono/generated/dbg_nested_expr.txt index c3b19c61fcb..fe5a7e2844f 100644 --- a/crates/compiler/test_mono/generated/dbg_nested_expr.txt +++ b/crates/compiler/test_mono/generated/dbg_nested_expr.txt @@ -39,8 +39,8 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.6 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/dbg_str_followed_by_number.txt b/crates/compiler/test_mono/generated/dbg_str_followed_by_number.txt index 5cc0a2fbe82..b5b30cb6e05 100644 --- a/crates/compiler/test_mono/generated/dbg_str_followed_by_number.txt +++ b/crates/compiler/test_mono/generated/dbg_str_followed_by_number.txt @@ -100,181 +100,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.349 : U8 = 1i64; - let Str.350 : U8 = GetTagId Str.341; - let Str.351 : Int1 = lowlevel Eq Str.349 Str.350; - if Str.351 then - let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341; - let Str.95 : Str = StructAtIndex 0 Str.348; - let Str.94 : Str = StructAtIndex 1 Str.348; - let Str.346 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.345 : Str = CallByName Str.20 Str.346; - let Str.344 : Str = CallByName Str.3 Str.345 Str.94; - dec Str.94; - let Str.343 : Str = CallByName Str.3 Str.344 Str.93; - let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93; - ret Str.342; +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.351 : U8 = 1i64; + let Str.352 : U8 = GetTagId Str.343; + let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; + if Str.353 then + let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; + let Str.96 : Str = StructAtIndex 0 Str.350; + let Str.95 : Str = StructAtIndex 1 Str.350; + let Str.348 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.347 : Str = CallByName Str.20 Str.348; + let Str.346 : Str = CallByName Str.3 Str.347 Str.95; + dec Str.95; + let Str.345 : Str = CallByName Str.3 Str.346 Str.94; + let Str.344 : Str = CallByName Str.57 Str.345 Str.96 Str.93 Str.94; + ret Str.344; else - dec Str.341; - ret Str.91; + dec Str.343; + ret Str.92; -procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else +procedure Str.57 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.7; - inc #Derived_gen.8; - jump Str.250 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; + inc #Derived_gen.3; + inc #Derived_gen.4; + jump Str.252 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; -procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then +procedure Str.59 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.1; - inc #Derived_gen.2; - jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + inc #Derived_gen.5; + inc #Derived_gen.6; + jump Str.280 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then ret Str.153; + else + ret Str.154; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.3 : Str = ""; diff --git a/crates/compiler/test_mono/generated/dec_refcount_for_usage_after_early_return_in_if.txt b/crates/compiler/test_mono/generated/dec_refcount_for_usage_after_early_return_in_if.txt index 88f4f16d633..a8e4ee4f8b7 100644 --- a/crates/compiler/test_mono/generated/dec_refcount_for_usage_after_early_return_in_if.txt +++ b/crates/compiler/test_mono/generated/dec_refcount_for_usage_after_early_return_in_if.txt @@ -11,8 +11,8 @@ procedure Num.96 (#Attr.2): ret Num.284; procedure Str.3 (#Attr.2, #Attr.3): - let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.247; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.1 (Test.2): let Test.3 : Str = CallByName Num.96 Test.2; diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt index eee404c564b..f8e342f925e 100644 --- a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt @@ -164,32 +164,32 @@ procedure Num.96 (#Attr.2): ret Num.287; procedure Str.12 (#Attr.2): - let Str.259 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.259; + let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.261; procedure Str.36 (#Attr.2): - let Str.260 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.260; + let Str.262 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.262; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.45 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.45 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.45; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.325 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt index 89317dea5ee..98be4e72cbd 100644 --- a/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_one_field_string.txt @@ -105,32 +105,32 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.256 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.256; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; procedure Str.36 (#Attr.2): - let Str.257 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.257; + let Str.259 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.259; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.24 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.24 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.24; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.292 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt index 4934cb386bf..a8d9501749f 100644 --- a/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/encode_derived_record_two_field_strings.txt @@ -112,32 +112,32 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.256 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.256; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; procedure Str.36 (#Attr.2): - let Str.257 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.257; + let Str.259 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.259; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.28 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.28 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.28; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.296 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index be968f298f3..8f72c77054d 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -38,32 +38,32 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.256 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.256; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; procedure Str.36 (#Attr.2): - let Str.257 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.257; + let Str.259 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.259; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.3 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.3 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.3; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.259 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt index 6f14951fead..f5ca3921717 100644 --- a/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_one_field_string.txt @@ -110,32 +110,32 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.256 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.256; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; procedure Str.36 (#Attr.2): - let Str.257 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.257; + let Str.259 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.259; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.27 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.27 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.27; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.297 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt index 5e331a1f000..4321239788d 100644 --- a/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_tag_two_payloads_string.txt @@ -113,32 +113,32 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.256 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.256; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; procedure Str.36 (#Attr.2): - let Str.257 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.257; + let Str.259 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.259; procedure Str.43 (#Attr.2): - let Str.254 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; - ret Str.254; - -procedure Str.9 (Str.73): - let Str.74 : {U64, Str, Int1, U8} = CallByName Str.43 Str.73; - let Str.251 : Int1 = StructAtIndex 2 Str.74; - if Str.251 then - let Str.253 : Str = StructAtIndex 1 Str.74; - let Str.252 : [C {U64, U8}, C Str] = TagId(1) Str.253; - ret Str.252; + let Str.256 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.256; + +procedure Str.9 (Str.74): + let Str.75 : {U64, Str, Int1, U8} = CallByName Str.43 Str.74; + let Str.253 : Int1 = StructAtIndex 2 Str.75; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.75; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.249 : U64 = StructAtIndex 0 Str.74; - let Str.250 : U8 = StructAtIndex 3 Str.74; - let #Derived_gen.28 : Str = StructAtIndex 1 Str.74; + let Str.251 : U64 = StructAtIndex 0 Str.75; + let Str.252 : U8 = StructAtIndex 3 Str.75; + let #Derived_gen.28 : Str = StructAtIndex 1 Str.75; dec #Derived_gen.28; - let Str.248 : {U64, U8} = Struct {Str.249, Str.250}; - let Str.246 : [C {U64, U8}, C Str] = TagId(0) Str.248; - ret Str.246; + let Str.250 : {U64, U8} = Struct {Str.251, Str.252}; + let Str.248 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.248; procedure Test.20 (Test.56): let Test.301 : Str = CallByName Encode.23 Test.56; diff --git a/crates/compiler/test_mono/generated/inspect_derived_dict.txt b/crates/compiler/test_mono/generated/inspect_derived_dict.txt index 87ba855f30e..94db78b3b1d 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_dict.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_dict.txt @@ -153,7 +153,7 @@ procedure Dict.43 (Dict.126): let Dict.1102 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Inspect.30 Dict.126; ret Dict.1102; -procedure Dict.45 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47): +procedure Dict.45 (#Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49, #Derived_gen.50, #Derived_gen.51, #Derived_gen.52): joinpoint Dict.745 Dict.228 Dict.229 Dict.230 Dict.231 Dict.232 Dict.233 Dict.234 Dict.235 Dict.236: let Dict.237 : {U32, U32} = CallByName Dict.22 Dict.228 Dict.230; let Dict.792 : U32 = StructAtIndex 1 Dict.237; @@ -196,8 +196,8 @@ procedure Dict.45 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_g let Dict.246 : U32 = CallByName Dict.55 Dict.231; jump Dict.745 Dict.228 Dict.229 Dict.245 Dict.246 Dict.232 Dict.233 Dict.234 Dict.235 Dict.236; in - inc #Derived_gen.43; - jump Dict.745 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47; + inc #Derived_gen.48; + jump Dict.745 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52; procedure Dict.48 (): let Dict.869 : U32 = 0i64; @@ -312,7 +312,7 @@ procedure Dict.72 (Dict.413, Dict.414, Dict.415): let Dict.855 : {U64, U32} = CallByName Dict.73 Dict.413 Dict.418 Dict.417; ret Dict.855; -procedure Dict.73 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17): +procedure Dict.73 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18): joinpoint Dict.856 Dict.419 Dict.420 Dict.421: let Dict.422 : {U32, U32} = CallByName Dict.22 Dict.419 Dict.420; let Dict.863 : U32 = StructAtIndex 1 Dict.422; @@ -327,10 +327,10 @@ procedure Dict.73 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17): let Dict.857 : {U64, U32} = Struct {Dict.420, Dict.421}; ret Dict.857; in - inc #Derived_gen.15; - jump Dict.856 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; + inc #Derived_gen.16; + jump Dict.856 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; -procedure Dict.74 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50): +procedure Dict.74 (#Derived_gen.53, #Derived_gen.54, #Derived_gen.55): joinpoint Dict.762 Dict.423 Dict.424 Dict.425: let Dict.426 : {U32, U32} = CallByName Dict.22 Dict.423 Dict.425; let Dict.772 : U32 = StructAtIndex 1 Dict.426; @@ -349,7 +349,7 @@ procedure Dict.74 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50): let Dict.763 : List {U32, U32} = CallByName List.3 Dict.423 Dict.425 Dict.424; ret Dict.763; in - jump Dict.762 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50; + jump Dict.762 #Derived_gen.53 #Derived_gen.54 #Derived_gen.55; procedure Dict.75 (Dict.428, Dict.429): let Dict.758 : U64 = 1i64; @@ -919,7 +919,7 @@ procedure List.101 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_ inc #Derived_gen.10; jump List.678 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure List.101 (#Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54, #Derived_gen.55): +procedure List.101 (#Derived_gen.56, #Derived_gen.57, #Derived_gen.58, #Derived_gen.59, #Derived_gen.60): joinpoint List.742 List.175 List.176 List.177 List.178 List.179: let List.744 : Int1 = CallByName Num.22 List.178 List.179; if List.744 then @@ -933,10 +933,10 @@ procedure List.101 (#Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_ dec List.175; ret List.176; in - inc #Derived_gen.51; - jump List.742 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54 #Derived_gen.55; + inc #Derived_gen.56; + jump List.742 #Derived_gen.56 #Derived_gen.57 #Derived_gen.58 #Derived_gen.59 #Derived_gen.60; -procedure List.102 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): +procedure List.102 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): joinpoint List.717 List.184 List.185 List.186 List.187 List.188: let List.719 : Int1 = CallByName Num.22 List.187 List.188; if List.719 then @@ -950,8 +950,8 @@ procedure List.102 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_ dec List.184; ret List.185; in - inc #Derived_gen.23; - jump List.717 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + inc #Derived_gen.24; + jump List.717 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure List.11 (List.150, List.151): let List.737 : List {U32, U32} = CallByName List.68 List.151; @@ -1054,7 +1054,7 @@ procedure List.83 (List.181, List.182, List.183): let List.714 : List {U32, U32} = CallByName List.102 List.181 List.182 List.183 List.715 List.716; ret List.714; -procedure List.99 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22): +procedure List.99 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23): joinpoint List.726 List.152 List.153 List.154: let List.734 : U64 = 0i64; let List.728 : Int1 = CallByName Num.24 List.153 List.734; @@ -1066,7 +1066,7 @@ procedure List.99 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22): else ret List.154; in - jump List.726 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.726 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; procedure Num.131 (#Attr.2): let Num.291 : U32 = lowlevel NumIntCast #Attr.2; @@ -1208,185 +1208,185 @@ procedure Num.96 (#Attr.2): ret Num.440; procedure Str.12 (#Attr.2): - let Str.248 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.248; + let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.250; procedure Str.20 (#Attr.2): - let Str.316 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.316; + let Str.318 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.318; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; procedure Str.35 (#Attr.2, #Attr.3): - let Str.306 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.306; + let Str.308 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.308; procedure Str.36 (#Attr.2): - let Str.269 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.269; + let Str.271 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.271; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.267 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.267; - -procedure Str.38 (Str.112, Str.113): - let Str.263 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.276 : U8 = 1i64; - let Str.277 : U8 = GetTagId Str.263; - let Str.278 : Int1 = lowlevel Eq Str.276 Str.277; - if Str.278 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.263; - let Str.272 : U64 = CallByName Str.36 Str.112; - let Str.273 : U64 = CallByName Str.36 Str.113; - let Str.271 : U64 = CallByName Num.20 Str.272 Str.273; - let Str.115 : U64 = CallByName Num.20 Str.271 Str.114; - let Str.270 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.270 Str.114; - let Str.268 : U64 = CallByName Str.36 Str.113; - let Str.266 : U64 = CallByName Num.51 Str.114 Str.268; - let Str.117 : Str = CallByName Str.37 Str.112 Str.266 Str.115; - let Str.265 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.264 : [C {}, C {Str, Str}] = TagId(1) Str.265; - ret Str.264; + let Str.269 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.269; + +procedure Str.38 (Str.113, Str.114): + let Str.265 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.278 : U8 = 1i64; + let Str.279 : U8 = GetTagId Str.265; + let Str.280 : Int1 = lowlevel Eq Str.278 Str.279; + if Str.280 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.265; + let Str.274 : U64 = CallByName Str.36 Str.113; + let Str.275 : U64 = CallByName Str.36 Str.114; + let Str.273 : U64 = CallByName Num.20 Str.274 Str.275; + let Str.116 : U64 = CallByName Num.20 Str.273 Str.115; + let Str.272 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.272 Str.115; + let Str.270 : U64 = CallByName Str.36 Str.114; + let Str.268 : U64 = CallByName Num.51 Str.115 Str.270; + let Str.118 : Str = CallByName Str.37 Str.113 Str.268 Str.116; + let Str.267 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.266 : [C {}, C {Str, Str}] = TagId(1) Str.267; + ret Str.266; else - dec Str.112; - let Str.275 : {} = Struct {}; - let Str.274 : [C {}, C {Str, Str}] = TagId(0) Str.275; - ret Str.274; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.344 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.352 : U8 = 1i64; - let Str.353 : U8 = GetTagId Str.344; - let Str.354 : Int1 = lowlevel Eq Str.352 Str.353; - if Str.354 then - let Str.351 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.344; - let Str.95 : Str = StructAtIndex 0 Str.351; - let Str.94 : Str = StructAtIndex 1 Str.351; - let Str.349 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.348 : Str = CallByName Str.20 Str.349; - let Str.347 : Str = CallByName Str.3 Str.348 Str.94; - dec Str.94; - let Str.346 : Str = CallByName Str.3 Str.347 Str.93; - let Str.345 : Str = CallByName Str.56 Str.346 Str.95 Str.92 Str.93; - ret Str.345; + dec Str.113; + let Str.277 : {} = Struct {}; + let Str.276 : [C {}, C {Str, Str}] = TagId(0) Str.277; + ret Str.276; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.346 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.354 : U8 = 1i64; + let Str.355 : U8 = GetTagId Str.346; + let Str.356 : Int1 = lowlevel Eq Str.354 Str.355; + if Str.356 then + let Str.353 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.346; + let Str.96 : Str = StructAtIndex 0 Str.353; + let Str.95 : Str = StructAtIndex 1 Str.353; + let Str.351 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.350 : Str = CallByName Str.20 Str.351; + let Str.349 : Str = CallByName Str.3 Str.350 Str.95; + dec Str.95; + let Str.348 : Str = CallByName Str.3 Str.349 Str.94; + let Str.347 : Str = CallByName Str.57 Str.348 Str.96 Str.93 Str.94; + ret Str.347; else - dec Str.344; - ret Str.91; - -procedure Str.56 (#Derived_gen.56, #Derived_gen.57, #Derived_gen.58, #Derived_gen.59): - joinpoint Str.253 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.254 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.260 : U8 = 1i64; - let Str.261 : U8 = GetTagId Str.254; - let Str.262 : Int1 = lowlevel Eq Str.260 Str.261; - if Str.262 then - dec Str.97; - let Str.259 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.254; - let Str.101 : Str = StructAtIndex 0 Str.259; - let Str.100 : Str = StructAtIndex 1 Str.259; - let Str.257 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.256 : Str = CallByName Str.3 Str.257 Str.99; - jump Str.253 Str.256 Str.101 Str.98 Str.99; - else + dec Str.346; + ret Str.92; + +procedure Str.57 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43): + joinpoint Str.255 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.256 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.262 : U8 = 1i64; + let Str.263 : U8 = GetTagId Str.256; + let Str.264 : Int1 = lowlevel Eq Str.262 Str.263; + if Str.264 then dec Str.98; + let Str.261 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.256; + let Str.102 : Str = StructAtIndex 0 Str.261; + let Str.101 : Str = StructAtIndex 1 Str.261; + let Str.259 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.258 : Str = CallByName Str.3 Str.259 Str.100; + jump Str.255 Str.258 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - dec Str.254; - let Str.258 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.258; + dec Str.256; + let Str.260 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.260; in - inc #Derived_gen.58; - inc #Derived_gen.59; - jump Str.253 #Derived_gen.56 #Derived_gen.57 #Derived_gen.58 #Derived_gen.59; + inc #Derived_gen.43; + inc #Derived_gen.42; + jump Str.255 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.280 : U64 = 0i64; - let Str.279 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.280 Str.125; - ret Str.279; - -procedure Str.58 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36): - joinpoint Str.281 Str.126 Str.127 Str.128 Str.129: - let Str.283 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.283 then - let Str.287 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.287 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.282 : U64 = 0i64; + let Str.281 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.282 Str.126; + ret Str.281; + +procedure Str.59 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32): + joinpoint Str.283 Str.127 Str.128 Str.129 Str.130: + let Str.285 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.285 then + let Str.289 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.289 then dec Str.127; - dec Str.126; - let Str.288 : [C , C U64] = TagId(1) Str.128; - ret Str.288; + dec Str.128; + let Str.290 : [C , C U64] = TagId(1) Str.129; + ret Str.290; else - let Str.286 : U64 = 1i64; - let Str.285 : U64 = CallByName Num.51 Str.128 Str.286; - jump Str.281 Str.126 Str.127 Str.285 Str.129; + let Str.288 : U64 = 1i64; + let Str.287 : U64 = CallByName Num.51 Str.129 Str.288; + jump Str.283 Str.127 Str.128 Str.287 Str.130; else dec Str.127; - dec Str.126; - let Str.282 : [C , C U64] = TagId(0) ; - ret Str.282; + dec Str.128; + let Str.284 : [C , C U64] = TagId(0) ; + ret Str.284; in - inc #Derived_gen.34; - inc #Derived_gen.33; - jump Str.281 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36; - -procedure Str.61 (Str.152, Str.153): - let Str.311 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.311 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.29; + inc #Derived_gen.30; + jump Str.283 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.309 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.309 Str.157; - let Str.308 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.308, Str.158}; - let Str.289 : Int1 = CallByName Str.63 Str.290; - ret Str.289; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.313 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.313 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.311 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.311 Str.158; + let Str.310 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.310, Str.159}; + let Str.291 : Int1 = CallByName Str.64 Str.292; + ret Str.291; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.304 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.305 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.304 Str.305; - let Str.294 : U64 = StructAtIndex 0 Str.160; - let Str.295 : Str = StructAtIndex 1 Str.160; - let Str.297 : Str = StructAtIndex 3 Str.160; - let Str.299 : U64 = StructAtIndex 5 Str.160; - let Str.303 : U64 = 1i64; - let Str.301 : U64 = CallByName Num.51 Str.164 Str.303; - let Str.302 : U64 = 1i64; - let Str.300 : U64 = CallByName Num.51 Str.162 Str.302; - let Str.293 : {U64, Str, U64, Str, U64, U64} = Struct {Str.294, Str.295, Str.300, Str.297, Str.301, Str.299}; - let Str.170 : Int1 = CallByName Str.63 Str.293; - let Str.292 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.292; + let Str.306 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.307 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.306 Str.307; + let Str.296 : U64 = StructAtIndex 0 Str.161; + let Str.297 : Str = StructAtIndex 1 Str.161; + let Str.299 : Str = StructAtIndex 3 Str.161; + let Str.301 : U64 = StructAtIndex 5 Str.161; + let Str.305 : U64 = 1i64; + let Str.303 : U64 = CallByName Num.51 Str.165 Str.305; + let Str.304 : U64 = 1i64; + let Str.302 : U64 = CallByName Num.51 Str.163 Str.304; + let Str.295 : {U64, Str, U64, Str, U64, U64} = Struct {Str.296, Str.297, Str.302, Str.299, Str.303, Str.301}; + let Str.171 : Int1 = CallByName Str.64 Str.295; + let Str.294 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.294; procedure Test.0 (): let Test.8 : Str = "a"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_list.txt b/crates/compiler/test_mono/generated/inspect_derived_list.txt index 8fc98930c4b..4e9f30f923d 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_list.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_list.txt @@ -163,8 +163,8 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.2 : List I64 = Array [1i64, 2i64, 3i64]; diff --git a/crates/compiler/test_mono/generated/inspect_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/inspect_derived_nested_record_string.txt index 25343efbcc9..4108ab379f5 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_nested_record_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_nested_record_string.txt @@ -252,7 +252,7 @@ procedure List.101 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_ inc #Derived_gen.20; jump List.678 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; -procedure List.101 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43): +procedure List.101 (#Derived_gen.36, #Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40): joinpoint List.690 List.175 List.176 List.177 List.178 List.179: let List.692 : Int1 = CallByName Num.22 List.178 List.179; if List.692 then @@ -266,8 +266,8 @@ procedure List.101 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_ dec List.175; ret List.176; in - inc #Derived_gen.39; - jump List.690 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43; + inc #Derived_gen.36; + jump List.690 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40; procedure List.18 (List.172, List.173, List.174): let List.676 : U64 = 0i64; @@ -326,181 +326,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.295; procedure Str.20 (#Attr.2): - let Str.314 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.314; + let Str.316 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.316; procedure Str.3 (#Attr.2, #Attr.3): - let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.247; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Str.35 (#Attr.2, #Attr.3): - let Str.304 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.304; + let Str.306 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.306; procedure Str.36 (#Attr.2): - let Str.267 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.267; + let Str.269 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.269; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.265 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.265; - -procedure Str.38 (Str.112, Str.113): - let Str.261 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.274 : U8 = 1i64; - let Str.275 : U8 = GetTagId Str.261; - let Str.276 : Int1 = lowlevel Eq Str.274 Str.275; - if Str.276 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.261; - let Str.270 : U64 = CallByName Str.36 Str.112; - let Str.271 : U64 = CallByName Str.36 Str.113; - let Str.269 : U64 = CallByName Num.20 Str.270 Str.271; - let Str.115 : U64 = CallByName Num.20 Str.269 Str.114; - let Str.268 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.268 Str.114; - let Str.266 : U64 = CallByName Str.36 Str.113; - let Str.264 : U64 = CallByName Num.51 Str.114 Str.266; - let Str.117 : Str = CallByName Str.37 Str.112 Str.264 Str.115; - let Str.263 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.262 : [C {}, C {Str, Str}] = TagId(1) Str.263; - ret Str.262; + let Str.267 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.267; + +procedure Str.38 (Str.113, Str.114): + let Str.263 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.276 : U8 = 1i64; + let Str.277 : U8 = GetTagId Str.263; + let Str.278 : Int1 = lowlevel Eq Str.276 Str.277; + if Str.278 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.263; + let Str.272 : U64 = CallByName Str.36 Str.113; + let Str.273 : U64 = CallByName Str.36 Str.114; + let Str.271 : U64 = CallByName Num.20 Str.272 Str.273; + let Str.116 : U64 = CallByName Num.20 Str.271 Str.115; + let Str.270 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.270 Str.115; + let Str.268 : U64 = CallByName Str.36 Str.114; + let Str.266 : U64 = CallByName Num.51 Str.115 Str.268; + let Str.118 : Str = CallByName Str.37 Str.113 Str.266 Str.116; + let Str.265 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.264 : [C {}, C {Str, Str}] = TagId(1) Str.265; + ret Str.264; else - dec Str.112; - let Str.273 : {} = Struct {}; - let Str.272 : [C {}, C {Str, Str}] = TagId(0) Str.273; - ret Str.272; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.342 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.350 : U8 = 1i64; - let Str.351 : U8 = GetTagId Str.342; - let Str.352 : Int1 = lowlevel Eq Str.350 Str.351; - if Str.352 then - let Str.349 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.342; - let Str.95 : Str = StructAtIndex 0 Str.349; - let Str.94 : Str = StructAtIndex 1 Str.349; - let Str.347 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.346 : Str = CallByName Str.20 Str.347; - let Str.345 : Str = CallByName Str.3 Str.346 Str.94; - dec Str.94; - let Str.344 : Str = CallByName Str.3 Str.345 Str.93; - let Str.343 : Str = CallByName Str.56 Str.344 Str.95 Str.92 Str.93; - ret Str.343; + dec Str.113; + let Str.275 : {} = Struct {}; + let Str.274 : [C {}, C {Str, Str}] = TagId(0) Str.275; + ret Str.274; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.344 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.352 : U8 = 1i64; + let Str.353 : U8 = GetTagId Str.344; + let Str.354 : Int1 = lowlevel Eq Str.352 Str.353; + if Str.354 then + let Str.351 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.344; + let Str.96 : Str = StructAtIndex 0 Str.351; + let Str.95 : Str = StructAtIndex 1 Str.351; + let Str.349 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.348 : Str = CallByName Str.20 Str.349; + let Str.347 : Str = CallByName Str.3 Str.348 Str.95; + dec Str.95; + let Str.346 : Str = CallByName Str.3 Str.347 Str.94; + let Str.345 : Str = CallByName Str.57 Str.346 Str.96 Str.93 Str.94; + ret Str.345; else - dec Str.342; - ret Str.91; - -procedure Str.56 (#Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): - joinpoint Str.251 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.252 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.258 : U8 = 1i64; - let Str.259 : U8 = GetTagId Str.252; - let Str.260 : Int1 = lowlevel Eq Str.258 Str.259; - if Str.260 then - dec Str.97; - let Str.257 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.252; - let Str.101 : Str = StructAtIndex 0 Str.257; - let Str.100 : Str = StructAtIndex 1 Str.257; - let Str.255 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.254 : Str = CallByName Str.3 Str.255 Str.99; - jump Str.251 Str.254 Str.101 Str.98 Str.99; - else + dec Str.344; + ret Str.92; + +procedure Str.57 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): + joinpoint Str.253 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.254 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.260 : U8 = 1i64; + let Str.261 : U8 = GetTagId Str.254; + let Str.262 : Int1 = lowlevel Eq Str.260 Str.261; + if Str.262 then dec Str.98; - dec Str.252; + let Str.259 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.254; + let Str.102 : Str = StructAtIndex 0 Str.259; + let Str.101 : Str = StructAtIndex 1 Str.259; + let Str.257 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.256 : Str = CallByName Str.3 Str.257 Str.100; + jump Str.253 Str.256 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.256 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.256; + dec Str.254; + let Str.258 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.258; in - inc #Derived_gen.29; - inc #Derived_gen.30; - jump Str.251 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + inc #Derived_gen.28; + inc #Derived_gen.27; + jump Str.253 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.278 : U64 = 0i64; - let Str.277 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.278 Str.125; - ret Str.277; - -procedure Str.58 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36): - joinpoint Str.279 Str.126 Str.127 Str.128 Str.129: - let Str.281 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.281 then - let Str.285 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.285 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.280 : U64 = 0i64; + let Str.279 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.280 Str.126; + ret Str.279; + +procedure Str.59 (#Derived_gen.43, #Derived_gen.44, #Derived_gen.45, #Derived_gen.46): + joinpoint Str.281 Str.127 Str.128 Str.129 Str.130: + let Str.283 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.283 then + let Str.287 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.287 then dec Str.127; - dec Str.126; - let Str.286 : [C , C U64] = TagId(1) Str.128; - ret Str.286; + dec Str.128; + let Str.288 : [C , C U64] = TagId(1) Str.129; + ret Str.288; else - let Str.284 : U64 = 1i64; - let Str.283 : U64 = CallByName Num.51 Str.128 Str.284; - jump Str.279 Str.126 Str.127 Str.283 Str.129; + let Str.286 : U64 = 1i64; + let Str.285 : U64 = CallByName Num.51 Str.129 Str.286; + jump Str.281 Str.127 Str.128 Str.285 Str.130; else dec Str.127; - dec Str.126; - let Str.280 : [C , C U64] = TagId(0) ; - ret Str.280; + dec Str.128; + let Str.282 : [C , C U64] = TagId(0) ; + ret Str.282; in - inc #Derived_gen.34; - inc #Derived_gen.33; - jump Str.279 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36; - -procedure Str.61 (Str.152, Str.153): - let Str.309 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.309 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.44; + inc #Derived_gen.43; + jump Str.281 #Derived_gen.43 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.307 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.307 Str.157; - let Str.306 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.288 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.306, Str.158}; - let Str.287 : Int1 = CallByName Str.63 Str.288; - ret Str.287; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.311 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.311 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.309 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.309 Str.158; + let Str.308 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.308, Str.159}; + let Str.289 : Int1 = CallByName Str.64 Str.290; + ret Str.289; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.302 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.303 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.302 Str.303; - let Str.292 : U64 = StructAtIndex 0 Str.160; - let Str.293 : Str = StructAtIndex 1 Str.160; - let Str.295 : Str = StructAtIndex 3 Str.160; - let Str.297 : U64 = StructAtIndex 5 Str.160; - let Str.301 : U64 = 1i64; - let Str.299 : U64 = CallByName Num.51 Str.164 Str.301; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.162 Str.300; - let Str.291 : {U64, Str, U64, Str, U64, U64} = Struct {Str.292, Str.293, Str.298, Str.295, Str.299, Str.297}; - let Str.170 : Int1 = CallByName Str.63 Str.291; - let Str.290 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.290; + let Str.304 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.305 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.304 Str.305; + let Str.294 : U64 = StructAtIndex 0 Str.161; + let Str.295 : Str = StructAtIndex 1 Str.161; + let Str.297 : Str = StructAtIndex 3 Str.161; + let Str.299 : U64 = StructAtIndex 5 Str.161; + let Str.303 : U64 = 1i64; + let Str.301 : U64 = CallByName Num.51 Str.165 Str.303; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.163 Str.302; + let Str.293 : {U64, Str, U64, Str, U64, U64} = Struct {Str.294, Str.295, Str.300, Str.297, Str.301, Str.299}; + let Str.171 : Int1 = CallByName Str.64 Str.293; + let Str.292 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.292; procedure Test.0 (): let Test.4 : Str = "bar"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_record.txt b/crates/compiler/test_mono/generated/inspect_derived_record.txt index 0c7d6db97f2..a1a11e70215 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record.txt @@ -198,8 +198,8 @@ procedure Num.96 (#Attr.2): ret Num.284; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.3 : Decimal = 3dec; diff --git a/crates/compiler/test_mono/generated/inspect_derived_record_one_field_string.txt b/crates/compiler/test_mono/generated/inspect_derived_record_one_field_string.txt index 8fa307c5a98..0fee4143606 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record_one_field_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record_one_field_string.txt @@ -220,181 +220,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; - -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; + +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.349 : U8 = 1i64; - let Str.350 : U8 = GetTagId Str.341; - let Str.351 : Int1 = lowlevel Eq Str.349 Str.350; - if Str.351 then - let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341; - let Str.95 : Str = StructAtIndex 0 Str.348; - let Str.94 : Str = StructAtIndex 1 Str.348; - let Str.346 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.345 : Str = CallByName Str.20 Str.346; - let Str.344 : Str = CallByName Str.3 Str.345 Str.94; - dec Str.94; - let Str.343 : Str = CallByName Str.3 Str.344 Str.93; - let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93; - ret Str.342; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.351 : U8 = 1i64; + let Str.352 : U8 = GetTagId Str.343; + let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; + if Str.353 then + let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; + let Str.96 : Str = StructAtIndex 0 Str.350; + let Str.95 : Str = StructAtIndex 1 Str.350; + let Str.348 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.347 : Str = CallByName Str.20 Str.348; + let Str.346 : Str = CallByName Str.3 Str.347 Str.95; + dec Str.95; + let Str.345 : Str = CallByName Str.3 Str.346 Str.94; + let Str.344 : Str = CallByName Str.57 Str.345 Str.96 Str.93 Str.94; + ret Str.344; else - dec Str.341; - ret Str.91; - -procedure Str.56 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else + dec Str.343; + ret Str.92; + +procedure Str.57 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.27; - inc #Derived_gen.26; - jump Str.250 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + inc #Derived_gen.23; + inc #Derived_gen.24; + jump Str.252 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; - -procedure Str.58 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; + +procedure Str.59 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.20; - inc #Derived_gen.21; - jump Str.278 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; - -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.17; + inc #Derived_gen.18; + jump Str.280 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.3 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_record_two_field_strings.txt b/crates/compiler/test_mono/generated/inspect_derived_record_two_field_strings.txt index a872fbd68a2..0620837bd41 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record_two_field_strings.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record_two_field_strings.txt @@ -227,181 +227,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; - -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; + +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.385 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.393 : U8 = 1i64; - let Str.394 : U8 = GetTagId Str.385; - let Str.395 : Int1 = lowlevel Eq Str.393 Str.394; - if Str.395 then - let Str.392 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.385; - let Str.95 : Str = StructAtIndex 0 Str.392; - let Str.94 : Str = StructAtIndex 1 Str.392; - let Str.390 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.389 : Str = CallByName Str.20 Str.390; - let Str.388 : Str = CallByName Str.3 Str.389 Str.94; - dec Str.94; - let Str.387 : Str = CallByName Str.3 Str.388 Str.93; - let Str.386 : Str = CallByName Str.56 Str.387 Str.95 Str.92 Str.93; - ret Str.386; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.387 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.395 : U8 = 1i64; + let Str.396 : U8 = GetTagId Str.387; + let Str.397 : Int1 = lowlevel Eq Str.395 Str.396; + if Str.397 then + let Str.394 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.387; + let Str.96 : Str = StructAtIndex 0 Str.394; + let Str.95 : Str = StructAtIndex 1 Str.394; + let Str.392 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.391 : Str = CallByName Str.20 Str.392; + let Str.390 : Str = CallByName Str.3 Str.391 Str.95; + dec Str.95; + let Str.389 : Str = CallByName Str.3 Str.390 Str.94; + let Str.388 : Str = CallByName Str.57 Str.389 Str.96 Str.93 Str.94; + ret Str.388; else - dec Str.385; - ret Str.91; - -procedure Str.56 (#Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else + dec Str.387; + ret Str.92; + +procedure Str.57 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.30; - inc #Derived_gen.31; - jump Str.250 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31; + inc #Derived_gen.28; + inc #Derived_gen.27; + jump Str.252 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; - -procedure Str.58 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; + +procedure Str.59 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.24; - inc #Derived_gen.25; - jump Str.278 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; - -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.21; + inc #Derived_gen.22; + jump Str.280 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.3 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_string.txt b/crates/compiler/test_mono/generated/inspect_derived_string.txt index d51bf516840..1df2332d2e9 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_string.txt @@ -100,181 +100,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.349 : U8 = 1i64; - let Str.350 : U8 = GetTagId Str.341; - let Str.351 : Int1 = lowlevel Eq Str.349 Str.350; - if Str.351 then - let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341; - let Str.95 : Str = StructAtIndex 0 Str.348; - let Str.94 : Str = StructAtIndex 1 Str.348; - let Str.346 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.345 : Str = CallByName Str.20 Str.346; - let Str.344 : Str = CallByName Str.3 Str.345 Str.94; - dec Str.94; - let Str.343 : Str = CallByName Str.3 Str.344 Str.93; - let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93; - ret Str.342; +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.351 : U8 = 1i64; + let Str.352 : U8 = GetTagId Str.343; + let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; + if Str.353 then + let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; + let Str.96 : Str = StructAtIndex 0 Str.350; + let Str.95 : Str = StructAtIndex 1 Str.350; + let Str.348 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.347 : Str = CallByName Str.20 Str.348; + let Str.346 : Str = CallByName Str.3 Str.347 Str.95; + dec Str.95; + let Str.345 : Str = CallByName Str.3 Str.346 Str.94; + let Str.344 : Str = CallByName Str.57 Str.345 Str.96 Str.93 Str.94; + ret Str.344; else - dec Str.341; - ret Str.91; + dec Str.343; + ret Str.92; -procedure Str.56 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else +procedure Str.57 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.7; - inc #Derived_gen.8; - jump Str.250 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; + inc #Derived_gen.3; + inc #Derived_gen.4; + jump Str.252 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; -procedure Str.58 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then +procedure Str.59 (#Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.1; - inc #Derived_gen.2; - jump Str.278 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + inc #Derived_gen.5; + inc #Derived_gen.6; + jump Str.280 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then ret Str.153; + else + ret Str.154; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.2 : Str = "abc"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_tag_one_field_string.txt b/crates/compiler/test_mono/generated/inspect_derived_tag_one_field_string.txt index 8cb85717576..348f2361412 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_tag_one_field_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_tag_one_field_string.txt @@ -162,7 +162,7 @@ procedure List.1 (List.119): let List.687 : Int1 = CallByName Bool.11 List.688 List.689; ret List.687; -procedure List.101 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): +procedure List.101 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19): joinpoint List.678 List.175 List.176 List.177 List.178 List.179: let List.680 : Int1 = CallByName Num.22 List.178 List.179; if List.680 then @@ -177,8 +177,8 @@ procedure List.101 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_ dec List.175; ret List.176; in - inc #Derived_gen.11; - jump List.678 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; + inc #Derived_gen.15; + jump List.678 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19; procedure List.18 (List.172, List.173, List.174): let List.676 : U64 = 0i64; @@ -223,181 +223,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; - -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; + +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.341 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.349 : U8 = 1i64; - let Str.350 : U8 = GetTagId Str.341; - let Str.351 : Int1 = lowlevel Eq Str.349 Str.350; - if Str.351 then - let Str.348 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.341; - let Str.95 : Str = StructAtIndex 0 Str.348; - let Str.94 : Str = StructAtIndex 1 Str.348; - let Str.346 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.345 : Str = CallByName Str.20 Str.346; - let Str.344 : Str = CallByName Str.3 Str.345 Str.94; - dec Str.94; - let Str.343 : Str = CallByName Str.3 Str.344 Str.93; - let Str.342 : Str = CallByName Str.56 Str.343 Str.95 Str.92 Str.93; - ret Str.342; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.343 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.351 : U8 = 1i64; + let Str.352 : U8 = GetTagId Str.343; + let Str.353 : Int1 = lowlevel Eq Str.351 Str.352; + if Str.353 then + let Str.350 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.343; + let Str.96 : Str = StructAtIndex 0 Str.350; + let Str.95 : Str = StructAtIndex 1 Str.350; + let Str.348 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.347 : Str = CallByName Str.20 Str.348; + let Str.346 : Str = CallByName Str.3 Str.347 Str.95; + dec Str.95; + let Str.345 : Str = CallByName Str.3 Str.346 Str.94; + let Str.344 : Str = CallByName Str.57 Str.345 Str.96 Str.93 Str.94; + ret Str.344; else - dec Str.341; - ret Str.91; - -procedure Str.56 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else + dec Str.343; + ret Str.92; + +procedure Str.57 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.27; - inc #Derived_gen.26; - jump Str.250 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + inc #Derived_gen.23; + inc #Derived_gen.22; + jump Str.252 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; - -procedure Str.58 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; + +procedure Str.59 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.18; - inc #Derived_gen.19; - jump Str.278 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; - -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.11; + inc #Derived_gen.12; + jump Str.280 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.4 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/inspect_derived_tag_two_payloads_string.txt b/crates/compiler/test_mono/generated/inspect_derived_tag_two_payloads_string.txt index b5d821a1585..8585bc2152b 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_tag_two_payloads_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_tag_two_payloads_string.txt @@ -226,181 +226,181 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.293; procedure Str.20 (#Attr.2): - let Str.313 : Str = lowlevel StrWithCapacity #Attr.2; - ret Str.313; + let Str.315 : Str = lowlevel StrWithCapacity #Attr.2; + ret Str.315; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Str.35 (#Attr.2, #Attr.3): - let Str.303 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; - ret Str.303; + let Str.305 : U8 = lowlevel StrGetUnsafe #Attr.2 #Attr.3; + ret Str.305; procedure Str.36 (#Attr.2): - let Str.266 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.266; + let Str.268 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.268; procedure Str.37 (#Attr.2, #Attr.3, #Attr.4): - let Str.264 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; - ret Str.264; - -procedure Str.38 (Str.112, Str.113): - let Str.260 : [C , C U64] = CallByName Str.57 Str.112 Str.113; - let Str.273 : U8 = 1i64; - let Str.274 : U8 = GetTagId Str.260; - let Str.275 : Int1 = lowlevel Eq Str.273 Str.274; - if Str.275 then - let Str.114 : U64 = UnionAtIndex (Id 1) (Index 0) Str.260; - let Str.269 : U64 = CallByName Str.36 Str.112; - let Str.270 : U64 = CallByName Str.36 Str.113; - let Str.268 : U64 = CallByName Num.20 Str.269 Str.270; - let Str.115 : U64 = CallByName Num.20 Str.268 Str.114; - let Str.267 : U64 = 0i64; - inc Str.112; - let Str.116 : Str = CallByName Str.37 Str.112 Str.267 Str.114; - let Str.265 : U64 = CallByName Str.36 Str.113; - let Str.263 : U64 = CallByName Num.51 Str.114 Str.265; - let Str.117 : Str = CallByName Str.37 Str.112 Str.263 Str.115; - let Str.262 : {Str, Str} = Struct {Str.117, Str.116}; - let Str.261 : [C {}, C {Str, Str}] = TagId(1) Str.262; - ret Str.261; + let Str.266 : Str = lowlevel StrSubstringUnsafe #Attr.2 #Attr.3 #Attr.4; + ret Str.266; + +procedure Str.38 (Str.113, Str.114): + let Str.262 : [C , C U64] = CallByName Str.58 Str.113 Str.114; + let Str.275 : U8 = 1i64; + let Str.276 : U8 = GetTagId Str.262; + let Str.277 : Int1 = lowlevel Eq Str.275 Str.276; + if Str.277 then + let Str.115 : U64 = UnionAtIndex (Id 1) (Index 0) Str.262; + let Str.271 : U64 = CallByName Str.36 Str.113; + let Str.272 : U64 = CallByName Str.36 Str.114; + let Str.270 : U64 = CallByName Num.20 Str.271 Str.272; + let Str.116 : U64 = CallByName Num.20 Str.270 Str.115; + let Str.269 : U64 = 0i64; + inc Str.113; + let Str.117 : Str = CallByName Str.37 Str.113 Str.269 Str.115; + let Str.267 : U64 = CallByName Str.36 Str.114; + let Str.265 : U64 = CallByName Num.51 Str.115 Str.267; + let Str.118 : Str = CallByName Str.37 Str.113 Str.265 Str.116; + let Str.264 : {Str, Str} = Struct {Str.118, Str.117}; + let Str.263 : [C {}, C {Str, Str}] = TagId(1) Str.264; + ret Str.263; else - dec Str.112; - let Str.272 : {} = Struct {}; - let Str.271 : [C {}, C {Str, Str}] = TagId(0) Str.272; - ret Str.271; - -procedure Str.45 (Str.91, Str.92, Str.93): - inc Str.91; - let Str.385 : [C {}, C {Str, Str}] = CallByName Str.38 Str.91 Str.92; - let Str.393 : U8 = 1i64; - let Str.394 : U8 = GetTagId Str.385; - let Str.395 : Int1 = lowlevel Eq Str.393 Str.394; - if Str.395 then - let Str.392 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.385; - let Str.95 : Str = StructAtIndex 0 Str.392; - let Str.94 : Str = StructAtIndex 1 Str.392; - let Str.390 : U64 = CallByName Str.36 Str.91; - dec Str.91; - let Str.389 : Str = CallByName Str.20 Str.390; - let Str.388 : Str = CallByName Str.3 Str.389 Str.94; - dec Str.94; - let Str.387 : Str = CallByName Str.3 Str.388 Str.93; - let Str.386 : Str = CallByName Str.56 Str.387 Str.95 Str.92 Str.93; - ret Str.386; + dec Str.113; + let Str.274 : {} = Struct {}; + let Str.273 : [C {}, C {Str, Str}] = TagId(0) Str.274; + ret Str.273; + +procedure Str.45 (Str.92, Str.93, Str.94): + inc Str.92; + let Str.387 : [C {}, C {Str, Str}] = CallByName Str.38 Str.92 Str.93; + let Str.395 : U8 = 1i64; + let Str.396 : U8 = GetTagId Str.387; + let Str.397 : Int1 = lowlevel Eq Str.395 Str.396; + if Str.397 then + let Str.394 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.387; + let Str.96 : Str = StructAtIndex 0 Str.394; + let Str.95 : Str = StructAtIndex 1 Str.394; + let Str.392 : U64 = CallByName Str.36 Str.92; + dec Str.92; + let Str.391 : Str = CallByName Str.20 Str.392; + let Str.390 : Str = CallByName Str.3 Str.391 Str.95; + dec Str.95; + let Str.389 : Str = CallByName Str.3 Str.390 Str.94; + let Str.388 : Str = CallByName Str.57 Str.389 Str.96 Str.93 Str.94; + ret Str.388; else - dec Str.385; - ret Str.91; - -procedure Str.56 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint Str.250 Str.96 Str.97 Str.98 Str.99: - inc Str.97; - let Str.251 : [C {}, C {Str, Str}] = CallByName Str.38 Str.97 Str.98; - let Str.257 : U8 = 1i64; - let Str.258 : U8 = GetTagId Str.251; - let Str.259 : Int1 = lowlevel Eq Str.257 Str.258; - if Str.259 then - dec Str.97; - let Str.256 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.251; - let Str.101 : Str = StructAtIndex 0 Str.256; - let Str.100 : Str = StructAtIndex 1 Str.256; - let Str.254 : Str = CallByName Str.3 Str.96 Str.100; - dec Str.100; - let Str.253 : Str = CallByName Str.3 Str.254 Str.99; - jump Str.250 Str.253 Str.101 Str.98 Str.99; - else + dec Str.387; + ret Str.92; + +procedure Str.57 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): + joinpoint Str.252 Str.97 Str.98 Str.99 Str.100: + inc Str.98; + let Str.253 : [C {}, C {Str, Str}] = CallByName Str.38 Str.98 Str.99; + let Str.259 : U8 = 1i64; + let Str.260 : U8 = GetTagId Str.253; + let Str.261 : Int1 = lowlevel Eq Str.259 Str.260; + if Str.261 then dec Str.98; - dec Str.251; + let Str.258 : {Str, Str} = UnionAtIndex (Id 1) (Index 0) Str.253; + let Str.102 : Str = StructAtIndex 0 Str.258; + let Str.101 : Str = StructAtIndex 1 Str.258; + let Str.256 : Str = CallByName Str.3 Str.97 Str.101; + dec Str.101; + let Str.255 : Str = CallByName Str.3 Str.256 Str.100; + jump Str.252 Str.255 Str.102 Str.99 Str.100; + else + dec Str.100; dec Str.99; - let Str.255 : Str = CallByName Str.3 Str.96 Str.97; - dec Str.97; - ret Str.255; + dec Str.253; + let Str.257 : Str = CallByName Str.3 Str.97 Str.98; + dec Str.98; + ret Str.257; in - inc #Derived_gen.23; - inc #Derived_gen.22; - jump Str.250 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + inc #Derived_gen.18; + inc #Derived_gen.17; + jump Str.252 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; -procedure Str.57 (Str.121, Str.122): - let Str.123 : U64 = CallByName Str.36 Str.121; +procedure Str.58 (Str.122, Str.123): let Str.124 : U64 = CallByName Str.36 Str.122; - let Str.125 : U64 = CallByName Num.77 Str.123 Str.124; - let Str.277 : U64 = 0i64; - let Str.276 : [C , C U64] = CallByName Str.58 Str.121 Str.122 Str.277 Str.125; - ret Str.276; - -procedure Str.58 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16): - joinpoint Str.278 Str.126 Str.127 Str.128 Str.129: - let Str.280 : Int1 = CallByName Num.23 Str.128 Str.129; - if Str.280 then - let Str.284 : Int1 = CallByName Str.62 Str.126 Str.128 Str.127; - if Str.284 then + let Str.125 : U64 = CallByName Str.36 Str.123; + let Str.126 : U64 = CallByName Num.77 Str.124 Str.125; + let Str.279 : U64 = 0i64; + let Str.278 : [C , C U64] = CallByName Str.59 Str.122 Str.123 Str.279 Str.126; + ret Str.278; + +procedure Str.59 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint Str.280 Str.127 Str.128 Str.129 Str.130: + let Str.282 : Int1 = CallByName Num.23 Str.129 Str.130; + if Str.282 then + let Str.286 : Int1 = CallByName Str.63 Str.127 Str.129 Str.128; + if Str.286 then dec Str.127; - dec Str.126; - let Str.285 : [C , C U64] = TagId(1) Str.128; - ret Str.285; + dec Str.128; + let Str.287 : [C , C U64] = TagId(1) Str.129; + ret Str.287; else - let Str.283 : U64 = 1i64; - let Str.282 : U64 = CallByName Num.51 Str.128 Str.283; - jump Str.278 Str.126 Str.127 Str.282 Str.129; + let Str.285 : U64 = 1i64; + let Str.284 : U64 = CallByName Num.51 Str.129 Str.285; + jump Str.280 Str.127 Str.128 Str.284 Str.130; else dec Str.127; - dec Str.126; - let Str.279 : [C , C U64] = TagId(0) ; - ret Str.279; + dec Str.128; + let Str.281 : [C , C U64] = TagId(0) ; + ret Str.281; in - inc #Derived_gen.14; - inc #Derived_gen.13; - jump Str.278 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16; - -procedure Str.61 (Str.152, Str.153): - let Str.308 : Int1 = CallByName Num.22 Str.152 Str.153; - if Str.308 then - ret Str.152; - else - ret Str.153; + inc #Derived_gen.11; + inc #Derived_gen.12; + jump Str.280 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure Str.62 (Str.154, Str.155, Str.156): - let Str.157 : U64 = CallByName Str.36 Str.154; - let Str.158 : U64 = CallByName Str.36 Str.156; - let Str.306 : U64 = CallByName Num.53 Str.155 Str.158; - let Str.159 : U64 = CallByName Str.61 Str.306 Str.157; - let Str.305 : U64 = 0i64; - inc Str.156; - inc Str.154; - let Str.287 : {U64, Str, U64, Str, U64, U64} = Struct {Str.159, Str.154, Str.155, Str.156, Str.305, Str.158}; - let Str.286 : Int1 = CallByName Str.63 Str.287; - ret Str.286; - -procedure Str.63 (Str.160): - let Str.166 : U64 = StructAtIndex 0 Str.160; - let Str.161 : Str = StructAtIndex 1 Str.160; - let Str.162 : U64 = StructAtIndex 2 Str.160; - let Str.163 : Str = StructAtIndex 3 Str.160; - let Str.164 : U64 = StructAtIndex 4 Str.160; - let Str.165 : U64 = StructAtIndex 5 Str.160; - let Str.167 : Int1 = CallByName Num.25 Str.162 Str.166; - if Str.167 then - dec Str.163; - dec Str.161; - let Str.168 : Int1 = CallByName Bool.11 Str.164 Str.165; - ret Str.168; +procedure Str.62 (Str.153, Str.154): + let Str.310 : Int1 = CallByName Num.22 Str.153 Str.154; + if Str.310 then + ret Str.153; + else + ret Str.154; + +procedure Str.63 (Str.155, Str.156, Str.157): + let Str.158 : U64 = CallByName Str.36 Str.155; + let Str.159 : U64 = CallByName Str.36 Str.157; + let Str.308 : U64 = CallByName Num.53 Str.156 Str.159; + let Str.160 : U64 = CallByName Str.62 Str.308 Str.158; + let Str.307 : U64 = 0i64; + inc Str.157; + inc Str.155; + let Str.289 : {U64, Str, U64, Str, U64, U64} = Struct {Str.160, Str.155, Str.156, Str.157, Str.307, Str.159}; + let Str.288 : Int1 = CallByName Str.64 Str.289; + ret Str.288; + +procedure Str.64 (Str.161): + let Str.167 : U64 = StructAtIndex 0 Str.161; + let Str.162 : Str = StructAtIndex 1 Str.161; + let Str.163 : U64 = StructAtIndex 2 Str.161; + let Str.164 : Str = StructAtIndex 3 Str.161; + let Str.165 : U64 = StructAtIndex 4 Str.161; + let Str.166 : U64 = StructAtIndex 5 Str.161; + let Str.168 : Int1 = CallByName Num.25 Str.163 Str.167; + if Str.168 then + dec Str.162; + dec Str.164; + let Str.169 : Int1 = CallByName Bool.11 Str.165 Str.166; + ret Str.169; else - let Str.301 : U8 = CallByName Str.35 Str.161 Str.162; - let Str.302 : U8 = CallByName Str.35 Str.163 Str.164; - let Str.169 : Int1 = CallByName Bool.11 Str.301 Str.302; - let Str.291 : U64 = StructAtIndex 0 Str.160; - let Str.292 : Str = StructAtIndex 1 Str.160; - let Str.294 : Str = StructAtIndex 3 Str.160; - let Str.296 : U64 = StructAtIndex 5 Str.160; - let Str.300 : U64 = 1i64; - let Str.298 : U64 = CallByName Num.51 Str.164 Str.300; - let Str.299 : U64 = 1i64; - let Str.297 : U64 = CallByName Num.51 Str.162 Str.299; - let Str.290 : {U64, Str, U64, Str, U64, U64} = Struct {Str.291, Str.292, Str.297, Str.294, Str.298, Str.296}; - let Str.170 : Int1 = CallByName Str.63 Str.290; - let Str.289 : Int1 = CallByName Bool.3 Str.169 Str.170; - ret Str.289; + let Str.303 : U8 = CallByName Str.35 Str.162 Str.163; + let Str.304 : U8 = CallByName Str.35 Str.164 Str.165; + let Str.170 : Int1 = CallByName Bool.11 Str.303 Str.304; + let Str.293 : U64 = StructAtIndex 0 Str.161; + let Str.294 : Str = StructAtIndex 1 Str.161; + let Str.296 : Str = StructAtIndex 3 Str.161; + let Str.298 : U64 = StructAtIndex 5 Str.161; + let Str.302 : U64 = 1i64; + let Str.300 : U64 = CallByName Num.51 Str.165 Str.302; + let Str.301 : U64 = 1i64; + let Str.299 : U64 = CallByName Num.51 Str.163 Str.301; + let Str.292 : {U64, Str, U64, Str, U64, U64} = Struct {Str.293, Str.294, Str.299, Str.296, Str.300, Str.298}; + let Str.171 : Int1 = CallByName Str.64 Str.292; + let Str.291 : Int1 = CallByName Bool.3 Str.170 Str.171; + ret Str.291; procedure Test.0 (): let Test.5 : Str = "foo"; diff --git a/crates/compiler/test_mono/generated/issue_2583_specialize_errors_behind_unified_branches.txt b/crates/compiler/test_mono/generated/issue_2583_specialize_errors_behind_unified_branches.txt index d987197ab87..819e9398934 100644 --- a/crates/compiler/test_mono/generated/issue_2583_specialize_errors_behind_unified_branches.txt +++ b/crates/compiler/test_mono/generated/issue_2583_specialize_errors_behind_unified_branches.txt @@ -45,27 +45,27 @@ procedure Num.22 (#Attr.2, #Attr.3): let Num.283 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; ret Num.283; -procedure Str.27 (Str.84): - let Str.246 : [C Int1, C I64] = CallByName Str.66 Str.84; - ret Str.246; +procedure Str.27 (Str.85): + let Str.248 : [C Int1, C I64] = CallByName Str.67 Str.85; + ret Str.248; procedure Str.42 (#Attr.2): - let Str.254 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.254; + let Str.256 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.256; -procedure Str.66 (Str.191): - let Str.192 : {I64, U8} = CallByName Str.42 Str.191; - let Str.252 : U8 = StructAtIndex 1 Str.192; - let Str.253 : U8 = 0i64; - let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253; - if Str.249 then - let Str.251 : I64 = StructAtIndex 0 Str.192; - let Str.250 : [C Int1, C I64] = TagId(1) Str.251; - ret Str.250; +procedure Str.67 (Str.192): + let Str.193 : {I64, U8} = CallByName Str.42 Str.192; + let Str.254 : U8 = StructAtIndex 1 Str.193; + let Str.255 : U8 = 0i64; + let Str.251 : Int1 = CallByName Bool.11 Str.254 Str.255; + if Str.251 then + let Str.253 : I64 = StructAtIndex 0 Str.193; + let Str.252 : [C Int1, C I64] = TagId(1) Str.253; + ret Str.252; else - let Str.248 : Int1 = false; - let Str.247 : [C Int1, C I64] = TagId(0) Str.248; - ret Str.247; + let Str.250 : Int1 = false; + let Str.249 : [C Int1, C I64] = TagId(0) Str.250; + ret Str.249; procedure Test.0 (): let Test.3 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt index 68b16ce5806..6ec93ba0ca0 100644 --- a/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt +++ b/crates/compiler/test_mono/generated/issue_4772_weakened_monomorphic_destructure.txt @@ -19,30 +19,30 @@ procedure Decode.26 (Decode.109, Decode.110): ret Decode.126; procedure Str.12 (#Attr.2): - let Str.255 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.255; + let Str.257 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.257; -procedure Str.27 (Str.84): - let Str.246 : [C {}, C I64] = CallByName Str.66 Str.84; - ret Str.246; +procedure Str.27 (Str.85): + let Str.248 : [C {}, C I64] = CallByName Str.67 Str.85; + ret Str.248; procedure Str.42 (#Attr.2): - let Str.254 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.254; + let Str.256 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.256; -procedure Str.66 (Str.191): - let Str.192 : {I64, U8} = CallByName Str.42 Str.191; - let Str.252 : U8 = StructAtIndex 1 Str.192; - let Str.253 : U8 = 0i64; - let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253; - if Str.249 then - let Str.251 : I64 = StructAtIndex 0 Str.192; - let Str.250 : [C {}, C I64] = TagId(1) Str.251; - ret Str.250; +procedure Str.67 (Str.192): + let Str.193 : {I64, U8} = CallByName Str.42 Str.192; + let Str.254 : U8 = StructAtIndex 1 Str.193; + let Str.255 : U8 = 0i64; + let Str.251 : Int1 = CallByName Bool.11 Str.254 Str.255; + if Str.251 then + let Str.253 : I64 = StructAtIndex 0 Str.193; + let Str.252 : [C {}, C I64] = TagId(1) Str.253; + ret Str.252; else - let Str.248 : {} = Struct {}; - let Str.247 : [C {}, C I64] = TagId(0) Str.248; - ret Str.247; + let Str.250 : {} = Struct {}; + let Str.249 : [C {}, C I64] = TagId(0) Str.250; + ret Str.249; procedure Test.103 (): let Test.101 : [C Str, C {List U8, I64}] = CallByName Test.19; diff --git a/crates/compiler/test_mono/generated/lambda_capture_niches_with_other_lambda_capture.txt b/crates/compiler/test_mono/generated/lambda_capture_niches_with_other_lambda_capture.txt index 6868bfe1220..924f08e2d53 100644 --- a/crates/compiler/test_mono/generated/lambda_capture_niches_with_other_lambda_capture.txt +++ b/crates/compiler/test_mono/generated/lambda_capture_niches_with_other_lambda_capture.txt @@ -1,6 +1,6 @@ procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.1 (Test.5): let Test.16 : [C {}, C U64, C Str] = TagId(0) Test.5; diff --git a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt index 223650051bc..d72fa7a8869 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt @@ -71,12 +71,12 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.285; procedure Str.16 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; + ret Str.248; procedure Str.3 (#Attr.2, #Attr.3): - let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.247; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.1 (): let Test.21 : Str = "lllllllllllllllllllllooooooooooong"; diff --git a/crates/compiler/test_mono/generated/list_map_closure_owns.txt b/crates/compiler/test_mono/generated/list_map_closure_owns.txt index ce02924c293..7cb3d221ed5 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_owns.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_owns.txt @@ -70,8 +70,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.285; procedure Str.3 (#Attr.2, #Attr.3): - let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.247; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.1 (): let Test.21 : Str = "lllllllllllllllllllllooooooooooong"; diff --git a/crates/compiler/test_mono/generated/pizza_dbg.txt b/crates/compiler/test_mono/generated/pizza_dbg.txt index 3c8c1193143..9409cffafe8 100644 --- a/crates/compiler/test_mono/generated/pizza_dbg.txt +++ b/crates/compiler/test_mono/generated/pizza_dbg.txt @@ -43,8 +43,8 @@ procedure Num.96 (#Attr.2): ret Num.284; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.4 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt b/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt index 9a8ece21892..78dd714b528 100644 --- a/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt +++ b/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt @@ -3,8 +3,8 @@ procedure Bool.11 (#Attr.2, #Attr.3): ret Bool.23; procedure Str.3 (#Attr.2, #Attr.3): - let Str.247 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.247; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.2 (Test.7): let Test.24 : Str = ".trace(\""; diff --git a/crates/compiler/test_mono/generated/recursively_build_effect.txt b/crates/compiler/test_mono/generated/recursively_build_effect.txt index f43506bad37..df9aae8b9e1 100644 --- a/crates/compiler/test_mono/generated/recursively_build_effect.txt +++ b/crates/compiler/test_mono/generated/recursively_build_effect.txt @@ -3,8 +3,8 @@ procedure Num.20 (#Attr.2, #Attr.3): ret Num.283; procedure Str.3 (#Attr.2, #Attr.3): - let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.248; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.11 (Test.29, #Attr.12): let Test.32 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; diff --git a/crates/compiler/test_mono/generated/return_annotated.txt b/crates/compiler/test_mono/generated/return_annotated.txt index b384d1aafd6..a211cea502a 100644 --- a/crates/compiler/test_mono/generated/return_annotated.txt +++ b/crates/compiler/test_mono/generated/return_annotated.txt @@ -2,27 +2,27 @@ procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure Str.26 (Str.83): - let Str.246 : [C {}, C U64] = CallByName Str.66 Str.83; - ret Str.246; +procedure Str.26 (Str.84): + let Str.248 : [C {}, C U64] = CallByName Str.67 Str.84; + ret Str.248; procedure Str.42 (#Attr.2): - let Str.254 : {U64, U8} = lowlevel StrToNum #Attr.2; - ret Str.254; + let Str.256 : {U64, U8} = lowlevel StrToNum #Attr.2; + ret Str.256; -procedure Str.66 (Str.191): - let Str.192 : {U64, U8} = CallByName Str.42 Str.191; - let Str.252 : U8 = StructAtIndex 1 Str.192; - let Str.253 : U8 = 0i64; - let Str.249 : Int1 = CallByName Bool.11 Str.252 Str.253; - if Str.249 then - let Str.251 : U64 = StructAtIndex 0 Str.192; - let Str.250 : [C {}, C U64] = TagId(1) Str.251; - ret Str.250; +procedure Str.67 (Str.192): + let Str.193 : {U64, U8} = CallByName Str.42 Str.192; + let Str.254 : U8 = StructAtIndex 1 Str.193; + let Str.255 : U8 = 0i64; + let Str.251 : Int1 = CallByName Bool.11 Str.254 Str.255; + if Str.251 then + let Str.253 : U64 = StructAtIndex 0 Str.193; + let Str.252 : [C {}, C U64] = TagId(1) Str.253; + ret Str.252; else - let Str.248 : {} = Struct {}; - let Str.247 : [C {}, C U64] = TagId(0) Str.248; - ret Str.247; + let Str.250 : {} = Struct {}; + let Str.249 : [C {}, C U64] = TagId(0) Str.250; + ret Str.249; procedure Test.1 (Test.2): joinpoint Test.11 Test.3: diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt index 0d803f15bd1..1f809eabf43 100644 --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_does_not_duplicate_identical_concrete_types.txt @@ -99,12 +99,12 @@ procedure Num.96 (#Attr.2): ret Num.283; procedure Str.12 (#Attr.2): - let Str.247 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.247; + let Str.249 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.249; procedure Str.36 (#Attr.2): - let Str.248 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.248; + let Str.250 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.250; procedure Test.20 (Test.58): let Test.295 : Str = CallByName Encode.23 Test.58; diff --git a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt index 6744f9ca1b9..6c04a37d4c8 100644 --- a/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt +++ b/crates/compiler/test_mono/generated/unspecialized_lambda_set_unification_keeps_all_concrete_types_without_unification_of_unifiable.txt @@ -192,12 +192,12 @@ procedure Num.96 (#Attr.2): ret Num.287; procedure Str.12 (#Attr.2): - let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.250; + let Str.252 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.252; procedure Str.36 (#Attr.2): - let Str.251 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; - ret Str.251; + let Str.253 : U64 = lowlevel StrCountUtf8Bytes #Attr.2; + ret Str.253; procedure Test.20 (Test.58): inc Test.58; diff --git a/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt b/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt index f793852b73d..563c6b2103b 100644 --- a/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt +++ b/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt @@ -46,8 +46,8 @@ procedure Inspect.64 (Inspect.297): ret Inspect.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.0 (): let Test.4 : {} = Struct {}; diff --git a/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic_late.txt b/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic_late.txt index 9a9e0ffd7f6..06806d5cadc 100644 --- a/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic_late.txt +++ b/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic_late.txt @@ -49,8 +49,8 @@ procedure Inspect.64 (Inspect.297): ret Inspect.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.246 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.246; + let Str.248 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.248; procedure Test.2 (Test.3): let Test.4 : Str = CallByName Inspect.33 Test.3; From 1266186d44a55a81ee50b038e1ab4938b5479d8a Mon Sep 17 00:00:00 2001 From: Norbert Hajagos Date: Fri, 10 Jan 2025 21:51:49 +0100 Subject: [PATCH 2/2] run formatter, change Str.dropPrefix to snake_case in failing test. --- crates/compiler/builtins/roc/Str.roc | 2 +- crates/compiler/test_gen/src/gen_str.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index dd460a58ea2..3233583fc82 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -1105,6 +1105,6 @@ drop_suffix = \haystack, suffix -> ## That said, strings received from user input can always contain non-ASCII Unicode characters, and lowercasing [Unicode](https://unicode.org) works differently in different languages. For example, the string `"I"lowercases to `"i"## ` in English and to `"ı"` (a [dotless i](https://en.wikipedia.org/wiki/Dotless_I)) in Turkish. These rules can also change in each [Unicode release](https://www.unicode.org/releases/), so we have separate [`unicode` package]## (https://github.com/roc-lang/unicode) for Unicode capitalization that can be upgraded independently from the language's builtins. ## ## To do a case-insensitive comparison of the ASCII characters in a string, use [`caseless_ascii_equals`](#caseless_ascii_equals). -with_ascii_lowercased: Str -> Str +with_ascii_lowercased : Str -> Str expect Str.with_ascii_lowercased "cOFFÉ" == "XYZFÉ" diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index c3b02b26840..d28522bc635 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -2080,7 +2080,7 @@ fn with_ascii_lowercased_non_zero_refcount() { r#" original = "cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ cOFFÉ" res = Str.with_ascii_lowercased original - Str.dropPrefix res original + Str.drop_prefix res original "#, RocStr::from("coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ coffÉ"), RocStr