From 9e3cff61d7f533cbc7f57169b90dc4d3b8b2001a Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 17 Jan 2024 22:01:18 -0500 Subject: [PATCH 01/80] Remove Nat uses from Str --- crates/compiler/builtins/bitcode/src/str.zig | 39 +++++++----- crates/compiler/builtins/roc/Str.roc | 66 +++++++------------- 2 files changed, 47 insertions(+), 58 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/str.zig b/crates/compiler/builtins/bitcode/src/str.zig index 171f13ad691..11d7239e8d6 100644 --- a/crates/compiler/builtins/bitcode/src/str.zig +++ b/crates/compiler/builtins/bitcode/src/str.zig @@ -1134,8 +1134,8 @@ test "countSegments: overlapping delimiter 2" { try expectEqual(segments_count, 3); } -pub fn countUtf8Bytes(string: RocStr) callconv(.C) usize { - return string.len(); +pub fn countUtf8Bytes(string: RocStr) callconv(.C) u64 { + return @intCast(string.len()); } pub fn isEmpty(string: RocStr) callconv(.C) bool { @@ -1146,7 +1146,10 @@ pub fn getCapacity(string: RocStr) callconv(.C) usize { return string.getCapacity(); } -pub fn substringUnsafe(string: RocStr, start: usize, length: usize) callconv(.C) RocStr { +pub fn substringUnsafe(string: RocStr, start_u64: u64, length_u64: u64) callconv(.C) RocStr { + const start: usize = @intCast(start_u64); + const length: usize = @intCast(length_u64); + if (string.isSmallStr()) { if (start == 0) { var output = string; @@ -1178,8 +1181,8 @@ pub fn substringUnsafe(string: RocStr, start: usize, length: usize) callconv(.C) return RocStr.empty(); } -pub fn getUnsafe(string: RocStr, index: usize) callconv(.C) u8 { - return string.getUnchecked(index); +pub fn getUnsafe(string: RocStr, index: u64) callconv(.C) u8 { + return string.getUnchecked(@intCast(index)); } test "substringUnsafe: start" { @@ -1242,7 +1245,8 @@ pub fn startsWith(string: RocStr, prefix: RocStr) callconv(.C) bool { } // Str.repeat -pub fn repeat(string: RocStr, count: usize) callconv(.C) RocStr { +pub fn repeat(string: RocStr, count_u64: u64) callconv(.C) RocStr { + const count: usize = @intCast(count_u64); const bytes_len = string.len(); const bytes_ptr = string.asU8ptr(); @@ -1497,7 +1501,7 @@ inline fn strToBytes(arg: RocStr) RocList { } const FromUtf8Result = extern struct { - byte_index: usize, + byte_index: u64, string: RocStr, is_ok: bool, problem_code: Utf8ByteProblem, @@ -1510,14 +1514,17 @@ const CountAndStart = extern struct { pub fn fromUtf8RangeC( list: RocList, - start: usize, - count: usize, + start: u64, + count: u64, update_mode: UpdateMode, ) callconv(.C) FromUtf8Result { return fromUtf8Range(list, start, count, update_mode); } -pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: UpdateMode) FromUtf8Result { +pub fn fromUtf8Range(arg: RocList, start_u64: u64, count_u64: u64, update_mode: UpdateMode) FromUtf8Result { + const start: usize = @intCast(start_u64); + const count: usize = @intCast(count_u64); + if (arg.len() == 0 or count == 0) { arg.decref(RocStr.alignment); return FromUtf8Result{ @@ -1547,7 +1554,7 @@ pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: Upda return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), - .byte_index = temp.index, + .byte_index = @intCast(temp.index), .problem_code = temp.problem, }; } @@ -1674,7 +1681,7 @@ fn sliceHelp(bytes: [*]const u8, length: usize) RocList { } fn toErrUtf8ByteResponse(index: usize, problem: Utf8ByteProblem) FromUtf8Result { - return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = index, .problem_code = problem }; + return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = @as(index, @intCast(u64)), .problem_code = problem }; } // NOTE on memory: the validate function consumes a RC token of the input. Since @@ -2367,8 +2374,10 @@ test "capacity: big string" { try expect(data.getCapacity() >= data_bytes.len); } -pub fn reserve(string: RocStr, spare: usize) callconv(.C) RocStr { +pub fn reserve(string: RocStr, spare_u64: u64) callconv(.C) RocStr { const old_length = string.len(); + const spare: usize = @intCast(spare_u64); + if (string.getCapacity() >= old_length + spare) { return string; } else { @@ -2378,8 +2387,8 @@ pub fn reserve(string: RocStr, spare: usize) callconv(.C) RocStr { } } -pub fn withCapacity(capacity: usize) callconv(.C) RocStr { - var str = RocStr.allocate(capacity); +pub fn withCapacity(capacity: u64) callconv(.C) RocStr { + var str = RocStr.allocate(@intCast(capacity)); str.setLen(0); return str; } diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index 12889ce3513..b71573347b5 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -347,7 +347,6 @@ interface Str toDec, toF64, toF32, - toNat, toU128, toI128, toU64, @@ -375,7 +374,7 @@ interface Str Bool.{ Bool, Eq }, Result.{ Result }, List, - Num.{ Nat, Num, U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, F32, F64, Dec }, + Num.{ Num, U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, F32, F64, Dec }, ] Utf8ByteProblem : [ @@ -387,7 +386,7 @@ Utf8ByteProblem : [ EncodesSurrogateHalf, ] -Utf8Problem : { byteIndex : Nat, problem : Utf8ByteProblem } +Utf8Problem : { byteIndex : U64, problem : Utf8ByteProblem } ## Returns [Bool.true] if the string is empty, and [Bool.false] otherwise. ## ``` @@ -428,7 +427,7 @@ concat : Str, Str -> Str ## the cost of using more memory than is necessary. ## ## For more details on how the performance optimization works, see [Str.reserve]. -withCapacity : Nat -> Str +withCapacity : U64 -> Str ## Increase a string's capacity by at least the given number of additional bytes. ## @@ -486,7 +485,7 @@ withCapacity : Nat -> Str ## reallocations but will also waste a lot of memory! ## ## If you plan to use [Str.reserve] on an empty string, it's generally better to use [Str.withCapacity] instead. -reserve : Str, Nat -> Str +reserve : Str, U64 -> Str ## Combines a [List] of strings into a single string, with a separator ## string in between each. @@ -516,7 +515,7 @@ split : Str, Str -> List Str ## expect Str.repeat "" 10 == "" ## expect Str.repeat "anything" 0 == "" ## ``` -repeat : Str, Nat -> Str +repeat : Str, U64 -> Str ## Returns a [List] of the string's [U8] UTF-8 [code units](https://unicode.org/glossary/#code_unit). ## (To split the string into a [List] of smaller [Str] values instead of [U8] values, @@ -540,9 +539,9 @@ toUtf8 : Str -> List U8 ## expect Str.fromUtf8 [] == Ok "" ## expect Str.fromUtf8 [255] |> Result.isErr ## ``` -fromUtf8 : List U8 -> Result Str [BadUtf8 Utf8ByteProblem Nat] +fromUtf8 : List U8 -> Result Str [BadUtf8 Utf8ByteProblem U64] fromUtf8 = \bytes -> - result = fromUtf8RangeLowlevel bytes 0 (List.len bytes) + result = fromUtf8RangeLowlevel bytes 0 (List.len bytes |> Num.toU64) if result.cIsOk then Ok result.bString @@ -560,9 +559,9 @@ expect (Str.fromUtf8 [255]) |> Result.isErr ## ``` ## expect Str.fromUtf8Range [72, 105, 80, 103] { start : 0, count : 2 } == Ok "Hi" ## ``` -fromUtf8Range : List U8, { start : Nat, count : Nat } -> Result Str [BadUtf8 Utf8ByteProblem Nat, OutOfBounds] +fromUtf8Range : List U8, { start : U64, count : U64 } -> Result Str [BadUtf8 Utf8ByteProblem U64, OutOfBounds] fromUtf8Range = \bytes, config -> - if Num.addSaturated config.start config.count <= List.len bytes then + if Num.addSaturated config.start config.count <= (List.len bytes |> Num.toU64) then result = fromUtf8RangeLowlevel bytes config.start config.count if result.cIsOk then @@ -579,13 +578,13 @@ expect (Str.fromUtf8Range [] { start: 0, count: 0 }) == Ok "" expect (Str.fromUtf8Range [72, 105, 80, 103] { start: 2, count: 3 }) |> Result.isErr FromUtf8Result : { - aByteIndex : Nat, + aByteIndex : U64, bString : Str, cIsOk : Bool, dProblemCode : Utf8ByteProblem, } -fromUtf8RangeLowlevel : List U8, Nat, Nat -> FromUtf8Result +fromUtf8RangeLowlevel : List U8, U64, U64 -> FromUtf8Result ## Check if the given [Str] starts with a value. ## ``` @@ -650,25 +649,6 @@ toF64 = \string -> strToNumHelp string toF32 : Str -> Result F32 [InvalidNumStr] toF32 = \string -> strToNumHelp string -## Convert a [Str] to a [Nat]. If the given number doesn't fit in [Nat], it will be [truncated](https://www.ualberta.ca/computing-science/media-library/teaching-resources/java/truncation-rounding.html). -## [Nat] has a different maximum number depending on the system you're building -## for, so this may give a different answer on different systems. -## -## For example, on a 32-bit system, `Num.maxNat` will return the same answer as -## `Num.maxU32`. This means that calling `Str.toNat "9_000_000_000"` on a 32-bit -## system will return `Num.maxU32` instead of 9 billion, because 9 billion is -## larger than `Num.maxU32` and will not fit in a [Nat] on a 32-bit system. -## -## Calling `Str.toNat "9_000_000_000"` on a 64-bit system will return -## the [Nat] value of 9_000_000_000. This is because on a 64-bit system, [Nat] can -## hold up to `Num.maxU64`, and 9_000_000_000 is smaller than `Num.maxU64`. -## ``` -## expect Str.toNat "9_000_000_000" == Ok 9000000000 -## expect Str.toNat "not a number" == Err InvalidNumStr -## ``` -toNat : Str -> Result Nat [InvalidNumStr] -toNat = \string -> strToNumHelp string - ## Encode a [Str] to an unsigned [U128] integer. A [U128] value can hold numbers ## from `0` to `340_282_366_920_938_463_463_374_607_431_768_211_455` (over ## 340 undecillion). It can be specified with a u128 suffix. @@ -788,16 +768,16 @@ toI8 : Str -> Result I8 [InvalidNumStr] toI8 = \string -> strToNumHelp string ## Get the byte at the given index, without performing a bounds check. -getUnsafe : Str, Nat -> U8 +getUnsafe : Str, U64 -> U8 ## Gives the number of bytes in a [Str] value. ## ``` ## expect Str.countUtf8Bytes "Hello World" == 11 ## ``` -countUtf8Bytes : Str -> Nat +countUtf8Bytes : Str -> U64 ## string slice that does not do bounds checking or utf-8 verification -substringUnsafe : Str, Nat, Nat -> Str +substringUnsafe : Str, U64, U64 -> Str ## Returns the given [Str] with each occurrence of a substring replaced. ## If the substring is not found, returns the original string. @@ -905,7 +885,7 @@ expect splitFirst "hullabaloo" "ab" == Ok { before: "hull", after: "aloo" } # splitFirst when needle is haystack expect splitFirst "foo" "foo" == Ok { before: "", after: "" } -firstMatch : Str, Str -> [Some Nat, None] +firstMatch : Str, Str -> [Some U64, None] firstMatch = \haystack, needle -> haystackLength = Str.countUtf8Bytes haystack needleLength = Str.countUtf8Bytes needle @@ -913,7 +893,7 @@ firstMatch = \haystack, needle -> firstMatchHelp haystack needle 0 lastPossible -firstMatchHelp : Str, Str, Nat, Nat -> [Some Nat, None] +firstMatchHelp : Str, Str, U64, U64 -> [Some U64, None] firstMatchHelp = \haystack, needle, index, lastPossible -> if index <= lastPossible then if matchesAt haystack index needle then @@ -956,7 +936,7 @@ expect Str.splitLast "hullabaloo" "ab" == Ok { before: "hull", after: "aloo" } # splitLast when needle is haystack expect Str.splitLast "foo" "foo" == Ok { before: "", after: "" } -lastMatch : Str, Str -> [Some Nat, None] +lastMatch : Str, Str -> [Some U64, None] lastMatch = \haystack, needle -> haystackLength = Str.countUtf8Bytes haystack needleLength = Str.countUtf8Bytes needle @@ -964,7 +944,7 @@ lastMatch = \haystack, needle -> lastMatchHelp haystack needle lastPossibleIndex -lastMatchHelp : Str, Str, Nat -> [Some Nat, None] +lastMatchHelp : Str, Str, U64 -> [Some U64, None] lastMatchHelp = \haystack, needle, index -> if matchesAt haystack index needle then Some index @@ -978,7 +958,7 @@ lastMatchHelp = \haystack, needle, index -> min = \x, y -> if x < y then x else y -matchesAt : Str, Nat, Str -> Bool +matchesAt : Str, U64, Str -> Bool matchesAt = \haystack, haystackIndex, needle -> haystackLength = Str.countUtf8Bytes haystack needleLength = Str.countUtf8Bytes needle @@ -1019,15 +999,15 @@ matchesAtHelp = \state -> ## state for each byte. The index for that byte in the string is provided ## to the update function. ## ``` -## f : List U8, U8, Nat -> List U8 +## f : List U8, U8, U64 -> List U8 ## f = \state, byte, _ -> List.append state byte ## expect Str.walkUtf8WithIndex "ABC" [] f == [65, 66, 67] ## ``` -walkUtf8WithIndex : Str, state, (state, U8, Nat -> state) -> state +walkUtf8WithIndex : Str, state, (state, U8, U64 -> state) -> state walkUtf8WithIndex = \string, state, step -> walkUtf8WithIndexHelp string state step 0 (Str.countUtf8Bytes string) -walkUtf8WithIndexHelp : Str, state, (state, U8, Nat -> state), Nat, Nat -> state +walkUtf8WithIndexHelp : Str, state, (state, U8, U64 -> state), U64, U64 -> state walkUtf8WithIndexHelp = \string, state, step, index, length -> if index < length then byte = Str.getUnsafe string index @@ -1051,7 +1031,7 @@ walkUtf8 : Str, state, (state, U8 -> state) -> state walkUtf8 = \str, initial, step -> walkUtf8Help str initial step 0 (Str.countUtf8Bytes str) -walkUtf8Help : Str, state, (state, U8 -> state), Nat, Nat -> state +walkUtf8Help : Str, state, (state, U8 -> state), U64, U64 -> state walkUtf8Help = \str, state, step, index, length -> if index < length then byte = Str.getUnsafe str index From e7dde9bffc21fd3479d4593466ee49c9efd32e85 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 12:49:58 -0500 Subject: [PATCH 02/80] Update Html static site gen --- examples/static-site-gen/platform/Html.roc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/static-site-gen/platform/Html.roc b/examples/static-site-gen/platform/Html.roc index dc206d56626..cd992d65c99 100644 --- a/examples/static-site-gen/platform/Html.roc +++ b/examples/static-site-gen/platform/Html.roc @@ -126,8 +126,8 @@ interface Html Node : [ Text Str, - Element Str Nat (List Attribute) (List Node), - UnclosedElem Str Nat (List Attribute), + Element Str U64 (List Attribute) (List Node), + UnclosedElem Str U64 (List Attribute), ] Attribute : Html.Attributes.Attribute @@ -172,7 +172,7 @@ unclosedElem = \tagName -> UnclosedElem tagName totalSize attrs # internal helper -nodeSize : Node -> Nat +nodeSize : Node -> U64 nodeSize = \node -> when node is Text content -> From a1656381c5ed683c8d93f2fa1c94566bf0c46124 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 12:52:39 -0500 Subject: [PATCH 03/80] Update some Result docs --- crates/compiler/builtins/roc/Result.roc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/compiler/builtins/roc/Result.roc b/crates/compiler/builtins/roc/Result.roc index 7ff20351768..aa86de271a8 100644 --- a/crates/compiler/builtins/roc/Result.roc +++ b/crates/compiler/builtins/roc/Result.roc @@ -84,8 +84,8 @@ try = \result, transform -> ## function on the value the `Err` holds. Then returns that new result. If the ## result is `Ok`, this has no effect. Use `try` to transform an `Ok`. ## ``` -## Result.onErr (Ok 10) \errorNum -> Str.toNat errorNum -## Result.onErr (Err "42") \errorNum -> Str.toNat errorNum +## Result.onErr (Ok 10) \errorNum -> Str.toU64 errorNum +## Result.onErr (Err "42") \errorNum -> Str.toU64 errorNum ## ``` onErr : Result a err, (err -> Result a otherErr) -> Result a otherErr onErr = \result, transform -> From 632903bbde7ba2f2faa384a68cff7c9f6a341046 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 12:52:52 -0500 Subject: [PATCH 04/80] Fix some tests --- crates/compiler/test_gen/src/gen_str.rs | 4 ++-- crates/compiler/test_gen/src/wasm_str.rs | 15 --------------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index 876075f3756..fed83f1b25a 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -1371,11 +1371,11 @@ fn str_to_nat() { assert_evals_to!( indoc!( r#" - Str.toNat "1" + Str.toU64 "1" "# ), RocResult::ok(1), - RocResult + RocResult ); } diff --git a/crates/compiler/test_gen/src/wasm_str.rs b/crates/compiler/test_gen/src/wasm_str.rs index 5521c752c40..4b0ca42c6bc 100644 --- a/crates/compiler/test_gen/src/wasm_str.rs +++ b/crates/compiler/test_gen/src/wasm_str.rs @@ -1028,21 +1028,6 @@ fn str_trim_end_small_to_small_shared() { ); } -#[test] -fn str_to_nat() { - assert_evals_to!( - indoc!( - r#" - when Str.toNat "1" is - Ok n -> n - Err _ -> 0 - "# - ), - 1, - usize - ); -} - #[test] fn str_to_i128() { assert_evals_to!( From bca6417a9d894c5a4ba7fdc71b565184f6942e76 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 23:28:07 -0500 Subject: [PATCH 05/80] Fix @as and @intCast argument order --- crates/compiler/builtins/bitcode/src/str.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/builtins/bitcode/src/str.zig b/crates/compiler/builtins/bitcode/src/str.zig index 11d7239e8d6..ca46dce32bd 100644 --- a/crates/compiler/builtins/bitcode/src/str.zig +++ b/crates/compiler/builtins/bitcode/src/str.zig @@ -1681,7 +1681,7 @@ fn sliceHelp(bytes: [*]const u8, length: usize) RocList { } fn toErrUtf8ByteResponse(index: usize, problem: Utf8ByteProblem) FromUtf8Result { - return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = @as(index, @intCast(u64)), .problem_code = problem }; + return FromUtf8Result{ .is_ok = false, .string = RocStr.empty(), .byte_index = @as(u64, @intCast(index)), .problem_code = problem }; } // NOTE on memory: the validate function consumes a RC token of the input. Since From 7f2e2d0803c621aa49ba64f5e0b0c6716bdbd761 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 23:06:11 -0500 Subject: [PATCH 06/80] Fix repro for nasty import bug The bug reproduces if you go to the commit before this one; seems to be the problem is importing an un-exposed value as unqualified (possibly from a package, might be relevant) --- crates/compiler/load_internal/src/file.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index 1b41d623502..1c7c6dd6ed1 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -4864,7 +4864,7 @@ fn import_variable_for_symbol( // Today we define builtins in each module that uses them // so even though they have a different module name from // the surrounding module, they are not technically imported - debug_assert!(symbol.is_builtin()); + debug_assert!(symbol.is_builtin(), "The symbol {:?} was not found and was assumed to be a builtin, but it wasn't a builtin.", symbol); return; } AbilityMemberMustBeAvailable => { From 09574203ced326f3abe85633b73f2ee0200067db Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 26 Jan 2024 12:05:28 -0500 Subject: [PATCH 07/80] Update to basic-cli 0.8.1 --- crates/cli/tests/cli_run.rs | 6 +- .../newline_in_packages.full.formatted.roc | 2 +- .../pass/newline_in_packages.full.result-ast | 2 +- .../pass/newline_in_packages.full.roc | 4 +- examples/cli/argsBROKEN.roc | 2 +- examples/cli/countdown.roc | 2 +- examples/cli/echo.roc | 2 +- examples/cli/env.roc | 2 +- examples/cli/fileBROKEN.roc | 2 +- examples/cli/form.roc | 2 +- examples/cli/http-get.roc | 2 +- examples/cli/ingested-file-bytes.roc | 2 +- examples/cli/ingested-file.roc | 4 +- examples/helloWorld.roc | 2 +- examples/inspect-logging.roc | 2 +- examples/parser/letter-counts.roc | 2 +- www/content/platforms.md | 29 ++- www/content/tutorial.md | 233 +++++++++--------- 18 files changed, 156 insertions(+), 146 deletions(-) diff --git a/crates/cli/tests/cli_run.rs b/crates/cli/tests/cli_run.rs index a32ea3a1a65..5561a85281c 100644 --- a/crates/cli/tests/cli_run.rs +++ b/crates/cli/tests/cli_run.rs @@ -872,10 +872,10 @@ mod cli_run { &[], indoc!( r#" - This roc file can print it's own source code. The source is: + This roc file can print its own source code. The source is: app "ingested-file" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [ pf.Stdout, "ingested-file.roc" as ownCode : Str, @@ -883,7 +883,7 @@ mod cli_run { provides [main] to pf main = - Stdout.line "\nThis roc file can print it's own source code. The source is:\n\n\(ownCode)" + Stdout.line "\nThis roc file can print its own source code. The source is:\n\n$(ownCode)" "# ), diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.formatted.roc index 89ebd0eed28..206999c37de 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.formatted.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.formatted.roc @@ -1,7 +1,7 @@ app "hello" packages { pf: - "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br", + "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", } imports [pf.Stdout] provides [main] to pf diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.result-ast index b7cc7c7b278..ea12da2acac 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.result-ast @@ -24,7 +24,7 @@ Full { Newline, ], package_name: @31-145 PackageName( - "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br", + "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", ), }, [ diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.roc b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.roc index e778a2c8fc3..ed2a859fcfe 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/newline_in_packages.full.roc @@ -1,9 +1,9 @@ app "hello" packages { pf: -"https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" +"https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf main = - Stdout.line "I'm a Roc application!" \ No newline at end of file + Stdout.line "I'm a Roc application!" diff --git a/examples/cli/argsBROKEN.roc b/examples/cli/argsBROKEN.roc index d56b88c5828..79d064c7e74 100644 --- a/examples/cli/argsBROKEN.roc +++ b/examples/cli/argsBROKEN.roc @@ -1,5 +1,5 @@ app "args" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout, pf.Arg, pf.Task.{ Task }] provides [main] to pf diff --git a/examples/cli/countdown.roc b/examples/cli/countdown.roc index 13ddb94d24f..6f405100738 100644 --- a/examples/cli/countdown.roc +++ b/examples/cli/countdown.roc @@ -1,5 +1,5 @@ app "countdown" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdin, pf.Stdout, pf.Task.{ await, loop }] provides [main] to pf diff --git a/examples/cli/echo.roc b/examples/cli/echo.roc index 034e7fd4c19..6d82ad603ff 100644 --- a/examples/cli/echo.roc +++ b/examples/cli/echo.roc @@ -1,5 +1,5 @@ app "echo" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdin, pf.Stdout, pf.Task.{ Task }] provides [main] to pf diff --git a/examples/cli/env.roc b/examples/cli/env.roc index 41fbd6a61e2..ee47a0d3bdc 100644 --- a/examples/cli/env.roc +++ b/examples/cli/env.roc @@ -1,5 +1,5 @@ app "env" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout, pf.Stderr, pf.Env, pf.Task.{ Task }] provides [main] to pf diff --git a/examples/cli/fileBROKEN.roc b/examples/cli/fileBROKEN.roc index 711c5f45410..fdc69afeb92 100644 --- a/examples/cli/fileBROKEN.roc +++ b/examples/cli/fileBROKEN.roc @@ -1,5 +1,5 @@ app "file-io" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [ pf.Stdout, pf.Stderr, diff --git a/examples/cli/form.roc b/examples/cli/form.roc index 3aae9272d8b..281d298b71b 100644 --- a/examples/cli/form.roc +++ b/examples/cli/form.roc @@ -1,5 +1,5 @@ app "form" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdin, pf.Stdout, pf.Task.{ await, Task }] provides [main] to pf diff --git a/examples/cli/http-get.roc b/examples/cli/http-get.roc index 2664203be83..81c9e8ea12e 100644 --- a/examples/cli/http-get.roc +++ b/examples/cli/http-get.roc @@ -1,5 +1,5 @@ app "http-get" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Http, pf.Task.{ Task }, pf.Stdin, pf.Stdout] provides [main] to pf diff --git a/examples/cli/ingested-file-bytes.roc b/examples/cli/ingested-file-bytes.roc index de29db4d3ee..4473ccf110c 100644 --- a/examples/cli/ingested-file-bytes.roc +++ b/examples/cli/ingested-file-bytes.roc @@ -1,5 +1,5 @@ app "ingested-file-bytes" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [ pf.Stdout, "../../LICENSE" as license : _, # A type hole can also be used here. diff --git a/examples/cli/ingested-file.roc b/examples/cli/ingested-file.roc index 361c6cecac6..11f0c716682 100644 --- a/examples/cli/ingested-file.roc +++ b/examples/cli/ingested-file.roc @@ -1,5 +1,5 @@ app "ingested-file" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [ pf.Stdout, "ingested-file.roc" as ownCode : Str, @@ -7,4 +7,4 @@ app "ingested-file" provides [main] to pf main = - Stdout.line "\nThis roc file can print it's own source code. The source is:\n\n\(ownCode)" + Stdout.line "\nThis roc file can print its own source code. The source is:\n\n$(ownCode)" diff --git a/examples/helloWorld.roc b/examples/helloWorld.roc index 4fbaf850327..15371db6c9c 100644 --- a/examples/helloWorld.roc +++ b/examples/helloWorld.roc @@ -1,5 +1,5 @@ app "helloWorld" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf diff --git a/examples/inspect-logging.roc b/examples/inspect-logging.roc index 0526413cdf5..228d83af51d 100644 --- a/examples/inspect-logging.roc +++ b/examples/inspect-logging.roc @@ -2,7 +2,7 @@ # Shows how Roc values can be logged # app "inspect-logging" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [ pf.Stdout, Community, diff --git a/examples/parser/letter-counts.roc b/examples/parser/letter-counts.roc index 8ccb04e3301..e34d2f7555a 100644 --- a/examples/parser/letter-counts.roc +++ b/examples/parser/letter-counts.roc @@ -1,6 +1,6 @@ app "example" packages { - cli: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br", + cli: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5/KB-TITJ4DfunB88sFBWjCtCGV7LRRDdTH5JUXp4gIb8.tar.br", } imports [ diff --git a/www/content/platforms.md b/www/content/platforms.md index e956568da54..ba50a8c6aae 100644 --- a/www/content/platforms.md +++ b/www/content/platforms.md @@ -1,6 +1,6 @@ # Platforms -Something that sets Roc apart from other programming languages is its *platforms and applications* architecture. +Something that sets Roc apart from other programming languages is its _platforms and applications_ architecture. ## [Applications](#applications) {#applications} @@ -8,7 +8,7 @@ Here is a Roc application that prints `"Hello, World!"` to the command line: ```roc app "hello" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf @@ -26,19 +26,20 @@ Also like many game engines and Web frameworks, Roc platforms have a high-level Here are some example Roc platforms, and functionality they might provide: -* A Roc game engine platform might provide functionality for rendering and sound. -* A Roc Web server platform (like [basic-webserver](https://github.com/roc-lang/basic-webserver)) probably would not provide functionality for rendering and sound, but it might provide functionality for responding to incoming HTTP requests—which a game engine platform likely would not. -* A Roc native [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) platform might provide functionality for defining native operating system UI elements, whereas a game engine platform might focus more on rendering with [shaders](https://en.wikipedia.org/wiki/Shader), and a Web server platform would not have GUI functionality at all. +- A Roc game engine platform might provide functionality for rendering and sound. +- A Roc Web server platform (like [basic-webserver](https://github.com/roc-lang/basic-webserver)) probably would not provide functionality for rendering and sound, but it might provide functionality for responding to incoming HTTP requests—which a game engine platform likely would not. +- A Roc native [GUI](https://en.wikipedia.org/wiki/Graphical_user_interface) platform might provide functionality for defining native operating system UI elements, whereas a game engine platform might focus more on rendering with [shaders](https://en.wikipedia.org/wiki/Shader), and a Web server platform would not have GUI functionality at all. -These are broad domains, but platforms can be much more specific than this. For example, anyone could make a platform for writing [Vim](https://en.wikipedia.org/wiki/Vim_(text_editor)) plugins, or [Postgres](https://en.wikipedia.org/wiki/PostgreSQL) extensions, or robots ([which has already happened](https://roc.zulipchat.com/#narrow/stream/304902-show-and-tell/topic/Roc.20on.20a.20microcontroller/near/286678630)), or even [implementing servo logic for a clock that physically turns panels to simulate an LCD](https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Roc.20Clock/near/327939600). You really can get as specific as you like! +These are broad domains, but platforms can be much more specific than this. For example, anyone could make a platform for writing [Vim]() plugins, or [Postgres](https://en.wikipedia.org/wiki/PostgreSQL) extensions, or robots ([which has already happened](https://roc.zulipchat.com/#narrow/stream/304902-show-and-tell/topic/Roc.20on.20a.20microcontroller/near/286678630)), or even [implementing servo logic for a clock that physically turns panels to simulate an LCD](https://roc.zulipchat.com/#narrow/stream/304641-ideas/topic/Roc.20Clock/near/327939600). You really can get as specific as you like! Platforms can also be designed to have a single, specific application run on them. For example, you can make a platform that is essentially "your entire existing code base in another language," and then use Roc as an embedded language within that code base. For example, [Vendr](https://www.vendr.com/careers) is using this strategy to call Roc functions from their [Node.js](https://nodejs.org/en) backend using [roc-esbuild](https://github.com/vendrinc/roc-esbuild), as a way to incrementally transition code from Node to Roc. ## [Platform scope](#scope) {#scope} Roc platforms have a broader scope of responsibility than game engines or Web frameworks. In addition to providing a nice domain-specific interface, platforms are also responsible for: -* Tailoring memory management to that domain (more on this later) -* Providing all I/O primitives + +- Tailoring memory management to that domain (more on this later) +- Providing all I/O primitives In most languages, I/O primitives come with the standard library. In Roc, the [standard library](https://www.roc-lang.org/builtins/) contains only data structures; an application gets all of its I/O primitives from its platform. For example, in the "Hello, World" application above, the `Stdout.line` function comes from the `basic-cli` platform itself, not from Roc's standard library. @@ -48,7 +49,7 @@ This design has a few benefits. Some I/O operations make sense in some use cases but not others. -For example, suppose I'm building an application on a platform for command-line interfaces, and I use a third-party package which sometimes blocks the program while it waits for [standard input](https://en.wikipedia.org/wiki/Standard_streams#Standard_input_(stdin)). This might be fine for my command-line application, but it would probably be a very bad fit if I'm using a webserver. Similarly, a package which does some occasional file I/O for caching might work fine on either of those platforms, but might break in surprising ways when used in a platform that's designed to run in a browser on WebAssembly—since browsers don't offer arbitrary file I/O access! +For example, suppose I'm building an application on a platform for command-line interfaces, and I use a third-party package which sometimes blocks the program while it waits for [standard input](). This might be fine for my command-line application, but it would probably be a very bad fit if I'm using a webserver. Similarly, a package which does some occasional file I/O for caching might work fine on either of those platforms, but might break in surprising ways when used in a platform that's designed to run in a browser on WebAssembly—since browsers don't offer arbitrary file I/O access! Because Roc's I/O primitives come from platforms, these mismatches can be prevented at build time. The browser-based platform would not expose file I/O primitives, the webserver wouldn't expose a way to block on reading from standard input, and so on. (Note that there's a design in the works for allowing packages which perform I/O to work across multiple platforms—but only platforms which support the I/O primitives it requires—but this design has not yet been implemented.) @@ -58,7 +59,7 @@ Since platforms have exclusive control over all I/O primitives, one of the thing [This talk](https://www.youtube.com/watch?v=cpQwtwVKAfU&t=75s) shows an example of taking this idea a step further with a "safe scripting" platform for writing command-line scripts. The idea is that you could download a script from the Internet and run it on this platform without worrying that the script would do bad things to your computer, because the platform would (much like a Web browser) show you specific prompts before allowing the script to do potentially harmful I/O, such as filesystem operations. -These security guarantees can be relied on because platforms have *exclusive* control over all I/O primitives, including how they are implemented. There are no escape hatches that a malicious program could use to get around these, either; for example, Roc programs that want to call functions in other languages must do so using primitives provided by the platform, which the platform can disallow (or sandbox with end-user prompts) in the same way. +These security guarantees can be relied on because platforms have _exclusive_ control over all I/O primitives, including how they are implemented. There are no escape hatches that a malicious program could use to get around these, either; for example, Roc programs that want to call functions in other languages must do so using primitives provided by the platform, which the platform can disallow (or sandbox with end-user prompts) in the same way. ### [Performance benefits](#performance) {#performance} @@ -75,8 +76,9 @@ To understand how platforms can tailor automatic memory management to their part ### [The Host and the Roc API](#host-and-roc-api) {#host-and-roc-api} Each platform consists of two parts: -* **The Roc API** is the part that application authors see. For example, `Stdout.line` is part of basic-cli's Roc API. -* **The Host** is the under-the-hood implementation written in a language other than Roc. For example, basic-cli's host is written in Rust. It has a Rust function which implements the behavior of the `Stdout.line` operation, and all the other I/O operations it supports. + +- **The Roc API** is the part that application authors see. For example, `Stdout.line` is part of basic-cli's Roc API. +- **The Host** is the under-the-hood implementation written in a language other than Roc. For example, basic-cli's host is written in Rust. It has a Rust function which implements the behavior of the `Stdout.line` operation, and all the other I/O operations it supports. This design means that application authors don't necessarily need to know (or care) about the non-Roc language being used to implement the platform's host. That can be a behind-the-scenes implementation detail that only the platform's author(s) are concerned with. Application authors only interact with the public-facing Roc API. @@ -97,6 +99,7 @@ When a compiled Roc program runs, it's actually the host—not the Roc applicati Knowing this, a useful mental model for how Roc platforms and applications interact at the implementation level is: the Roc application compiles down to a C library which the platform can choose to call (or not). This is essentially what's happening behind the scenes when you run `roc build`. Specifically: + 1. The Roc compiler builds the Roc application into a binary [object file](https://en.wikipedia.org/wiki/Object_file) 2. Since that application specified its platform, the compiler then looks up the platform's host implementation (which the platform will have provided as an already-compiled binary) 3. Now that it has a binary for the Roc application and a binary for the host, it links them together into one combined binary in which the host portion calls the application portion as many times as it likes. @@ -109,6 +112,6 @@ Every Roc application has exactly one platform. That platform provides all the I This I/O design has [security benefits](#security), [ecosystem benefits](#ecosystem), and [performance benefits](#performance). The [domain-specific memory management](#memory) platforms can implement can offer additional benefits as well. -Applications only interact with the *Roc API* portion of a platform, but there is also a *host* portion (written in a different language) that works behind the scenes. The host determines how the program starts, how memory is allocated and deallocated, and how I/O primitives are implemented. +Applications only interact with the _Roc API_ portion of a platform, but there is also a _host_ portion (written in a different language) that works behind the scenes. The host determines how the program starts, how memory is allocated and deallocated, and how I/O primitives are implemented. Anyone can implement their own platform. There isn't yet an official guide about how to do this, so the best way to get help if you'd like to create a platform is to [say hi in the `#beginners` channel](https://roc.zulipchat.com/#narrow/stream/231634-beginners) on [Roc Zulip!](https://roc.zulipchat.com) diff --git a/www/content/tutorial.md b/www/content/tutorial.md index f393824018a..53926eceb2b 100644 --- a/www/content/tutorial.md +++ b/www/content/tutorial.md @@ -36,9 +36,9 @@ ## [REPL](#repl) {#repl} -Let's start by getting acquainted with Roc's [_Read-Eval-Print-Loop_](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), or **REPL** for short. +Let's start by getting acquainted with Roc's [_Read-Eval-Print-Loop_](https://en.wikipedia.org/wiki/Read%E2%80%93eval%E2%80%93print_loop), or **REPL** for short. -You can use the online REPL at [roc-lang.org/repl](https://www.roc-lang.org/repl). +You can use the online REPL at [roc-lang.org/repl](https://www.roc-lang.org/repl). Or you can run this in a terminal: roc repl, and if Roc is [installed](/install), you should see this: @@ -164,7 +164,7 @@ Make a file named `main.roc` and put this in it: ```roc app "hello" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf @@ -207,9 +207,9 @@ You should see this: A definition names an expression. -- The first two defs assign the names `birds` and `iguanas` to the expressions `3` and `2`. -- The next def assigns the name `total` to the expression `Num.toStr (birds + iguanas)`. -- The last def assigns the name `main` to an expression which returns a `Task`. We'll [discuss tasks later](#tasks). +- The first two defs assign the names `birds` and `iguanas` to the expressions `3` and `2`. +- The next def assigns the name `total` to the expression `Num.toStr (birds + iguanas)`. +- The last def assigns the name `main` to an expression which returns a `Task`. We'll [discuss tasks later](#tasks). Once we have a def, we can use its name in other expressions. For example, the `total` expression refers to `birds` and `iguanas`, and `Stdout.line "There are $(total) animals."` refers to `total`. @@ -260,8 +260,8 @@ addAndStringify = \num1, num2 -> We did two things here: -- We introduced a _local def_ named `sum`, and set it equal to `num1 + num2`. Because we defined `sum` inside `addAndStringify`, it's _local_ to that scope and can't be accessed outside that function. -- We added an `if`\-`then`\-`else` conditional to return either `""` or `Num.toStr sum` depending on whether `sum == 0`. +- We introduced a _local def_ named `sum`, and set it equal to `num1 + num2`. Because we defined `sum` inside `addAndStringify`, it's _local_ to that scope and can't be accessed outside that function. +- We added an `if`\-`then`\-`else` conditional to return either `""` or `Num.toStr sum` depending on whether `sum == 0`. Every `if` must be accompanied by both `then` and also `else`. Having an `if` without an `else` is an error, because `if` is an expression, and all expressions must evaluate to a value. If there were ever an `if` without an `else`, that would be an expression that might not evaluate to a value! @@ -367,7 +367,7 @@ addAndStringify = \counts -> Num.toStr (counts.birds + counts.iguanas) ``` -The function now takes a _record_, which is a group of named values. Records are not [objects](https://en.wikipedia.org/wiki/Object_(computer_science)); they don't have methods or inheritance, they just store information. +The function now takes a _record_, which is a group of named values. Records are not [objects](); they don't have methods or inheritance, they just store information. The expression `{ birds: 5, iguanas: 7 }` defines a record with two _fields_ (the `birds` field and the `iguanas` field) and then assigns the number `5` to the `birds` field and the number `7` to the `iguanas` field. Order doesn't matter with record fields; we could have also specified `iguanas` first and `birds` second, and Roc would consider it the exact same record. @@ -411,10 +411,10 @@ returnFoo { foo: "hi!", bar: "blah" } Sometimes we assign a def to a field that happens to have the same name—for example, `{ x: x }`. In these cases, we shorten it to writing the name of the def alone—for example, `{ x }`. We can do this with as many fields as we like; here are several different ways to define the same record: -- `{ x: x, y: y }` -- `{ x, y }` -- `{ x: x, y }` -- `{ x, y: y }` +- `{ x: x, y: y }` +- `{ x, y }` +- `{ x: x, y }` +- `{ x, y: y }` ### [Record destructuring](#record-destructuring) {#record-destructuring} @@ -452,8 +452,8 @@ fromOriginal = { original & birds: 4, iguanas: 3 } The `fromScratch` and `fromOriginal` records are equal, although they're defined in different ways. -- `fromScratch` was built using the same record syntax we've been using up to this point. -- `fromOriginal` created a new record using the contents of `original` as defaults for fields that it didn't specify after the `&`. +- `fromScratch` was built using the same record syntax we've been using up to this point. +- `fromOriginal` created a new record using the contents of `original` as defaults for fields that it didn't specify after the `&`. Note that `&` can't introduce new fields to a record, or change the types of existing fields. (Trying to do either of these will result in an error at build time!) @@ -474,7 +474,7 @@ table = \{ -> ``` -This is using *optional field destructuring* to destructure a record while +This is using _optional field destructuring_ to destructure a record while also providing default values for any fields that might be missing. Here's the type of `table`: @@ -490,8 +490,8 @@ table : -> Table ``` -This says that `table` takes a record with two *required* fields, `height` and -`width`, and two *optional* fields, `title` and `description`. It also says that +This says that `table` takes a record with two _required_ fields, `height` and +`width`, and two _optional_ fields, `title` and `description`. It also says that the `height` and `width` fields have the type `Pixels`, a type alias for some numeric type, and the `title` and `description` fields have the type `Str`. This means you can choose to omit the `title`, `description`, or both fields, when calling the function... but if you provide them, they must have the type `Str`. @@ -504,7 +504,7 @@ These default values can reference other expressions in the record destructure; Destructuring is the only way to implement a record with optional fields. For example, if you write the expression `config.title` and `title` is an optional field, you'll get a compile error. -This means it's never possible to end up with an *optional value* that exists +This means it's never possible to end up with an _optional value_ that exists outside a record field. Optionality is a concept that exists only in record fields, and it's intended for the use case of config records like this. The ergonomics of destructuring mean this wouldn't be a good fit for data modeling, consider using a `Result` type instead. @@ -861,6 +861,7 @@ These functions demonstrate a common pattern in Roc: operations that can fail re Result.withDefault (List.get ["a", "b", "c"] 100) "" # returns "" because that's the default we said to use if List.get returned an Err ``` + ```roc Result.isOk (List.get ["a", "b", "c"] 1) # returns `Bool.true` because `List.get` returned an `Ok` tag. (The payload gets ignored.) @@ -875,9 +876,9 @@ that quite does what you want, and you might find yourself calling `List.get` re retrieve every element in the list and use it to build up the new value you want. That approach can work, but it has a few downsides: -* Each `List.get` call returns a `Result` that must be dealt with, even though you plan to use every element in the list anyway -* There's a runtime performance overhead associated with each of these `Result`s, which you won't find in other "look at every element in the list" operations like `List.keepIf`. -* It's more verbose than the alternative we're about to discuss +- Each `List.get` call returns a `Result` that must be dealt with, even though you plan to use every element in the list anyway +- There's a runtime performance overhead associated with each of these `Result`s, which you won't find in other "look at every element in the list" operations like `List.keepIf`. +- It's more verbose than the alternative we're about to discuss The `List.walk` function gives you a way to walk over the elements in a list and build up whatever return value you like. It's a great alternative to calling `List.get` on every element in the list @@ -905,13 +906,13 @@ In this example, we walk over the list `[1, 2, 3, 4, 5]` and add each element to It then proceeds to walk over each element in the list and call that function. Each time, the state that function returns becomes the argument to the next function call. Here are the arguments the function will receive, and what it will return, as `List.walk` walks over the list `[1, 2, 3, 4, 5]`: -| State | Element | Return Value | +| State | Element | Return Value | | --------------------------------- | ------- | ------------------------------------ | -| `{ evens: [], odds: [] }` | `1` | `{ evens: [], odds: [1] }` | -| `{ evens: [], odds: [1] }` | `2` | `{ evens: [2], odds: [1] }` | -| `{ evens: [2], odds: [1] }` | `3` | `{ evens: [2], odds: [1, 3] }` | -| `{ evens: [2], odds: [1, 3] }` | `4` | `{ evens: [2, 4], odds: [1, 3] }` | -| `{ evens: [2, 4], odds: [1, 3] }` | `5` | `{ evens: [2, 4], odds: [1, 3, 5] }` | +| `{ evens: [], odds: [] }` | `1` | `{ evens: [], odds: [1] }` | +| `{ evens: [], odds: [1] }` | `2` | `{ evens: [2], odds: [1] }` | +| `{ evens: [2], odds: [1] }` | `3` | `{ evens: [2], odds: [1, 3] }` | +| `{ evens: [2], odds: [1, 3] }` | `4` | `{ evens: [2, 4], odds: [1, 3] }` | +| `{ evens: [2, 4], odds: [1, 3] }` | `5` | `{ evens: [2, 4], odds: [1, 3, 5] }` | Note that the initial `state` argument is `{ evens: [], odds: [] }` because that's the argument we passed `List.walk` for its initial state. From then on, each `state` argument is whatever the @@ -932,6 +933,7 @@ When you have nested function calls, sometimes it can be clearer to write them i ```roc Result.withDefault (List.get ["a", "b", "c"] 1) "" ``` + ```roc List.get ["a", "b", "c"] 1 |> Result.withDefault "" @@ -954,6 +956,7 @@ One reason the `|>` operator injects the value as the first argument is to make ```roc List.append ["a", "b", "c"] "d" ``` + ```roc ["a", "b", "c"] |> List.append "d" @@ -964,9 +967,11 @@ Another example is `Num.div`. All three of the following do the same thing, beca ```roc first / second ``` + ```roc Num.div first second ``` + ```roc first |> Num.div second ``` @@ -1154,9 +1159,10 @@ Here, Roc's compiler will infer that `color`'s type is `[Red, Yellow, Green]`, b ### [Opaque Types](#opaque-types) {#opaque-types} A type can be defined to be opaque to hide its internal structure. This is a lot more amazing than it may seem. It can make your code more modular, robust, and easier to read: -- If a type is opaque you can modify its internal structure and be certain that no dependencies need to be updated. -- You can prevent that data needs to be checked multiple times. For example, you can create an opaque `NonEmptyList` from a `List` after you've checked it. Now all functions that you pass this `NonEmptyList` to do not need to handle the empty list case. -- Having the type `Username` in a type signature gives you more context compared to `Str`. Even if the `Username` is an opaque type for `Str`. + +- If a type is opaque you can modify its internal structure and be certain that no dependencies need to be updated. +- You can prevent that data needs to be checked multiple times. For example, you can create an opaque `NonEmptyList` from a `List` after you've checked it. Now all functions that you pass this `NonEmptyList` to do not need to handle the empty list case. +- Having the type `Username` in a type signature gives you more context compared to `Str`. Even if the `Username` is an opaque type for `Str`. You can create an opaque type with the `:=` operator. Let's make one called `Username`: @@ -1198,24 +1204,24 @@ Following this pattern, the 16 in `I16` means that it's a signed 16-bit integer. Choosing a size depends on your performance needs and the range of numbers you want to represent. Consider: -- Larger integer sizes can represent a wider range of numbers. If you absolutely need to represent numbers in a certain range, make sure to pick an integer size that can hold them! -- Smaller integer sizes take up less memory. These savings rarely matter in variables and function arguments, but the sizes of integers that you use in data structures can add up. This can also affect whether those data structures fit in [cache lines](https://en.wikipedia.org/wiki/CPU_cache#Cache_performance), which can easily be a performance bottleneck. -- Certain processors work faster on some numeric sizes than others. There isn't even a general rule like "larger numeric sizes run slower" (or the reverse, for that matter) that applies to all processors. In fact, if the CPU is taking too long to run numeric calculations, you may find a performance improvement by experimenting with numeric sizes that are larger than otherwise necessary. However, in practice, doing this typically degrades overall performance, so be careful to measure properly! +- Larger integer sizes can represent a wider range of numbers. If you absolutely need to represent numbers in a certain range, make sure to pick an integer size that can hold them! +- Smaller integer sizes take up less memory. These savings rarely matter in variables and function arguments, but the sizes of integers that you use in data structures can add up. This can also affect whether those data structures fit in [cache lines](https://en.wikipedia.org/wiki/CPU_cache#Cache_performance), which can easily be a performance bottleneck. +- Certain processors work faster on some numeric sizes than others. There isn't even a general rule like "larger numeric sizes run slower" (or the reverse, for that matter) that applies to all processors. In fact, if the CPU is taking too long to run numeric calculations, you may find a performance improvement by experimenting with numeric sizes that are larger than otherwise necessary. However, in practice, doing this typically degrades overall performance, so be careful to measure properly! Here are the different fixed-size integer types that Roc supports: | Range | Type | -|-------------------------------------------------------------------------------------------------------------------|--------| -| `-128`
`127` | `I8` | -| `0`
`255` | `U8` | -| `-32_768`
`32_767` | `I16` | -| `0`
`65_535` | `U16` | +| ----------------------------------------------------------------------------------------------------------------- | ------ | +| `-128`
`127` | `I8` | +| `0`
`255` | `U8` | +| `-32_768`
`32_767` | `I16` | +| `0`
`65_535` | `U16` | | `-2_147_483_648`
`2_147_483_647` | `I32` | -| `0`
(over 4 billion) `4_294_967_295` | `U32` | +| `0`
(over 4 billion) `4_294_967_295` | `U32` | | `-9_223_372_036_854_775_808`
`9_223_372_036_854_775_807` | `I64` | -| `0`
_(over 18 quintillion)_`18_446_744_073_709_551_615` | `U64` | +| `0`
_(over 18 quintillion)_`18_446_744_073_709_551_615` | `U64` | | `-170_141_183_460_469_231_731_687_303_715_884_105_728`
`170_141_183_460_469_231_731_687_303_715_884_105_727` | `I128` | -| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | +| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | Roc also has one variable-size integer type: `Nat` (short for "natural number"). The size of `Nat` is equal to the size of a memory address, which varies by system. For example, when compiling for a 64-bit system, `Nat` works the same way as `U64`. When compiling for a 32-bit system, it works the same way as `U32`. Most popular computing devices today are 64-bit, so `Nat` is usually the same as `U64`, but Web Assembly is typically 32-bit - so when running a Roc program built for Web Assembly, `Nat` will work like a `U32` in that program. @@ -1229,9 +1235,9 @@ As such, it's very important to design your integer operations not to exceed the Roc has three fractional types: -- `F32`, a 32-bit [floating-point number](https://en.wikipedia.org/wiki/IEEE_754) -- `F64`, a 64-bit [floating-point number](https://en.wikipedia.org/wiki/IEEE_754) -- `Dec`, a 128-bit decimal [fixed-point number](https://en.wikipedia.org/wiki/Fixed-point_arithmetic) +- `F32`, a 32-bit [floating-point number](https://en.wikipedia.org/wiki/IEEE_754) +- `F64`, a 64-bit [floating-point number](https://en.wikipedia.org/wiki/IEEE_754) +- `Dec`, a 128-bit decimal [fixed-point number](https://en.wikipedia.org/wiki/Fixed-point_arithmetic) These are different from integers, they can represent numbers with fractional components, such as 1.5 and -0.123. @@ -1260,9 +1266,11 @@ There's also an `Int` type which is only compatible with integers, and a `Frac` ```roc Num.xor : Int a, Int a -> Int a ``` + ```roc Num.cos : Frac a -> Frac a ``` + When you write a number literal in Roc, it has the type `Num *`. So you could call `Num.xor 1 1` and also `Num.cos 1` and have them all work as expected; the number literal `1` has the type `Num *`, which is compatible with the more constrained types `Int` and `Frac`. For the same reason, you can pass number literals to functions expecting even more constrained types, like `I32` or `F64`. ### [Number Literals](#number-literals) {#number-literals} @@ -1378,12 +1386,12 @@ So you'll want to use `roc dev` or `roc test` to get the output for `expect`. Each `.roc` file is a separate module and contains Roc code for different purposes. Here are all of the different types of modules that Roc supports; -- **Builtins** provide functions that are automatically imported into every module. -- **Applications** are combined with a platform and compiled into an executable. -- **Interfaces** provide functions which can be imported into other modules. -- **Packages** organise modules to share functionality across applications and platforms. -- **Platforms** provide effects such as IO to interface with the outside world. -- **Hosted** *note this module type is likely to be deprecated soon*. +- **Builtins** provide functions that are automatically imported into every module. +- **Applications** are combined with a platform and compiled into an executable. +- **Interfaces** provide functions which can be imported into other modules. +- **Packages** organise modules to share functionality across applications and platforms. +- **Platforms** provide effects such as IO to interface with the outside world. +- **Hosted** _note this module type is likely to be deprecated soon_. ### [Builtin Modules](#builtin-modules) {#builtin-modules} @@ -1403,8 +1411,8 @@ These modules are not ordinary `.roc` files that live on your filesystem. Rather Besides being built into the compiler, the builtin modules are different from other modules in that: -- They are always imported. You never need to add them to `imports`. -- All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module). +- They are always imported. You never need to add them to `imports`. +- All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module). ### [App Module Header](#app-module-header) {#app-module-header} @@ -1412,7 +1420,7 @@ Let's take a closer look at the part of `main.roc` above the `main` def: ```roc app "hello" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf ``` @@ -1424,16 +1432,16 @@ The line `app "hello"` shows that this module is a Roc application. The "hello" The remaining lines all involve the [platform](https://github.com/roc-lang/roc/wiki/Roc-concepts-explained#platform) this application is built on: ```roc -packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } +packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf ``` The `packages { pf: "https://...tar.br" }` part says three things: -- We're going to be using a _package_ (a collection of modules) that can be downloaded from the URL `"https://...tar.br"` -- That package's [base64](https://en.wikipedia.org/wiki/Base64#URL_applications)\-encoded [BLAKE3]() cryptographic hash is the long string at the end (before the `.tar.br` file extension). Once the file has been downloaded, its contents will be verified against this hash, and it will only be installed if they match. This way, you can be confident the download was neither corrupted nor changed since it was originally published. -- We're going to name that package `pf` so we can refer to it more concisely in the future. +- We're going to be using a _package_ (a collection of modules) that can be downloaded from the URL `"https://...tar.br"` +- That package's [base64](https://en.wikipedia.org/wiki/Base64#URL_applications)\-encoded [BLAKE3]() cryptographic hash is the long string at the end (before the `.tar.br` file extension). Once the file has been downloaded, its contents will be verified against this hash, and it will only be installed if they match. This way, you can be confident the download was neither corrupted nor changed since it was originally published. +- We're going to name that package `pf` so we can refer to it more concisely in the future. The `imports [pf.Stdout]` line says that we want to import the `Stdout` module from the `pf` package, and make it available in the current module. @@ -1512,10 +1520,10 @@ Tasks are technically not part of the Roc language, but they're very common in p In the `basic-cli` platform, we have four operations we can do: -- Write a string to the terminal -- Read a string from user input -- Write a string to a file -- Read a string from a file +- Write a string to the terminal +- Read a string from user input +- Write a string to a file +- Read a string from a file We'll use these four operations to learn about tasks. @@ -1523,7 +1531,7 @@ Let's start with a basic "Hello World" program. ```roc app "cli-tutorial" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout] provides [main] to pf @@ -1557,7 +1565,7 @@ Let's change `main` to read a line from `stdin`, and then print what we got: ```roc app "cli-tutorial" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout, pf.Stdin, pf.Task] provides [main] to pf @@ -1602,7 +1610,7 @@ This works, but we can make it a little nicer to read. Let's change it to the fo ```roc app "cli-tutorial" - packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br" } + packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br" } imports [pf.Stdout, pf.Stdin, pf.Task.{ await }] provides [main] to pf @@ -1704,15 +1712,15 @@ This way, it reads like a series of instructions: Some important things to note about backpassing and `await`: -- `await` is not a language keyword in Roc! It's referring to the `Task.await` function, which we imported unqualified by writing `Task.{ await }` in our module imports. (That said, it is playing a similar role here to the `await` keyword in languages that have `async`/`await` keywords, even though in this case it's a function instead of a special keyword.) -- Backpassing syntax does not need to be used with `await` in particular. It can be used with any function. -- Roc's compiler treats functions defined with backpassing exactly the same way as functions defined the other way. The only difference between `\input ->` and `input <-` is how they look, so feel free to use whichever looks nicer to you! +- `await` is not a language keyword in Roc! It's referring to the `Task.await` function, which we imported unqualified by writing `Task.{ await }` in our module imports. (That said, it is playing a similar role here to the `await` keyword in languages that have `async`/`await` keywords, even though in this case it's a function instead of a special keyword.) +- Backpassing syntax does not need to be used with `await` in particular. It can be used with any function. +- Roc's compiler treats functions defined with backpassing exactly the same way as functions defined the other way. The only difference between `\input ->` and `input <-` is how they look, so feel free to use whichever looks nicer to you! See the [Task & Error Handling example](https://www.roc-lang.org/examples/Tasks/README.html) for a more detailed explanation of how to use tasks to help with error handling in a larger program. ## [Examples](#examples) {#examples} -Well done on making it this far! +Well done on making it this far! We've covered all of the basic syntax and features of Roc in this Tutorial. You should now have a good foundation and be ready to start writing your own applications. @@ -1733,9 +1741,9 @@ fullName = \user -> I can pass this function a record that has more fields than just `firstName` and `lastName`, as long as it has _at least_ both of those fields (and both of them are strings). So any of these calls would work: -- `fullName { firstName: "Sam", lastName: "Sample" }` -- `fullName { firstName: "Sam", lastName: "Sample", email: "blah@example.com" }` -- `fullName { age: 5, firstName: "Sam", things: 3, lastName: "Sample", role: Admin }` +- `fullName { firstName: "Sam", lastName: "Sample" }` +- `fullName { firstName: "Sam", lastName: "Sample", email: "blah@example.com" }` +- `fullName { age: 5, firstName: "Sam", things: 3, lastName: "Sample", role: Admin }` This `user` argument is an _open record_ - that is, a description of a minimum set of fields on a record, and their types. When a function takes an open record as an argument, it's okay if you pass it a record with more fields than just the ones specified. @@ -1775,9 +1783,9 @@ addHttps = \record -> This function uses _constrained records_ in its type. The annotation is saying: -- This function takes a record which has at least a `url` field, and possibly others -- That `url` field has the type `Str` -- It returns a record of exactly the same type as the one it was given +- This function takes a record which has at least a `url` field, and possibly others +- That `url` field has the type `Str` +- It returns a record of exactly the same type as the one it was given So if we give this function a record with five fields, it will return a record with those same five fields. The only requirement is that one of those fields must be `url: Str`. @@ -1785,9 +1793,9 @@ In practice, constrained records appear in type annotations much less often than Here's when you can typically expect to encounter these three flavors of type variables in records: -- _Open records_ are what the compiler infers when you use a record as an argument, or when destructuring it (for example, `{ x, y } =`). -- _Closed records_ are what the compiler infers when you create a new record (for example, `{ x: 5, y: 6 }`) -- _Constrained records_ are what the compiler infers when you do a record update (for example, `{ user & email: newEmail }`) +- _Open records_ are what the compiler infers when you use a record as an argument, or when destructuring it (for example, `{ x, y } =`). +- _Closed records_ are what the compiler infers when you create a new record (for example, `{ x: 5, y: 6 }`) +- _Constrained records_ are what the compiler infers when you do a record update (for example, `{ user & email: newEmail }`) Of note, you can pass a closed record to a function that accepts a smaller open record, but not the reverse. So a function `{ a : Str, b : Bool }* -> Str` can accept an `{ a : Str, b : Bool, c : Bool }` record, but a function `{ a : Str, b : Bool, c : Bool } -> Str` would not accept an `{ a : Str, b : Bool }*` record. @@ -1946,16 +1954,16 @@ Earlier we saw how a function which accepts an open union must account for more So if I have an `[Ok Str]*` value, I can pass it to functions with any of these types (among others): -| Function Type | Can it receive `[Ok Str]*`? | +| Function Type | Can it receive `[Ok Str]*`? | | --------------------------------------- | --------------------------- | -| `[Ok Str]* -> Bool` | Yes | -| `[Ok Str] -> Bool` | Yes | -| `[Ok Str, Err Bool]* -> Bool` | Yes | -| `[Ok Str, Err Bool] -> Bool` | Yes | -| `[Ok Str, Err Bool, Whatever]* -> Bool` | Yes | -| `[Ok Str, Err Bool, Whatever] -> Bool` | Yes | -| `Result Str Bool -> Bool` | Yes | -| `[Err Bool, Whatever]* -> Bool` | Yes | +| `[Ok Str]* -> Bool` | Yes | +| `[Ok Str] -> Bool` | Yes | +| `[Ok Str, Err Bool]* -> Bool` | Yes | +| `[Ok Str, Err Bool] -> Bool` | Yes | +| `[Ok Str, Err Bool, Whatever]* -> Bool` | Yes | +| `[Ok Str, Err Bool, Whatever] -> Bool` | Yes | +| `Result Str Bool -> Bool` | Yes | +| `[Err Bool, Whatever]* -> Bool` | Yes | That last one works because a function accepting an open union can accept any unrecognized tag (including `Ok Str`) even though it is not mentioned as one of the tags in `[Err Bool, Whatever]*`! Remember, when a function accepts an open tag union, any `when` branches on that union must include a catch-all `_ ->` branch, which is the branch that will end up handling the `Ok Str` value we pass in. @@ -1967,10 +1975,10 @@ However, I could not pass an `[Ok Str]*` to a function with a _closed_ tag union In summary, here's a way to think about the difference between open unions in a value you have, compared to a value you're accepting: -- If you _have_ a closed union, that means it has all the tags it ever will, and can't accumulate more. -- If you _have_ an open union, that means it can accumulate more tags through conditional branches. -- If you _accept_ a closed union, that means you only have to handle the possibilities listed in the union. -- If you _accept_ an open union, that means you have to handle the possibility that it has a tag you can't know about. +- If you _have_ a closed union, that means it has all the tags it ever will, and can't accumulate more. +- If you _have_ an open union, that means it can accumulate more tags through conditional branches. +- If you _accept_ a closed union, that means you only have to handle the possibilities listed in the union. +- If you _accept_ an open union, that means you have to handle the possibility that it has a tag you can't know about. ### [Type Variables in Tag Unions](#type-variables-in-tag-unions) {#type-variables-in-tag-unions} @@ -2010,8 +2018,8 @@ So if we give this function a `[Foo Str, Bar Bool, Baz (List Str)]` argument, th If we removed the type annotation from `example` above, Roc's compiler would infer the same type anyway. This may be surprising if you look closely at the body of the function, because: -- The return type includes `Foo Str`, but no branch explicitly returns `Foo`. Couldn't the return type be `[Bar Bool]a` instead? -- The argument type includes `Bar Bool` even though we never look at `Bar`'s payload. Couldn't the argument type be inferred to be `Bar *` instead of `Bar Bool`, since we never look at it? +- The return type includes `Foo Str`, but no branch explicitly returns `Foo`. Couldn't the return type be `[Bar Bool]a` instead? +- The argument type includes `Bar Bool` even though we never look at `Bar`'s payload. Couldn't the argument type be inferred to be `Bar *` instead of `Bar Bool`, since we never look at it? The reason it has this type is the `other -> other` branch. Take a look at that branch, and ask this question: "What is the type of `other`?" There has to be exactly one answer! It can't be the case that `other` has one type before the `->` and another type after it; whenever you see a named value in Roc, it is guaranteed to have the same type everywhere it appears in that scope. @@ -2025,12 +2033,12 @@ For this reason, any time you see a function that only runs a `when` on its only The record builder syntax sugar is a useful feature which leverages the functional programming concept of [applicative functors](https://lucamug.medium.com/functors-applicatives-and-monads-in-pictures-784c2b5786f7), to provide a flexible method for constructing complex types. -The record builder syntax sugar helps to build up a record by applying a series of functions to it. +The record builder syntax sugar helps to build up a record by applying a series of functions to it. For example, let's say we write a record-builder as follows: ```roc -{ aliceID, bobID, trudyID } = +{ aliceID, bobID, trudyID } = initIDCount { aliceID: <- incID, bobID: <- incID, @@ -2061,24 +2069,23 @@ These are all the reserved keywords in Roc. You can't choose any of these as nam Here are various Roc expressions involving operators, and what they desugar to. -| Expression | Desugars To | -| ----------------------------- | ------------------ | -| `a + b` | `Num.add a b` | -| `a - b` | `Num.sub a b` | -| `a * b` | `Num.mul a b` | -| `a / b` | `Num.div a b` | -| `a // b` | `Num.divTrunc a b` | -| `a ^ b` | `Num.pow a b` | -| `a % b` | `Num.rem a b` | -| `-a` | `Num.neg a` | -| `a == b` | `Bool.isEq a b` | -| `a != b` | `Bool.isNotEq a b` | -| `a && b` | `Bool.and a b` | -| a \|\| b | `Bool.or a b` | -| `!a` | `Bool.not a` | -| a \|> f | `f a` | -| f a b \|> g x y | `g (f a b) x y` | - +| Expression | Desugars To | +| ---------------------------- | ------------------ | +| `a + b` | `Num.add a b` | +| `a - b` | `Num.sub a b` | +| `a * b` | `Num.mul a b` | +| `a / b` | `Num.div a b` | +| `a // b` | `Num.divTrunc a b` | +| `a ^ b` | `Num.pow a b` | +| `a % b` | `Num.rem a b` | +| `-a` | `Num.neg a` | +| `a == b` | `Bool.isEq a b` | +| `a != b` | `Bool.isNotEq a b` | +| `a && b` | `Bool.and a b` | +| a \|\| b | `Bool.or a b` | +| `!a` | `Bool.not a` | +| a \|> f | `f a` | +| f a b \|> g x y | `g (f a b) x y` | From 0a4862da8804e1c50f7feb323b40632b758d8a95 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 26 Jan 2024 16:04:16 -0500 Subject: [PATCH 08/80] Update mono tests --- ...lambda_set_productive_nullable_wrapped.txt | 4 +- .../test_mono/generated/dbg_in_expect.txt | 4 +- .../generated/dbg_str_followed_by_number.txt | 4 +- .../encode_derived_nested_record_string.txt | 115 +++++++++--------- ...encode_derived_record_one_field_string.txt | 79 ++++++------ ...ncode_derived_record_two_field_strings.txt | 79 ++++++------ .../generated/encode_derived_string.txt | 71 ++++++----- .../encode_derived_tag_one_field_string.txt | 83 +++++++------ ...encode_derived_tag_two_payloads_string.txt | 109 +++++++++-------- .../generated/inspect_derived_dict.txt | 8 +- .../generated/inspect_derived_list.txt | 4 +- .../inspect_derived_nested_record_string.txt | 4 +- .../generated/inspect_derived_record.txt | 4 +- ...nspect_derived_record_one_field_string.txt | 4 +- ...spect_derived_record_two_field_strings.txt | 4 +- .../generated/inspect_derived_string.txt | 4 +- .../inspect_derived_tag_one_field_string.txt | 4 +- ...nspect_derived_tag_two_payloads_string.txt | 4 +- ...cialize_errors_behind_unified_branches.txt | 36 +++--- .../test_mono/generated/issue_4749.txt | 35 +++--- ..._4772_weakened_monomorphic_destructure.txt | 77 ++++++------ .../generated/list_map_closure_borrows.txt | 8 +- .../generated/list_map_closure_owns.txt | 4 +- .../polymorphic_expression_unification.txt | 4 +- .../generated/recursively_build_effect.txt | 4 +- ...not_duplicate_identical_concrete_types.txt | 4 +- ...types_without_unification_of_unifiable.txt | 4 +- .../specialize/inspect/opaque_automatic.txt | 4 +- .../inspect/opaque_automatic_late.txt | 4 +- 29 files changed, 406 insertions(+), 366 deletions(-) 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 05aeed0e9b4..545da506d9d 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 @@ -40,8 +40,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.253 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.253; + let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.252; procedure Test.1 (Test.5): ret Test.5; diff --git a/crates/compiler/test_mono/generated/dbg_in_expect.txt b/crates/compiler/test_mono/generated/dbg_in_expect.txt index d6f2a8bc1e4..b4825a08963 100644 --- a/crates/compiler/test_mono/generated/dbg_in_expect.txt +++ b/crates/compiler/test_mono/generated/dbg_in_expect.txt @@ -42,8 +42,8 @@ procedure Inspect.62 (Inspect.306): ret Inspect.306; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.1 (): let Test.4 : Str = ""; 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 97059310420..ec5f37b7071 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 @@ -38,8 +38,8 @@ procedure Inspect.62 (Inspect.306): ret Inspect.306; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.0 (): let Test.3 : Str = ""; 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 6f7801fc764..878b6ae4ee8 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 @@ -176,7 +176,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.658 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.658; -procedure List.80 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): +procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): joinpoint List.685 List.489 List.490 List.491 List.492 List.493: let List.687 : Int1 = CallByName Num.22 List.492 List.493; if List.687 then @@ -200,9 +200,25 @@ procedure List.80 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_g let List.686 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.686; in - jump List.685 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; + jump List.685 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; -procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): +procedure List.90 (#Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37, #Derived_gen.38): + joinpoint List.629 List.161 List.162 List.163 List.164 List.165: + let List.631 : Int1 = CallByName Num.22 List.164 List.165; + if List.631 then + let List.635 : {Str, Str} = CallByName List.66 List.161 List.164; + inc List.635; + let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.635; + let List.634 : U64 = 1i64; + let List.633 : U64 = CallByName Num.51 List.164 List.634; + jump List.629 List.161 List.166 List.163 List.633 List.165; + else + dec List.161; + ret List.162; + in + jump List.629 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38; + +procedure List.90 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43): joinpoint List.641 List.161 List.162 List.163 List.164 List.165: let List.643 : Int1 = CallByName Num.22 List.164 List.165; if List.643 then @@ -215,9 +231,9 @@ procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_g dec List.161; ret List.162; in - jump List.641 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + jump List.641 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43; -procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): +procedure List.90 (#Derived_gen.47, #Derived_gen.48, #Derived_gen.49, #Derived_gen.50, #Derived_gen.51): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -231,85 +247,74 @@ procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; - -procedure List.90 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49): - joinpoint List.629 List.161 List.162 List.163 List.164 List.165: - let List.631 : Int1 = CallByName Num.22 List.164 List.165; - if List.631 then - let List.635 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.635; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.635; - let List.634 : U64 = 1i64; - let List.633 : U64 = CallByName Num.51 List.164 List.634; - jump List.629 List.161 List.166 List.163 List.633 List.165; - else - dec List.161; - ret List.162; - in - jump List.629 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49; + jump List.595 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51; procedure Num.127 (#Attr.2): - let Num.312 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.312; + let Num.313 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.313; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.316 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.316; + let Num.317 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.317; procedure Num.20 (#Attr.2, #Attr.3): - let Num.313 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.313; + let Num.314 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.314; procedure Num.21 (#Attr.2, #Attr.3): - let Num.318 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.318; + let Num.319 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.319; procedure Num.22 (#Attr.2, #Attr.3): - let Num.324 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.324; + let Num.325 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.325; procedure Num.24 (#Attr.2, #Attr.3): - let Num.326 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.326; + let Num.327 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.327; procedure Num.51 (#Attr.2, #Attr.3): - let Num.321 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.321; + let Num.322 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.322; procedure Num.75 (#Attr.2, #Attr.3): - let Num.325 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.325; + let Num.326 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.326; procedure Num.94 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.317; + let Num.318 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.318; procedure Str.12 (#Attr.2): let Str.263 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.263; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.55 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.55; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1043, TotallyNotJson.149): let TotallyNotJson.1046 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 62262ddd229..61f5a941b93 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 @@ -135,7 +135,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.624; -procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): +procedure List.80 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25): joinpoint List.651 List.489 List.490 List.491 List.492 List.493: let List.653 : Int1 = CallByName Num.22 List.492 List.493; if List.653 then @@ -159,7 +159,7 @@ procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_g let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.652; in - jump List.651 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.651 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25; procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): joinpoint List.607 List.161 List.162 List.163 List.164 List.165: @@ -176,7 +176,7 @@ procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_g in jump List.607 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): +procedure List.90 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -190,69 +190,74 @@ procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + jump List.595 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33; procedure Num.127 (#Attr.2): - let Num.302 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.302; + let Num.303 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.303; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.306 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.306; + let Num.307 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.307; procedure Num.20 (#Attr.2, #Attr.3): - let Num.303 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.303; + let Num.304 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.304; procedure Num.21 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.308; + let Num.309 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.309; procedure Num.22 (#Attr.2, #Attr.3): - let Num.314 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.314; + let Num.315 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.315; procedure Num.24 (#Attr.2, #Attr.3): - let Num.316 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.316; + let Num.317 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.317; procedure Num.51 (#Attr.2, #Attr.3): - let Num.311 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.311; + let Num.312 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.312; procedure Num.75 (#Attr.2, #Attr.3): - let Num.315 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.315; + let Num.316 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.316; procedure Num.94 (#Attr.2, #Attr.3): - let Num.307 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.307; + let Num.308 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.308; procedure Str.12 (#Attr.2): let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.262; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.34 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.34; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 93ba06195c4..5e796e4e049 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 @@ -142,7 +142,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.624; -procedure List.80 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): +procedure List.80 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29): joinpoint List.651 List.489 List.490 List.491 List.492 List.493: let List.653 : Int1 = CallByName Num.22 List.492 List.493; if List.653 then @@ -166,7 +166,7 @@ procedure List.80 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_g let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.652; in - jump List.651 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; + jump List.651 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29; procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): joinpoint List.607 List.161 List.162 List.163 List.164 List.165: @@ -183,7 +183,7 @@ procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_g in jump List.607 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; -procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): +procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -197,69 +197,74 @@ procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; + jump List.595 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37; procedure Num.127 (#Attr.2): - let Num.302 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.302; + let Num.303 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.303; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.306 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.306; + let Num.307 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.307; procedure Num.20 (#Attr.2, #Attr.3): - let Num.303 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.303; + let Num.304 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.304; procedure Num.21 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.308; + let Num.309 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.309; procedure Num.22 (#Attr.2, #Attr.3): - let Num.314 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.314; + let Num.315 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.315; procedure Num.24 (#Attr.2, #Attr.3): - let Num.316 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.316; + let Num.317 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.317; procedure Num.51 (#Attr.2, #Attr.3): - let Num.311 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.311; + let Num.312 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.312; procedure Num.75 (#Attr.2, #Attr.3): - let Num.315 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.315; + let Num.316 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.316; procedure Num.94 (#Attr.2, #Attr.3): - let Num.307 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.307; + let Num.308 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.308; procedure Str.12 (#Attr.2): let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.262; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.38 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.38; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index 144cecf42bf..10d85738259 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -80,7 +80,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.579 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.579; -procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): +procedure List.80 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): joinpoint List.616 List.489 List.490 List.491 List.492 List.493: let List.618 : Int1 = CallByName Num.22 List.492 List.493; if List.618 then @@ -104,9 +104,9 @@ procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. let List.617 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.617; in - jump List.616 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.616 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; -procedure List.90 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): +procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.587 List.161 List.162 List.163 List.164 List.165: let List.589 : Int1 = CallByName Num.22 List.164 List.165; if List.589 then @@ -119,61 +119,66 @@ procedure List.90 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen dec List.161; ret List.162; in - jump List.587 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; + jump List.587 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.299 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.299; procedure Num.21 (#Attr.2, #Attr.3): - let Num.300 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.300; + let Num.301 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.301; procedure Num.22 (#Attr.2, #Attr.3): - let Num.304 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.304; + let Num.305 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.305; procedure Num.24 (#Attr.2, #Attr.3): - let Num.306 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.306; + let Num.307 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.307; procedure Num.51 (#Attr.2, #Attr.3): - let Num.302 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.302; + let Num.303 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.303; procedure Num.75 (#Attr.2, #Attr.3): - let Num.305 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.305; + let Num.306 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.306; procedure Num.94 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.299; + let Num.300 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.300; procedure Str.12 (#Attr.2): let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.261; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.13 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.13; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.973, TotallyNotJson.149): let TotallyNotJson.976 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 8f86b62706e..cf16a9ff1bd 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 @@ -137,7 +137,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.633; -procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): +procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): joinpoint List.657 List.489 List.490 List.491 List.492 List.493: let List.659 : Int1 = CallByName Num.22 List.492 List.493; if List.659 then @@ -161,9 +161,9 @@ procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_g let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.658; in - jump List.657 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + jump List.657 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; -procedure List.90 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): +procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): joinpoint List.613 List.161 List.162 List.163 List.164 List.165: let List.615 : Int1 = CallByName Num.22 List.164 List.165; if List.615 then @@ -176,9 +176,9 @@ procedure List.90 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_g dec List.161; ret List.162; in - jump List.613 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; + jump List.613 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): +procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): joinpoint List.601 List.161 List.162 List.163 List.164 List.165: let List.603 : Int1 = CallByName Num.22 List.164 List.165; if List.603 then @@ -192,69 +192,74 @@ procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_g dec List.161; ret List.162; in - jump List.601 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.601 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; procedure Num.127 (#Attr.2): - let Num.304 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.304; + let Num.305 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.305; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.308; + let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.309; procedure Num.20 (#Attr.2, #Attr.3): - let Num.305 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.305; + let Num.306 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.306; procedure Num.21 (#Attr.2, #Attr.3): - let Num.310 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.310; + let Num.311 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.311; procedure Num.22 (#Attr.2, #Attr.3): - let Num.316 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.316; + let Num.317 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.317; procedure Num.24 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.318; + let Num.319 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.319; procedure Num.51 (#Attr.2, #Attr.3): - let Num.313 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.313; + let Num.314 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.314; procedure Num.75 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.317; + let Num.318 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.318; procedure Num.94 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.309; + let Num.310 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.310; procedure Str.12 (#Attr.2): let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.262; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.34 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.34; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 dd81da4e4ac..586c1e022de 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 @@ -140,7 +140,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.633; -procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): +procedure List.80 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): joinpoint List.657 List.489 List.490 List.491 List.492 List.493: let List.659 : Int1 = CallByName Num.22 List.492 List.493; if List.659 then @@ -164,9 +164,24 @@ procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_g let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.658; in - jump List.657 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + jump List.657 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; -procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): +procedure List.90 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): + joinpoint List.613 List.161 List.162 List.163 List.164 List.165: + let List.615 : Int1 = CallByName Num.22 List.164 List.165; + if List.615 then + let List.619 : U8 = CallByName List.66 List.161 List.164; + let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; + let List.618 : U64 = 1i64; + let List.617 : U64 = CallByName Num.51 List.164 List.618; + jump List.613 List.161 List.166 List.163 List.617 List.165; + else + dec List.161; + ret List.162; + in + jump List.613 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + +procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): joinpoint List.601 List.161 List.162 List.163 List.164 List.165: let List.603 : Int1 = CallByName Num.22 List.164 List.165; if List.603 then @@ -180,84 +195,74 @@ procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_g dec List.161; ret List.162; in - jump List.601 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; - -procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): - joinpoint List.613 List.161 List.162 List.163 List.164 List.165: - let List.615 : Int1 = CallByName Num.22 List.164 List.165; - if List.615 then - let List.619 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; - let List.618 : U64 = 1i64; - let List.617 : U64 = CallByName Num.51 List.164 List.618; - jump List.613 List.161 List.166 List.163 List.617 List.165; - else - dec List.161; - ret List.162; - in - jump List.613 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; + jump List.601 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; procedure Num.127 (#Attr.2): - let Num.304 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.304; + let Num.305 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.305; + +procedure Num.133 (#Attr.2): + let Num.297 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.297; procedure Num.19 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.308; + let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.309; procedure Num.20 (#Attr.2, #Attr.3): - let Num.305 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.305; + let Num.306 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.306; procedure Num.21 (#Attr.2, #Attr.3): - let Num.310 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.310; + let Num.311 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.311; procedure Num.22 (#Attr.2, #Attr.3): - let Num.316 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.316; + let Num.317 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.317; procedure Num.24 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.318; + let Num.319 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.319; procedure Num.51 (#Attr.2, #Attr.3): - let Num.313 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.313; + let Num.314 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.314; procedure Num.75 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.317; + let Num.318 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.318; procedure Num.94 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.309; + let Num.310 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.310; procedure Str.12 (#Attr.2): let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.262; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.35 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.35; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; diff --git a/crates/compiler/test_mono/generated/inspect_derived_dict.txt b/crates/compiler/test_mono/generated/inspect_derived_dict.txt index 76cdc2c7fda..90443778cba 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_dict.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_dict.txt @@ -1193,12 +1193,12 @@ procedure Num.96 (#Attr.2): ret Num.464; procedure Str.12 (#Attr.2): - let Str.253 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.253; + let Str.252 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.252; procedure Str.3 (#Attr.2, #Attr.3): - let Str.254 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.254; + let Str.253 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.253; 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 b9876cbe4af..e4a846b5c0f 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_list.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_list.txt @@ -167,8 +167,8 @@ procedure Num.96 (#Attr.2): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 ee6a8c35657..243bebc8b76 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 @@ -269,8 +269,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.299; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; 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 d65b25028c2..074192a8d65 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record.txt @@ -197,8 +197,8 @@ procedure Num.96 (#Attr.2): ret Num.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 1d9035690a6..6e53681ac7b 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 @@ -166,8 +166,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 8b9647f9049..42f558ab11e 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 @@ -173,8 +173,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 f3c3f850a4b..09bdedf7bed 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_string.txt @@ -38,8 +38,8 @@ procedure Inspect.62 (Inspect.306): ret Inspect.306; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 179243014c3..014e6c7d7ba 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 @@ -168,8 +168,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 9ccc72516bc..58c5cc94924 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 @@ -171,8 +171,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 551ac007e89..990c1569281 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 @@ -47,28 +47,28 @@ procedure Num.22 (#Attr.2, #Attr.3): let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; ret Num.297; -procedure Str.27 (Str.88): - let Str.251 : [C Int1, C I64] = CallByName Str.61 Str.88; - ret Str.251; +procedure Str.27 (Str.87): + let Str.250 : [C Int1, C I64] = CallByName Str.61 Str.87; + ret Str.250; procedure Str.42 (#Attr.2): - let Str.259 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.259; + let Str.258 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.258; -procedure Str.61 (Str.195): - let Str.196 : {I64, U8} = CallByName Str.42 Str.195; - dec Str.195; - let Str.257 : U8 = StructAtIndex 1 Str.196; - let Str.258 : U8 = 0i64; - let Str.254 : Int1 = CallByName Bool.11 Str.257 Str.258; - if Str.254 then - let Str.256 : I64 = StructAtIndex 0 Str.196; - let Str.255 : [C Int1, C I64] = TagId(1) Str.256; - ret Str.255; +procedure Str.61 (Str.194): + let Str.195 : {I64, U8} = CallByName Str.42 Str.194; + dec Str.194; + let Str.256 : U8 = StructAtIndex 1 Str.195; + let Str.257 : U8 = 0i64; + let Str.253 : Int1 = CallByName Bool.11 Str.256 Str.257; + if Str.253 then + let Str.255 : I64 = StructAtIndex 0 Str.195; + let Str.254 : [C Int1, C I64] = TagId(1) Str.255; + ret Str.254; else - let Str.253 : Int1 = false; - let Str.252 : [C Int1, C I64] = TagId(0) Str.253; - ret Str.252; + let Str.252 : Int1 = false; + let Str.251 : [C Int1, C I64] = TagId(0) Str.252; + ret Str.251; procedure Test.0 (): let Test.3 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt index 83eb72ab701..686bf280c17 100644 --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -178,6 +178,10 @@ procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen. in jump List.636 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; +procedure Num.133 (#Attr.2): + let Num.336 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.336; + procedure Num.19 (#Attr.2, #Attr.3): let Num.300 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.300; @@ -219,26 +223,27 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.331; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.260 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.260; + let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.259; procedure Str.9 (Str.68): - let Str.258 : U64 = 0i64; - let Str.259 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.258 Str.259; - let Str.255 : Int1 = StructAtIndex 2 Str.69; - if Str.255 then - let Str.257 : Str = StructAtIndex 1 Str.69; - let Str.256 : [C {U64, U8}, C Str] = TagId(1) Str.257; - ret Str.256; + let Str.257 : U64 = 0i64; + let Str.260 : U64 = CallByName List.6 Str.68; + let Str.258 : U64 = CallByName Num.133 Str.260; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; + let Str.254 : Int1 = StructAtIndex 2 Str.69; + if Str.254 then + let Str.256 : Str = StructAtIndex 1 Str.69; + let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; + ret Str.255; else - let Str.253 : U8 = StructAtIndex 3 Str.69; - let Str.254 : U64 = StructAtIndex 0 Str.69; + let Str.252 : U8 = StructAtIndex 3 Str.69; + let Str.253 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.6 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.6; - let Str.252 : {U64, U8} = Struct {Str.254, Str.253}; - let Str.251 : [C {U64, U8}, C Str] = TagId(0) Str.252; - ret Str.251; + let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; + let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; + ret Str.250; procedure Test.3 (): let Test.0 : List U8 = Array [82i64, 111i64, 99i64]; 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 a287a5b1b1f..03821460455 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 @@ -152,6 +152,10 @@ procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen. in jump List.632 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; +procedure Num.133 (#Attr.2): + let Num.336 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.336; + procedure Num.19 (#Attr.2, #Attr.3): let Num.300 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; ret Num.300; @@ -193,53 +197,54 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.331; procedure Str.12 (#Attr.2): - let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.260; + let Str.259 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.259; -procedure Str.27 (Str.88): - let Str.251 : [C {}, C I64] = CallByName Str.61 Str.88; - ret Str.251; +procedure Str.27 (Str.87): + let Str.250 : [C {}, C I64] = CallByName Str.61 Str.87; + ret Str.250; procedure Str.42 (#Attr.2): - let Str.259 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.259; + let Str.258 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.258; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.270 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.270; - -procedure Str.61 (Str.195): - let Str.196 : {I64, U8} = CallByName Str.42 Str.195; - dec Str.195; - let Str.257 : U8 = StructAtIndex 1 Str.196; - let Str.258 : U8 = 0i64; - let Str.254 : Int1 = CallByName Bool.11 Str.257 Str.258; - if Str.254 then - let Str.256 : I64 = StructAtIndex 0 Str.196; - let Str.255 : [C {}, C I64] = TagId(1) Str.256; - ret Str.255; + let Str.269 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.269; + +procedure Str.61 (Str.194): + let Str.195 : {I64, U8} = CallByName Str.42 Str.194; + dec Str.194; + let Str.256 : U8 = StructAtIndex 1 Str.195; + let Str.257 : U8 = 0i64; + let Str.253 : Int1 = CallByName Bool.11 Str.256 Str.257; + if Str.253 then + let Str.255 : I64 = StructAtIndex 0 Str.195; + let Str.254 : [C {}, C I64] = TagId(1) Str.255; + ret Str.254; else - let Str.253 : {} = Struct {}; - let Str.252 : [C {}, C I64] = TagId(0) Str.253; - ret Str.252; + let Str.252 : {} = Struct {}; + let Str.251 : [C {}, C I64] = TagId(0) Str.252; + ret Str.251; procedure Str.9 (Str.68): - let Str.268 : U64 = 0i64; - let Str.269 : U64 = CallByName List.6 Str.68; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.268 Str.269; - let Str.265 : Int1 = StructAtIndex 2 Str.69; - if Str.265 then - let Str.267 : Str = StructAtIndex 1 Str.69; - let Str.266 : [C {U64, U8}, C Str] = TagId(1) Str.267; - ret Str.266; + let Str.267 : U64 = 0i64; + let Str.270 : U64 = CallByName List.6 Str.68; + let Str.268 : U64 = CallByName Num.133 Str.270; + let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.267 Str.268; + let Str.264 : Int1 = StructAtIndex 2 Str.69; + if Str.264 then + let Str.266 : Str = StructAtIndex 1 Str.69; + let Str.265 : [C {U64, U8}, C Str] = TagId(1) Str.266; + ret Str.265; else - let Str.263 : U8 = StructAtIndex 3 Str.69; - let Str.264 : U64 = StructAtIndex 0 Str.69; + let Str.262 : U8 = StructAtIndex 3 Str.69; + let Str.263 : U64 = StructAtIndex 0 Str.69; let #Derived_gen.7 : Str = StructAtIndex 1 Str.69; dec #Derived_gen.7; - let Str.262 : {U64, U8} = Struct {Str.264, Str.263}; - let Str.261 : [C {U64, U8}, C Str] = TagId(0) Str.262; - ret Str.261; + let Str.261 : {U64, U8} = Struct {Str.263, Str.262}; + let Str.260 : [C {U64, U8}, C Str] = TagId(0) Str.261; + ret Str.260; procedure Test.0 (): let Test.37 : Str = "-1234"; 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 26f5ab92fed..fb3c9126320 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt @@ -31,12 +31,12 @@ procedure Num.22 (#Attr.2, #Attr.3): ret Num.297; procedure Str.16 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; + ret Str.250; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; 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 26693c9b44e..a97575e2983 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_owns.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_owns.txt @@ -31,8 +31,8 @@ procedure Num.22 (#Attr.2, #Attr.3): ret Num.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; procedure Test.1 (): let Test.21 : Str = "lllllllllllllllllllllooooooooooong"; diff --git a/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt b/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt index 10f9905d3ef..3a9ba4f34fd 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.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; 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 1c508742f49..2595c165df1 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.297; procedure Str.3 (#Attr.2, #Attr.3): - let Str.253 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.253; + let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.252; 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/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 905fa1b4a88..7f3ca6c4e01 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 @@ -220,8 +220,8 @@ procedure Num.94 (#Attr.2, #Attr.3): ret Num.309; procedure Str.12 (#Attr.2): - let Str.252 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.252; + let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.251; procedure Test.2 (Test.10): let Test.15 : {Str, Str} = CallByName Encode.23 Test.10; 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 b4401ca0922..69d7a5e38bf 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 @@ -178,8 +178,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.319; procedure Str.12 (#Attr.2): - let Str.252 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.252; + let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.251; procedure Test.2 (Test.11): let Test.18 : {{}, {}} = CallByName Encode.23 Test.11; 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 8aa1d448f41..d491b9f6cff 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.62 (Inspect.306): ret Inspect.306; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 9d720641bc6..13fea846b36 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.62 (Inspect.306): ret Inspect.306; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.2 (Test.3): let Test.4 : Str = CallByName Inspect.34 Test.3; From df5b10e981d9556b8cab5d03c8c01354dd64f232 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 13:52:55 -0500 Subject: [PATCH 09/80] Update a readme to no longer mention Nat --- crates/compiler/builtins/README.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/crates/compiler/builtins/README.md b/crates/compiler/builtins/README.md index 7e53c09c57f..66f245745a6 100644 --- a/crates/compiler/builtins/README.md +++ b/crates/compiler/builtins/README.md @@ -6,7 +6,7 @@ Builtins are the functions and modules that are implicitly imported into every m Edit the appropriate `roc/*.roc` file with your new implementation. All normal rules for writing Roc code apply. Be sure to add a declaration, definition, some documentation and add it to the exposes list it in the module head. -Next, look towards the bottom of the `compiler/module/src/symbol.rs` file. Inside the `define_builtins!` macro, there is a list for each of the builtin modules and the function or value names it contains. Add a new entry to the appropriate list for your new function. +Next, look towards the bottom of the `compiler/module/src/symbol.rs` file. Inside the `define_builtins!` macro, there is a list for each of the builtin modules and the function or value names it contains. Add a new entry to the appropriate list for your new function. For each of the builtin modules, there is a file in `compiler/test_gen/src/` like `gen_num.rs`, `gen_str.rs` etc. Add new tests for the module you are changing to the appropriate file here. You can look at the existing test cases for examples and inspiration. @@ -22,14 +22,14 @@ Some of these have `#` inside their name (`first#list`, `#lt` ..). This is a tri But we can use these values and some of these are necessary for implementing builtins. For example, `List.get` returns tags, and it is not easy for us to create tags when composing LLVM. What is easier however, is: -- ..writing `List.#getUnsafe` that has the dangerous signature of `List elem, Nat -> elem` in LLVM -- ..writing `List elem, Nat -> Result elem [OutOfBounds]*` in a type safe way that uses `getUnsafe` internally, only after it checks if the `elem` at `Nat` index exists. +- ..writing `List.#getUnsafe` that has the dangerous signature of `List elem, U64 -> elem` in LLVM +- ..writing `List elem, U64 -> Result elem [OutOfBounds]*` in a type safe way that uses `getUnsafe` internally, only after it checks if the `elem` at `U64` index exists. ### can/src/builtins.rs -Right at the top of this module is a function called `builtin_defs`. All this is doing is mapping the `Symbol` defined in `module/src/symbol.rs` to its implementation. Some of the builtins are quite complex, such as `list_get`. What makes `list_get` is that it returns tags, and in order to return tags it first has to defer to lower-level functions via an if statement. +Right at the top of this module is a function called `builtin_defs`. All this is doing is mapping the `Symbol` defined in `module/src/symbol.rs` to its implementation. Some of the builtins are quite complex, such as `list_get`. What makes `list_get` is that it returns tags, and in order to return tags it first has to defer to lower-level functions via an if statement. -Lets look at `List.repeat : elem, Nat -> List elem`, which is more straight-forward, and points directly to its lower level implementation: +Lets look at `List.repeat : elem, U64 -> List elem`, which is more straightforward, and points directly to its lower level implementation: ```rust fn list_repeat(symbol: Symbol, var_store: &mut VarStore) -> Def { @@ -106,7 +106,7 @@ fn atan() { But replace `Num.atan` and the type signature with the new builtin. -### test_gen/test/*.rs +### test_gen/test/\*.rs In this directory, there are a couple files like `gen_num.rs`, `gen_str.rs`, etc. For the `Str` module builtins, put the test in `gen_str.rs`, etc. Find the one for the new builtin, and add a test like: @@ -123,5 +123,5 @@ But replace `Num.atan`, the return value, and the return type with your new buil When implementing a new builtin, it is often easy to copy and paste the implementation for an existing builtin. This can take you quite far since many builtins are very similar, but it also risks forgetting to change one small part of what you copy and pasted and losing a lot of time later on when you cant figure out why things don't work. So, speaking from experience, even if you are copying an existing builtin, try and implement it manually without copying and pasting. Two recent instances of this (as of September 7th, 2020): -- `List.keepIf` did not work for a long time because in builtins its `LowLevel` was `ListMap`. This was because I copy and pasted the `List.map` implementation in `builtins.rs -- `List.walkBackwards` had mysterious memory bugs for a little while because in `unique.rs` its return type was `list_type(flex(b))` instead of `flex(b)` since it was copy and pasted from `List.keepIf`. +- `List.keepIf` did not work for a long time because in builtins its `LowLevel` was `ListMap`. This was because I copy and pasted the `List.map` implementation in `builtins.rs +- `List.walkBackwards` had mysterious memory bugs for a little while because in `unique.rs` its return type was `list_type(flex(b))` instead of `flex(b)` since it was copy and pasted from `List.keepIf`. From 2e72021a74b700480a32862fcc18541d2861dc0f Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 13:53:16 -0500 Subject: [PATCH 10/80] Drop some obsolete U64 conversions in Str --- crates/compiler/builtins/roc/Str.roc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index b71573347b5..296ec4e5588 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -541,7 +541,7 @@ toUtf8 : Str -> List U8 ## ``` fromUtf8 : List U8 -> Result Str [BadUtf8 Utf8ByteProblem U64] fromUtf8 = \bytes -> - result = fromUtf8RangeLowlevel bytes 0 (List.len bytes |> Num.toU64) + result = fromUtf8RangeLowlevel bytes 0 (List.len bytes) if result.cIsOk then Ok result.bString @@ -561,7 +561,7 @@ expect (Str.fromUtf8 [255]) |> Result.isErr ## ``` fromUtf8Range : List U8, { start : U64, count : U64 } -> Result Str [BadUtf8 Utf8ByteProblem U64, OutOfBounds] fromUtf8Range = \bytes, config -> - if Num.addSaturated config.start config.count <= (List.len bytes |> Num.toU64) then + if Num.addSaturated config.start config.count <= List.len bytes then result = fromUtf8RangeLowlevel bytes config.start config.count if result.cIsOk then From 97f21e65fe1538dcab006c5aa9d5b366f368331a Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 13:53:41 -0500 Subject: [PATCH 11/80] Update ListLen and ListGetUnsafe to not use Nat --- crates/compiler/builtins/roc/List.roc | 92 +++++++++---------- .../compiler/gen_llvm/src/llvm/build_list.rs | 4 +- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 9 +- crates/compiler/gen_wasm/src/low_level.rs | 4 + 4 files changed, 60 insertions(+), 49 deletions(-) diff --git a/crates/compiler/builtins/roc/List.roc b/crates/compiler/builtins/roc/List.roc index c19b9507062..649500e7337 100644 --- a/crates/compiler/builtins/roc/List.roc +++ b/crates/compiler/builtins/roc/List.roc @@ -74,7 +74,7 @@ interface List imports [ Bool.{ Bool, Eq }, Result.{ Result }, - Num.{ Nat, Num, Int }, + Num.{ U64, Num, Int }, ] ## ## Types @@ -91,14 +91,14 @@ interface List ## is normally enabled, not having enough memory could result in the list appearing ## to be created just fine, but then crashing later.) ## -## > The theoretical maximum length for a list created in Roc is half of -## > `Num.maxNat`. Attempting to create a list bigger than that +## > The theoretical maximum length for a list created in Roc is `Num.maxI32` on 32-bit systems +## > and `Num.maxI64` on 64-bit systems. Attempting to create a list bigger than that ## > in Roc code will always fail, although in practice it is likely to fail ## > at much smaller lengths due to insufficient memory being available. ## ## ## Performance Details ## -## Under the hood, a list is a record containing a `len : Nat` field, a `capacity : Nat` +## Under the hood, a list is a record containing a `len : U64` field, a `capacity : U64` ## field, and a pointer to a reference count and a flat array of bytes. ## ## ## Shared Lists @@ -227,7 +227,7 @@ isEmpty = \list -> # unsafe primitive that does not perform a bounds check # but will cause a reference count increment on the value it got out of the list -getUnsafe : List a, Nat -> a +getUnsafe : List a, U64 -> a ## Returns an element from a list at the given index. ## @@ -236,7 +236,7 @@ getUnsafe : List a, Nat -> a ## expect List.get [100, 200, 300] 1 == Ok 200 ## expect List.get [100, 200, 300] 5 == Err OutOfBounds ## ``` -get : List a, Nat -> Result a [OutOfBounds] +get : List a, U64 -> Result a [OutOfBounds] get = \list, index -> if index < List.len list then Ok (List.getUnsafe list index) @@ -245,9 +245,9 @@ get = \list, index -> # unsafe primitive that does not perform a bounds check # but will cause a reference count increment on the value it got out of the list -replaceUnsafe : List a, Nat, a -> { list : List a, value : a } +replaceUnsafe : List a, U64, a -> { list : List a, value : a } -replace : List a, Nat, a -> { list : List a, value : a } +replace : List a, U64, a -> { list : List a, value : a } replace = \list, index, newValue -> if index < List.len list then List.replaceUnsafe list index newValue @@ -262,7 +262,7 @@ replace = \list, index, newValue -> ## list unmodified. ## ## To drop the element at a given index, instead of replacing it, see [List.dropAt]. -set : List a, Nat, a -> List a +set : List a, U64, a -> List a set = \list, index, value -> (List.replace list index value).list @@ -275,7 +275,7 @@ set = \list, index, value -> ## ## To replace the element at a given index, instead of updating based on the current value, ## see [List.set] and [List.replace] -update : List a, Nat, (a -> a) -> List a +update : List a, U64, (a -> a) -> List a update = \list, index, func -> when List.get list index is Err OutOfBounds -> list @@ -285,7 +285,7 @@ update = \list, index, func -> # Update one element in bounds expect - list : List Nat + list : List U64 list = [1, 2, 3] got = update list 1 (\x -> x + 42) want = [1, 44, 3] @@ -293,14 +293,14 @@ expect # Update out of bounds expect - list : List Nat + list : List U64 list = [1, 2, 3] got = update list 5 (\x -> x + 42) got == list # Update chain expect - list : List Nat + list : List U64 list = [1, 2, 3] got = list @@ -374,13 +374,13 @@ prependIfOk = \list, result -> ## One [List] can store up to 2,147,483,648 elements (just over 2 billion), which ## is exactly equal to the highest valid #I32 value. This means the #U32 this function ## returns can always be safely converted to an #I32 without losing any data. -len : List * -> Nat +len : List * -> U64 ## Create a list with space for at least capacity elements -withCapacity : Nat -> List * +withCapacity : U64 -> List * ## Enlarge the list for at least capacity additional elements -reserve : List a, Nat -> List a +reserve : List a, U64 -> List a ## Shrink the memory footprint of a list such that it's capacity and length are equal. ## Note: This will also convert seamless slices to regular lists. @@ -418,11 +418,11 @@ single : a -> List a single = \x -> [x] ## Returns a list with the given length, where every element is the given value. -repeat : a, Nat -> List a +repeat : a, U64 -> List a repeat = \value, count -> repeatHelp value count (List.withCapacity count) -repeatHelp : a, Nat, List a -> List a +repeatHelp : a, U64, List a -> List a repeatHelp = \value, count, accum -> if count > 0 then repeatHelp value (Num.subWrap count 1) (List.appendUnsafe accum value) @@ -501,7 +501,7 @@ walk = \list, init, func -> walkHelp list init func 0 (List.len list) ## internal helper -walkHelp : List elem, s, (s, elem -> s), Nat, Nat -> s +walkHelp : List elem, s, (s, elem -> s), U64, U64 -> s walkHelp = \list, state, f, index, length -> if index < length then nextState = f state (List.getUnsafe list index) @@ -511,12 +511,12 @@ walkHelp = \list, state, f, index, length -> state ## Like [walk], but at each step the function also receives the index of the current element. -walkWithIndex : List elem, state, (state, elem, Nat -> state) -> state +walkWithIndex : List elem, state, (state, elem, U64 -> state) -> state walkWithIndex = \list, init, func -> walkWithIndexHelp list init func 0 (List.len list) ## internal helper -walkWithIndexHelp : List elem, s, (s, elem, Nat -> s), Nat, Nat -> s +walkWithIndexHelp : List elem, s, (s, elem, U64 -> s), U64, U64 -> s walkWithIndexHelp = \list, state, f, index, length -> if index < length then nextState = f state (List.getUnsafe list index) index @@ -526,14 +526,14 @@ walkWithIndexHelp = \list, state, f, index, length -> state ## Like [walkUntil], but at each step the function also receives the index of the current element. -walkWithIndexUntil : List elem, state, (state, elem, Nat -> [Continue state, Break state]) -> state +walkWithIndexUntil : List elem, state, (state, elem, U64 -> [Continue state, Break state]) -> state walkWithIndexUntil = \list, state, f -> when walkWithIndexUntilHelp list state f 0 (List.len list) is Continue new -> new Break new -> new ## internal helper -walkWithIndexUntilHelp : List elem, s, (s, elem, Nat -> [Continue s, Break b]), Nat, Nat -> [Continue s, Break b] +walkWithIndexUntilHelp : List elem, s, (s, elem, U64 -> [Continue s, Break b]), U64, U64 -> [Continue s, Break b] walkWithIndexUntilHelp = \list, state, f, index, length -> if index < length then when f state (List.getUnsafe list index) index is @@ -551,7 +551,7 @@ walkBackwards = \list, state, func -> walkBackwardsHelp list state func (len list) ## internal helper -walkBackwardsHelp : List elem, state, (state, elem -> state), Nat -> state +walkBackwardsHelp : List elem, state, (state, elem -> state), U64 -> state walkBackwardsHelp = \list, state, f, indexPlusOne -> if indexPlusOne == 0 then state @@ -586,7 +586,7 @@ walkBackwardsUntil = \list, initial, func -> Break new -> new ## Walks to the end of the list from a specified starting index -walkFrom : List elem, Nat, state, (state, elem -> state) -> state +walkFrom : List elem, U64, state, (state, elem -> state) -> state walkFrom = \list, index, state, func -> step : _, _ -> [Continue _, Break []] step = \currentState, element -> Continue (func currentState element) @@ -595,7 +595,7 @@ walkFrom = \list, index, state, func -> Continue new -> new ## A combination of [List.walkFrom] and [List.walkUntil] -walkFromUntil : List elem, Nat, state, (state, elem -> [Continue state, Break state]) -> state +walkFromUntil : List elem, U64, state, (state, elem -> [Continue state, Break state]) -> state walkFromUntil = \list, index, state, func -> when List.iterHelp list state func index (List.len list) is Continue new -> new @@ -664,7 +664,7 @@ keepIf = \list, predicate -> keepIfHelp list predicate 0 0 length -keepIfHelp : List a, (a -> Bool), Nat, Nat, Nat -> List a +keepIfHelp : List a, (a -> Bool), U64, U64, U64 -> List a keepIfHelp = \list, predicate, kept, index, length -> if index < length then if predicate (List.getUnsafe list index) then @@ -693,7 +693,7 @@ dropIf = \list, predicate -> ## expect List.countIf [1, -2, -3] Num.isNegative == 2 ## expect List.countIf [1, 2, 3] (\num -> num > 1 ) == 2 ## ``` -countIf : List a, (a -> Bool) -> Nat +countIf : List a, (a -> Bool) -> U64 countIf = \list, predicate -> walkState = \state, elem -> if predicate elem then @@ -775,7 +775,7 @@ map4 : List a, List b, List c, List d, (a, b, c, d -> e) -> List e ## ``` ## expect List.mapWithIndex [10, 20, 30] (\num, index -> num + index) == [10, 21, 32] ## ``` -mapWithIndex : List a, (a, Nat -> b) -> List b +mapWithIndex : List a, (a, U64 -> b) -> List b mapWithIndex = \src, func -> length = len src dest = withCapacity length @@ -783,7 +783,7 @@ mapWithIndex = \src, func -> mapWithIndexHelp src dest func 0 length # Internal helper -mapWithIndexHelp : List a, List b, (a, Nat -> b), Nat, Nat -> List b +mapWithIndexHelp : List a, List b, (a, U64 -> b), U64, U64 -> List b mapWithIndexHelp = \src, dest, func, index, length -> if index < length then elem = getUnsafe src index @@ -958,7 +958,7 @@ sortAsc = \list -> List.sortWith list Num.compare sortDesc : List (Num a) -> List (Num a) sortDesc = \list -> List.sortWith list (\a, b -> Num.compare b a) -swap : List a, Nat, Nat -> List a +swap : List a, U64, U64 -> List a ## Returns the first element in the list, or `ListWasEmpty` if it was empty. first : List a -> Result a [ListWasEmpty] @@ -983,7 +983,7 @@ first = \list -> ## ## To split the list into two lists, use `List.split`. ## -takeFirst : List elem, Nat -> List elem +takeFirst : List elem, U64 -> List elem takeFirst = \list, outputLength -> List.sublist list { start: 0, len: outputLength } @@ -1003,19 +1003,19 @@ takeFirst = \list, outputLength -> ## ## To split the list into two lists, use `List.split`. ## -takeLast : List elem, Nat -> List elem +takeLast : List elem, U64 -> List elem takeLast = \list, outputLength -> List.sublist list { start: Num.subSaturated (List.len list) outputLength, len: outputLength } ## Drops n elements from the beginning of the list. -dropFirst : List elem, Nat -> List elem +dropFirst : List elem, U64 -> List elem dropFirst = \list, n -> remaining = Num.subSaturated (List.len list) n List.takeLast list remaining ## Drops n elements from the end of the list. -dropLast : List elem, Nat -> List elem +dropLast : List elem, U64 -> List elem dropLast = \list, n -> remaining = Num.subSaturated (List.len list) n @@ -1026,7 +1026,7 @@ dropLast = \list, n -> ## This has no effect if the given index is outside the bounds of the list. ## ## To replace the element at a given index, instead of dropping it, see [List.set]. -dropAt : List elem, Nat -> List elem +dropAt : List elem, U64 -> List elem min : List (Num a) -> Result (Num a) [ListWasEmpty] min = \list -> @@ -1101,7 +1101,7 @@ findLast = \list, pred -> ## Returns the index at which the first element in the list ## satisfying a predicate function can be found. ## If no satisfying element is found, an `Err NotFound` is returned. -findFirstIndex : List elem, (elem -> Bool) -> Result Nat [NotFound] +findFirstIndex : List elem, (elem -> Bool) -> Result U64 [NotFound] findFirstIndex = \list, matcher -> foundIndex = List.iterate list 0 \index, elem -> if matcher elem then @@ -1116,7 +1116,7 @@ findFirstIndex = \list, matcher -> ## Returns the last index at which the first element in the list ## satisfying a predicate function can be found. ## If no satisfying element is found, an `Err NotFound` is returned. -findLastIndex : List elem, (elem -> Bool) -> Result Nat [NotFound] +findLastIndex : List elem, (elem -> Bool) -> Result U64 [NotFound] findLastIndex = \list, matches -> foundIndex = List.iterateBackwards list (List.len list) \prevIndex, elem -> answer = Num.subWrap prevIndex 1 @@ -1145,12 +1145,12 @@ findLastIndex = \list, matches -> ## > matter how long the list is, `List.takeLast` can do that more efficiently. ## ## Some languages have a function called **`slice`** which works similarly to this. -sublist : List elem, { start : Nat, len : Nat } -> List elem +sublist : List elem, { start : U64, len : U64 } -> List elem sublist = \list, config -> sublistLowlevel list config.start config.len ## low-level slicing operation that does no bounds checking -sublistLowlevel : List elem, Nat, Nat -> List elem +sublistLowlevel : List elem, U64, U64 -> List elem ## Intersperses `sep` between the elements of `list` ## ``` @@ -1202,7 +1202,7 @@ endsWith = \list, suffix -> ## than the given index, # and the `others` list will be all the others. (This ## means if you give an index of 0, the `before` list will be empty and the ## `others` list will have the same elements as the original list.) -split : List elem, Nat -> { before : List elem, others : List elem } +split : List elem, U64 -> { before : List elem, others : List elem } split = \elements, userSplitIndex -> length = List.len elements splitIndex = if length > userSplitIndex then userSplitIndex else length @@ -1247,7 +1247,7 @@ splitLast = \list, delimiter -> ## size. The last chunk will be shorter if the list does not evenly divide by the ## chunk size. If the provided list is empty or if the chunk size is 0 then the ## result is an empty list. -chunksOf : List a, Nat -> List (List a) +chunksOf : List a, U64 -> List (List a) chunksOf = \list, chunkSize -> if chunkSize == 0 || List.isEmpty list then [] @@ -1255,7 +1255,7 @@ chunksOf = \list, chunkSize -> chunkCapacity = Num.divCeil (List.len list) chunkSize chunksOfHelp list chunkSize (List.withCapacity chunkCapacity) -chunksOfHelp : List a, Nat, List (List a) -> List (List a) +chunksOfHelp : List a, U64, List (List a) -> List (List a) chunksOfHelp = \listRest, chunkSize, chunks -> if List.isEmpty listRest then chunks @@ -1288,7 +1288,7 @@ walkTry = \list, init, func -> walkTryHelp list init func 0 (List.len list) ## internal helper -walkTryHelp : List elem, state, (state, elem -> Result state err), Nat, Nat -> Result state err +walkTryHelp : List elem, state, (state, elem -> Result state err), U64, U64 -> Result state err walkTryHelp = \list, state, f, index, length -> if index < length then when f state (List.getUnsafe list index) is @@ -1303,7 +1303,7 @@ iterate = \list, init, func -> iterHelp list init func 0 (List.len list) ## internal helper -iterHelp : List elem, s, (s, elem -> [Continue s, Break b]), Nat, Nat -> [Continue s, Break b] +iterHelp : List elem, s, (s, elem -> [Continue s, Break b]), U64, U64 -> [Continue s, Break b] iterHelp = \list, state, f, index, length -> if index < length then when f state (List.getUnsafe list index) is @@ -1319,7 +1319,7 @@ iterateBackwards = \list, init, func -> iterBackwardsHelp list init func (List.len list) ## internal helper -iterBackwardsHelp : List elem, s, (s, elem -> [Continue s, Break b]), Nat -> [Continue s, Break b] +iterBackwardsHelp : List elem, s, (s, elem -> [Continue s, Break b]), U64 -> [Continue s, Break b] iterBackwardsHelp = \list, state, f, prevIndex -> if prevIndex > 0 then index = Num.subWrap prevIndex 1 diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index 8c3d899fc95..1580a8673be 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -143,6 +143,8 @@ pub(crate) fn list_get_unsafe<'a, 'ctx>( layout_interner, layout_interner.get_repr(element_layout), ); + // listGetUnsafe takes a U64, but we need to convert that to usize for index calculation. + let elem_index = builder.new_build_int_cast(elem_index, env.ptr_int(), "u64_to_usize"); let ptr_type = elem_type.ptr_type(AddressSpace::default()); // Load the pointer to the array data let array_data_ptr = load_list_ptr(builder, wrapper_struct, ptr_type); @@ -423,7 +425,7 @@ fn bounds_check_comparison<'ctx>( builder.new_build_int_compare(IntPredicate::ULT, elem_index, len, "bounds_check") } -/// List.len : List * -> Nat +/// List.len : List * -> usize (return value will be cast to usize in user-facing API) pub(crate) fn list_len<'ctx>( builder: &Builder<'ctx>, wrapper_struct: StructValue<'ctx>, diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 626aab02d21..de841c816ac 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -618,10 +618,15 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } ListLen => { - // List.len : List * -> Nat + // List.len : List * -> U64 arguments!(list); - list_len(env.builder, list.into_struct_value()).into() + let len_usize = list_len(env.builder, list.into_struct_value()); + + // List.len returns U64, although length is stored as usize + env.builder + .new_build_int_cast(len_usize, env.context.i64_type(), "usize_to_u64") + .into() } ListGetCapacity => { // List.capacity: List a -> Nat diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index d52b7861d0c..35fc39c730a 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -279,6 +279,9 @@ impl<'a> LowLevelCall<'a> { backend .code_builder .i32_load(Align::Bytes4, offset + (4 * Builtin::WRAPPER_LEN)); + + // Length is stored as 32 bits in memory, but List.len returns U64 + backend.code_builder.i64_extend_u_i32(); } _ => internal_error!("invalid storage for List"), }, @@ -321,6 +324,7 @@ impl<'a> LowLevelCall<'a> { backend .storage .load_symbols(&mut backend.code_builder, &[index]); + backend.code_builder.i32_wrap_i64(); // listGetUnsafe takes a U64, but we do 32-bit indexing on wasm. let elem_size = backend.layout_interner.stack_size(self.ret_layout); backend.code_builder.i32_const(elem_size as i32); backend.code_builder.i32_mul(); // index*size From 77a10986d655a438f0eef449727aaf40b6f89ffc Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 14:18:58 -0500 Subject: [PATCH 12/80] Update Set to no longer use Nat --- crates/compiler/builtins/roc/Set.roc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/compiler/builtins/roc/Set.roc b/crates/compiler/builtins/roc/Set.roc index 43a1b4e4661..0bb0b131d0d 100644 --- a/crates/compiler/builtins/roc/Set.roc +++ b/crates/compiler/builtins/roc/Set.roc @@ -28,7 +28,7 @@ interface Set List, Bool.{ Bool, Eq }, Dict.{ Dict }, - Num.{ Nat }, + Num.{ U64 }, Hash.{ Hash, Hasher }, Inspect.{ Inspect, Inspector, InspectFormatter }, ] @@ -80,12 +80,12 @@ empty = \{} -> @Set (Dict.empty {}) ## Return a set with space allocated for a number of entries. This ## may provide a performance optimization if you know how many entries will be ## inserted. -withCapacity : Nat -> Set * +withCapacity : U64 -> Set * withCapacity = \cap -> @Set (Dict.withCapacity cap) ## Enlarge the set for at least capacity additional elements -reserve : Set k, Nat -> Set k +reserve : Set k, U64 -> Set k reserve = \@Set dict, requested -> @Set (Dict.reserve dict requested) @@ -152,7 +152,7 @@ expect ## ## expect countValues == 3 ## ``` -len : Set * -> Nat +len : Set * -> U64 len = \@Set dict -> Dict.len dict @@ -164,7 +164,7 @@ len = \@Set dict -> ## ## capacityOfSet = Set.capacity foodSet ## ``` -capacity : Set * -> Nat +capacity : Set * -> U64 capacity = \@Set dict -> Dict.capacity dict @@ -462,22 +462,22 @@ expect x == fromList (toList x) expect - orderOne : Set Nat + orderOne : Set U64 orderOne = single 1 |> insert 2 - orderTwo : Set Nat + orderTwo : Set U64 orderTwo = single 2 |> insert 1 - wrapperOne : Set (Set Nat) + wrapperOne : Set (Set U64) wrapperOne = single orderOne |> insert orderTwo - wrapperTwo : Set (Set Nat) + wrapperTwo : Set (Set U64) wrapperTwo = single orderTwo |> insert orderOne From 16ddb16177240c8c460b2be8da624231b6b2ad8f Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 14:50:38 -0500 Subject: [PATCH 13/80] Update Dict to no longer use Nat --- crates/compiler/builtins/roc/Dict.roc | 132 ++++++++++++-------------- 1 file changed, 63 insertions(+), 69 deletions(-) diff --git a/crates/compiler/builtins/roc/Dict.roc b/crates/compiler/builtins/roc/Dict.roc index 7b27df659b6..2280b92d3f7 100644 --- a/crates/compiler/builtins/roc/Dict.roc +++ b/crates/compiler/builtins/roc/Dict.roc @@ -34,7 +34,7 @@ interface Dict Result.{ Result }, List, Str, - Num.{ Nat, U64, F32, U32, U8, I8 }, + Num.{ U64, F32, U32, U8, I8 }, Hash.{ Hasher, Hash }, Inspect.{ Inspect, Inspector, InspectFormatter }, ] @@ -151,26 +151,25 @@ empty = \{} -> ## Return a dictionary with space allocated for a number of entries. This ## may provide a performance optimization if you know how many entries will be ## inserted. -withCapacity : Nat -> Dict * * +withCapacity : U64 -> Dict * * withCapacity = \requested -> empty {} |> reserve requested ## Enlarge the dictionary for at least capacity additional elements -reserve : Dict k v, Nat -> Dict k v +reserve : Dict k v, U64 -> Dict k v reserve = \@Dict { buckets, data, maxBucketCapacity: originalMaxBucketCapacity, maxLoadFactor, shifts }, requested -> currentSize = List.len data - requestedSize = currentSize + requested - size = Num.min (Num.toU64 requestedSize) maxSize + requestedSize = Num.addWrap currentSize requested + size = Num.min requestedSize maxSize requestedShifts = calcShiftsForSize size maxLoadFactor if (List.isEmpty buckets) || requestedShifts > shifts then (buckets0, maxBucketCapacity) = allocBucketsFromShift requestedShifts maxLoadFactor buckets1 = fillBucketsFromData buckets0 data requestedShifts - sizeNat = Num.toNat size @Dict { buckets: buckets1, - data: List.reserve data (Num.subSaturated sizeNat currentSize), + data: List.reserve data (Num.subSaturated size currentSize), maxBucketCapacity, maxLoadFactor, shifts: requestedShifts, @@ -186,7 +185,7 @@ releaseExcessCapacity = \@Dict { buckets, data, maxBucketCapacity: originalMaxBu size = List.len data # NOTE: If we want, we technically could increase the load factor here to potentially minimize size more. - minShifts = calcShiftsForSize (Num.toU64 size) maxLoadFactor + minShifts = calcShiftsForSize size maxLoadFactor if minShifts < shifts then (buckets0, maxBucketCapacity) = allocBucketsFromShift minShifts maxLoadFactor buckets1 = fillBucketsFromData buckets0 data minShifts @@ -208,9 +207,9 @@ releaseExcessCapacity = \@Dict { buckets, data, maxBucketCapacity: originalMaxBu ## ## capacityOfDict = Dict.capacity foodDict ## ``` -capacity : Dict * * -> Nat +capacity : Dict * * -> U64 capacity = \@Dict { maxBucketCapacity } -> - Num.toNat maxBucketCapacity + maxBucketCapacity ## Returns a dictionary containing the key and value provided as input. ## ``` @@ -251,7 +250,7 @@ fromList = \data -> ## |> Dict.len ## |> Bool.isEq 3 ## ``` -len : Dict * * -> Nat +len : Dict * * -> U64 len = \@Dict { data } -> List.len data @@ -372,14 +371,14 @@ keepIf : Dict k v, ((k, v) -> Bool) -> Dict k v keepIf = \dict, predicate -> keepIfHelp dict predicate 0 (Dict.len dict) -keepIfHelp : Dict k v, ((k, v) -> Bool), Nat, Nat -> Dict k v +keepIfHelp : Dict k v, ((k, v) -> Bool), U64, U64 -> Dict k v keepIfHelp = \@Dict dict, predicate, index, length -> if index < length then (key, value) = listGetUnsafe dict.data index if predicate (key, value) then - keepIfHelp (@Dict dict) predicate (index + 1) length + keepIfHelp (@Dict dict) predicate (index |> Num.addWrap 1) length else - keepIfHelp (Dict.remove (@Dict dict) key) predicate index (length - 1) + keepIfHelp (Dict.remove (@Dict dict) key) predicate index (length |> Num.subWrap 1) else @Dict dict @@ -450,13 +449,13 @@ insert = \dict, key, value -> insertHelper buckets data bucketIndex distAndFingerprint key value maxBucketCapacity maxLoadFactor shifts -insertHelper : List Bucket, List (k, v), Nat, U32, k, v, U64, F32, U8 -> Dict k v +insertHelper : List Bucket, List (k, v), U64, U32, k, v, U64, F32, U8 -> Dict k v insertHelper = \buckets0, data0, bucketIndex0, distAndFingerprint0, key, value, maxBucketCapacity, maxLoadFactor, shifts -> - loaded = listGetUnsafe buckets0 (Num.toNat bucketIndex0) + loaded = listGetUnsafe buckets0 bucketIndex0 if distAndFingerprint0 == loaded.distAndFingerprint then - (foundKey, _) = listGetUnsafe data0 (Num.toNat loaded.dataIndex) + (foundKey, _) = listGetUnsafe data0 (Num.toU64 loaded.dataIndex) if foundKey == key then - data1 = List.set data0 (Num.toNat loaded.dataIndex) (key, value) + data1 = List.set data0 (Num.toU64 loaded.dataIndex) (key, value) @Dict { buckets: buckets0, data: data1, maxBucketCapacity, maxLoadFactor, shifts } else bucketIndex1 = nextBucketIndex bucketIndex0 (List.len buckets0) @@ -464,7 +463,7 @@ insertHelper = \buckets0, data0, bucketIndex0, distAndFingerprint0, key, value, insertHelper buckets0 data0 bucketIndex1 distAndFingerprint1 key value maxBucketCapacity maxLoadFactor shifts else if distAndFingerprint0 > loaded.distAndFingerprint then data1 = List.append data0 (key, value) - dataIndex = (List.len data1) - 1 + dataIndex = (List.len data1) |> Num.subWrap 1 buckets1 = placeAndShiftUp buckets0 { distAndFingerprint: distAndFingerprint0, dataIndex: Num.toU32 dataIndex } bucketIndex0 @Dict { buckets: buckets1, data: data1, maxBucketCapacity, maxLoadFactor, shifts } else @@ -487,7 +486,7 @@ remove = \@Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts }, key (bucketIndex0, distAndFingerprint0) = nextWhileLess buckets key shifts (bucketIndex1, distAndFingerprint1) = removeHelper buckets bucketIndex0 distAndFingerprint0 data key - bucket = listGetUnsafe buckets (Num.toNat bucketIndex1) + bucket = listGetUnsafe buckets bucketIndex1 if distAndFingerprint1 != bucket.distAndFingerprint then @Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts } else @@ -495,10 +494,11 @@ remove = \@Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts }, key else @Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts } +removeHelper : List Bucket, U64, U32, List (k, *), k -> (U64, U32) where k implements Eq removeHelper = \buckets, bucketIndex, distAndFingerprint, data, key -> - bucket = listGetUnsafe buckets (Num.toNat bucketIndex) + bucket = listGetUnsafe buckets bucketIndex if distAndFingerprint == bucket.distAndFingerprint then - (foundKey, _) = listGetUnsafe data (Num.toNat bucket.dataIndex) + (foundKey, _) = listGetUnsafe data (Num.toU64 bucket.dataIndex) if foundKey == key then (bucketIndex, distAndFingerprint) else @@ -529,7 +529,7 @@ update = \@Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts }, key when alter (Present value) is Present newValue -> bucket = listGetUnsafe buckets bucketIndex - newData = List.set data (Num.toNat bucket.dataIndex) (key, newValue) + newData = List.set data (Num.toU64 bucket.dataIndex) (key, newValue) @Dict { buckets, data: newData, maxBucketCapacity, maxLoadFactor, shifts } Missing -> @@ -538,7 +538,7 @@ update = \@Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts }, key Err KeyNotFound -> when alter Missing is Present newValue -> - if List.len data >= (Num.toNat maxBucketCapacity) then + if List.len data >= maxBucketCapacity then # Need to reallocate let regular insert handle that. insert (@Dict { buckets, data, maxBucketCapacity, maxLoadFactor, shifts }) key newValue else @@ -721,20 +721,20 @@ emptyBucket = { distAndFingerprint: 0, dataIndex: 0 } distInc = Num.shiftLeftBy 1u32 8 # skip 1 byte fingerprint fingerprintMask = Num.subWrap distInc 1 # mask for 1 byte of fingerprint defaultMaxLoadFactor = 0.8 -initialShifts = 64 - 3 # 2^(64-shifts) number of buckets +initialShifts = 64 |> Num.subWrap 3 # 2^(64-shifts) number of buckets maxSize = Num.shiftLeftBy 1u64 32 maxBucketCount = maxSize incrementDist = \distAndFingerprint -> - distAndFingerprint + distInc + Num.addWrap distAndFingerprint distInc incrementDistN = \distAndFingerprint, n -> - distAndFingerprint + (n * distInc) + Num.addWrap distAndFingerprint (Num.mulWrap n distInc) decrementDist = \distAndFingerprint -> - distAndFingerprint - distInc + distAndFingerprint |> Num.subWrap distInc -find : Dict k v, k -> { bucketIndex : Nat, result : Result v [KeyNotFound] } +find : Dict k v, k -> { bucketIndex : U64, result : Result v [KeyNotFound] } find = \@Dict { buckets, data, shifts }, key -> hash = hashKey key distAndFingerprint = distAndFingerprintFromHash hash @@ -749,13 +749,13 @@ find = \@Dict { buckets, data, shifts }, key -> findManualUnrolls = 2 -findFirstUnroll : List Bucket, Nat, U32, List (k, v), k -> { bucketIndex : Nat, result : Result v [KeyNotFound] } where k implements Eq +findFirstUnroll : List Bucket, U64, U32, List (k, v), k -> { bucketIndex : U64, result : Result v [KeyNotFound] } where k implements Eq findFirstUnroll = \buckets, bucketIndex, distAndFingerprint, data, key -> # TODO: once we have short circuit evaluation, use it here and other similar locations in this file. # Avoid the nested if with else block inconvenience. bucket = listGetUnsafe buckets bucketIndex if distAndFingerprint == bucket.distAndFingerprint then - (foundKey, value) = listGetUnsafe data (Num.toNat bucket.dataIndex) + (foundKey, value) = listGetUnsafe data (Num.toU64 bucket.dataIndex) if foundKey == key then { bucketIndex, result: Ok value } else @@ -763,11 +763,11 @@ findFirstUnroll = \buckets, bucketIndex, distAndFingerprint, data, key -> else findSecondUnroll buckets (nextBucketIndex bucketIndex (List.len buckets)) (incrementDist distAndFingerprint) data key -findSecondUnroll : List Bucket, Nat, U32, List (k, v), k -> { bucketIndex : Nat, result : Result v [KeyNotFound] } where k implements Eq +findSecondUnroll : List Bucket, U64, U32, List (k, v), k -> { bucketIndex : U64, result : Result v [KeyNotFound] } where k implements Eq findSecondUnroll = \buckets, bucketIndex, distAndFingerprint, data, key -> bucket = listGetUnsafe buckets bucketIndex if distAndFingerprint == bucket.distAndFingerprint then - (foundKey, value) = listGetUnsafe data (Num.toNat bucket.dataIndex) + (foundKey, value) = listGetUnsafe data (Num.toU64 bucket.dataIndex) if foundKey == key then { bucketIndex, result: Ok value } else @@ -775,11 +775,11 @@ findSecondUnroll = \buckets, bucketIndex, distAndFingerprint, data, key -> else findHelper buckets (nextBucketIndex bucketIndex (List.len buckets)) (incrementDist distAndFingerprint) data key -findHelper : List Bucket, Nat, U32, List (k, v), k -> { bucketIndex : Nat, result : Result v [KeyNotFound] } where k implements Eq +findHelper : List Bucket, U64, U32, List (k, v), k -> { bucketIndex : U64, result : Result v [KeyNotFound] } where k implements Eq findHelper = \buckets, bucketIndex, distAndFingerprint, data, key -> bucket = listGetUnsafe buckets bucketIndex if distAndFingerprint == bucket.distAndFingerprint then - (foundKey, value) = listGetUnsafe data (Num.toNat bucket.dataIndex) + (foundKey, value) = listGetUnsafe data (Num.toU64 bucket.dataIndex) if foundKey == key then { bucketIndex, result: Ok value } else @@ -789,18 +789,19 @@ findHelper = \buckets, bucketIndex, distAndFingerprint, data, key -> else findHelper buckets (nextBucketIndex bucketIndex (List.len buckets)) (incrementDist distAndFingerprint) data key -removeBucket : Dict k v, Nat -> Dict k v +removeBucket : Dict k v, U64 -> Dict k v removeBucket = \@Dict { buckets: buckets0, data: data0, maxBucketCapacity, maxLoadFactor, shifts }, bucketIndex0 -> - { dataIndex: dataIndexToRemove } = listGetUnsafe buckets0 bucketIndex0 + dataIndexToRemove = (listGetUnsafe buckets0 bucketIndex0).dataIndex + dataIndexToRemoveU64 = Num.toU64 dataIndexToRemove (buckets1, bucketIndex1) = removeBucketHelper buckets0 bucketIndex0 buckets2 = List.set buckets1 bucketIndex1 emptyBucket - lastDataIndex = List.len data0 - 1 - if (Num.toNat dataIndexToRemove) != lastDataIndex then + lastDataIndex = List.len data0 |> Num.subWrap 1 + if dataIndexToRemoveU64 != lastDataIndex then # Swap removed item to the end - data1 = List.swap data0 (Num.toNat dataIndexToRemove) lastDataIndex - (key, _) = listGetUnsafe data1 (Num.toNat dataIndexToRemove) + data1 = List.swap data0 dataIndexToRemoveU64 lastDataIndex + (key, _) = listGetUnsafe data1 dataIndexToRemoveU64 # Update the data index of the new value. hash = hashKey key @@ -824,7 +825,7 @@ removeBucket = \@Dict { buckets: buckets0, data: data0, maxBucketCapacity, maxLo shifts, } -scanForIndex : List Bucket, Nat, U32 -> Nat +scanForIndex : List Bucket, U64, U32 -> U64 scanForIndex = \buckets, bucketIndex, dataIndex -> bucket = listGetUnsafe buckets bucketIndex if bucket.dataIndex != dataIndex then @@ -832,7 +833,7 @@ scanForIndex = \buckets, bucketIndex, dataIndex -> else bucketIndex -removeBucketHelper : List Bucket, Nat -> (List Bucket, Nat) +removeBucketHelper : List Bucket, U64 -> (List Bucket, U64) removeBucketHelper = \buckets, bucketIndex -> nextIndex = nextBucketIndex bucketIndex (List.len buckets) nextBucket = listGetUnsafe buckets nextIndex @@ -846,7 +847,7 @@ removeBucketHelper = \buckets, bucketIndex -> increaseSize : Dict k v -> Dict k v increaseSize = \@Dict { data, maxBucketCapacity, maxLoadFactor, shifts } -> if maxBucketCapacity != maxBucketCount then - newShifts = shifts - 1 + newShifts = shifts |> Num.subWrap 1 (buckets0, newMaxBucketCapacity) = allocBucketsFromShift newShifts maxLoadFactor buckets1 = fillBucketsFromData buckets0 data newShifts @Dict { @@ -864,14 +865,14 @@ allocBucketsFromShift = \shifts, maxLoadFactor -> bucketCount = calcNumBuckets shifts if bucketCount == maxBucketCount then # reached the maximum, make sure we can use each bucket - (List.repeat emptyBucket (Num.toNat maxBucketCount), maxBucketCount) + (List.repeat emptyBucket maxBucketCount, maxBucketCount) else maxBucketCapacity = bucketCount |> Num.toF32 |> Num.mul maxLoadFactor |> Num.floor - (List.repeat emptyBucket (Num.toNat bucketCount), maxBucketCapacity) + (List.repeat emptyBucket bucketCount, maxBucketCapacity) calcShiftsForSize : U64, F32 -> U8 calcShiftsForSize = \size, maxLoadFactor -> @@ -885,13 +886,13 @@ calcShiftsForSizeHelper = \shifts, size, maxLoadFactor -> |> Num.mul maxLoadFactor |> Num.floor if shifts > 0 && maxBucketCapacity < size then - calcShiftsForSizeHelper (shifts - 1) size maxLoadFactor + calcShiftsForSizeHelper (shifts |> Num.subWrap 1) size maxLoadFactor else shifts calcNumBuckets = \shifts -> Num.min - (Num.shiftLeftBy 1 (64 - shifts)) + (Num.shiftLeftBy 1 (64 |> Num.subWrap shifts)) maxBucketCount fillBucketsFromData = \buckets0, data, shifts -> @@ -899,7 +900,7 @@ fillBucketsFromData = \buckets0, data, shifts -> (bucketIndex, distAndFingerprint) = nextWhileLess buckets1 key shifts placeAndShiftUp buckets1 { distAndFingerprint, dataIndex: Num.toU32 dataIndex } bucketIndex -nextWhileLess : List Bucket, k, U8 -> (Nat, U32) where k implements Hash & Eq +nextWhileLess : List Bucket, k, U8 -> (U64, U32) where k implements Hash & Eq nextWhileLess = \buckets, key, shifts -> hash = hashKey key distAndFingerprint = distAndFingerprintFromHash hash @@ -908,22 +909,22 @@ nextWhileLess = \buckets, key, shifts -> nextWhileLessHelper buckets bucketIndex distAndFingerprint nextWhileLessHelper = \buckets, bucketIndex, distAndFingerprint -> - loaded = listGetUnsafe buckets (Num.toNat bucketIndex) + loaded = listGetUnsafe buckets bucketIndex if distAndFingerprint < loaded.distAndFingerprint then nextWhileLessHelper buckets (nextBucketIndex bucketIndex (List.len buckets)) (incrementDist distAndFingerprint) else (bucketIndex, distAndFingerprint) placeAndShiftUp = \buckets0, bucket, bucketIndex -> - loaded = listGetUnsafe buckets0 (Num.toNat bucketIndex) + loaded = listGetUnsafe buckets0 bucketIndex if loaded.distAndFingerprint != 0 then - buckets1 = List.set buckets0 (Num.toNat bucketIndex) bucket + buckets1 = List.set buckets0 bucketIndex bucket placeAndShiftUp buckets1 { loaded & distAndFingerprint: incrementDist loaded.distAndFingerprint } (nextBucketIndex bucketIndex (List.len buckets1)) else - List.set buckets0 (Num.toNat bucketIndex) bucket + List.set buckets0 bucketIndex bucket nextBucketIndex = \bucketIndex, maxBuckets -> # I just ported this impl directly. @@ -947,11 +948,10 @@ distAndFingerprintFromHash = \hash -> |> Num.bitwiseAnd fingerprintMask |> Num.bitwiseOr distInc -bucketIndexFromHash : U64, U8 -> Nat +bucketIndexFromHash : U64, U8 -> U64 bucketIndexFromHash = \hash, shifts -> hash |> Num.shiftRightZfBy shifts - |> Num.toNat expect val = @@ -1185,12 +1185,6 @@ expect |> len |> Bool.isEq 0 -# Makes sure a Dict with Nat keys works -expect - empty {} - |> insert 7nat "Testing" - |> get 7 - |> Bool.isEq (Ok "Testing") # All BadKey's hash to the same location. # This is needed to test some robinhood logic. @@ -1225,7 +1219,7 @@ expect acc, k <- List.walk badKeys (Dict.empty {}) Dict.update acc k \val -> when val is - Present p -> Present (p + 1) + Present p -> Present (p |> Num.addWrap 1) Missing -> Present 0 allInsertedCorrectly = @@ -1236,7 +1230,7 @@ expect # Note, there are a number of places we should probably use set and replace unsafe. # unsafe primitive that does not perform a bounds check -listGetUnsafe : List a, Nat -> a +listGetUnsafe : List a, U64 -> a # We have decided not to expose the standard roc hashing algorithm. # This is to avoid external dependence and the need for versioning. @@ -1368,9 +1362,9 @@ addBytes = \@LowLevelHasher { initializedSeed, state }, list -> else hashBytesHelper48 initializedSeed initializedSeed initializedSeed list 0 length - combineState (@LowLevelHasher { initializedSeed, state }) { a: abs.a, b: abs.b, seed: abs.seed, length: Num.toU64 length } + combineState (@LowLevelHasher { initializedSeed, state }) { a: abs.a, b: abs.b, seed: abs.seed, length } -hashBytesHelper48 : U64, U64, U64, List U8, Nat, Nat -> { a : U64, b : U64, seed : U64 } +hashBytesHelper48 : U64, U64, U64, List U8, U64, U64 -> { a : U64, b : U64, seed : U64 } hashBytesHelper48 = \seed, see1, see2, list, index, remaining -> newSeed = wymix (Num.bitwiseXor (wyr8 list index) wyp1) (Num.bitwiseXor (wyr8 list (Num.addWrap index 8)) seed) newSee1 = wymix (Num.bitwiseXor (wyr8 list (Num.addWrap index 16)) wyp2) (Num.bitwiseXor (wyr8 list (Num.addWrap index 24)) see1) @@ -1389,7 +1383,7 @@ hashBytesHelper48 = \seed, see1, see2, list, index, remaining -> { a: wyr8 list (Num.subWrap newRemaining 16 |> Num.addWrap newIndex), b: wyr8 list (Num.subWrap newRemaining 8 |> Num.addWrap newIndex), seed: finalSeed } -hashBytesHelper16 : U64, List U8, Nat, Nat -> { a : U64, b : U64, seed : U64 } +hashBytesHelper16 : U64, List U8, U64, U64 -> { a : U64, b : U64, seed : U64 } hashBytesHelper16 = \seed, list, index, remaining -> newSeed = wymix (Num.bitwiseXor (wyr8 list index) wyp1) (Num.bitwiseXor (wyr8 list (Num.addWrap index 8)) seed) newRemaining = Num.subWrap remaining 16 @@ -1426,7 +1420,7 @@ wymum = \a, b -> { lower, upper } # Get the next 8 bytes as a U64 -wyr8 : List U8, Nat -> U64 +wyr8 : List U8, U64 -> U64 wyr8 = \list, index -> # With seamless slices and Num.fromBytes, this should be possible to make faster and nicer. # It would also deal with the fact that on big endian systems we want to invert the order here. @@ -1447,7 +1441,7 @@ wyr8 = \list, index -> Num.bitwiseOr (Num.bitwiseOr a b) (Num.bitwiseOr c d) # Get the next 4 bytes as a U64 with some shifting. -wyr4 : List U8, Nat -> U64 +wyr4 : List U8, U64 -> U64 wyr4 = \list, index -> p1 = listGetUnsafe list index |> Num.toU64 p2 = listGetUnsafe list (Num.addWrap index 1) |> Num.toU64 @@ -1460,7 +1454,7 @@ wyr4 = \list, index -> # Get the next K bytes with some shifting. # K must be 3 or less. -wyr3 : List U8, Nat, Nat -> U64 +wyr3 : List U8, U64, U64 -> U64 wyr3 = \list, index, k -> # ((uint64_t)p[0])<<16)|(((uint64_t)p[k>>1])<<8)|p[k-1] p1 = listGetUnsafe list index |> Num.toU64 From 6140c5023ba9ac10b4b5b8296fdcf878b0dc8d47 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 15:48:27 -0500 Subject: [PATCH 14/80] Remove Nat from TotallyNotJson --- .../compiler/builtins/roc/TotallyNotJson.roc | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/crates/compiler/builtins/roc/TotallyNotJson.roc b/crates/compiler/builtins/roc/TotallyNotJson.roc index 48481545351..6626343e6b6 100644 --- a/crates/compiler/builtins/roc/TotallyNotJson.roc +++ b/crates/compiler/builtins/roc/TotallyNotJson.roc @@ -34,7 +34,6 @@ interface TotallyNotJson I128, F32, F64, - Nat, Dec, }, Bool.{ Bool, Eq }, @@ -678,21 +677,21 @@ numberHelp = \state, byte -> NumberState : [ Start, - Minus Nat, - Zero Nat, - Integer Nat, - FractionA Nat, - FractionB Nat, - ExponentA Nat, - ExponentB Nat, - ExponentC Nat, + Minus U64, + Zero U64, + Integer U64, + FractionA U64, + FractionB U64, + ExponentA U64, + ExponentB U64, + ExponentC U64, Invalid, - Finish Nat, + Finish U64, ] # TODO confirm if we would like to be able to decode # "340282366920938463463374607431768211455" which is MAX U128 and 39 bytes -maxBytes : Nat +maxBytes : U64 maxBytes = 21 # Max bytes in a double precision float isDigit0to9 : U8 -> Bool @@ -894,13 +893,13 @@ stringHelp = \state, byte -> StringState : [ Start, - Chars Nat, - Escaped Nat, - UnicodeA Nat, - UnicodeB Nat, - UnicodeC Nat, - UnicodeD Nat, - Finish Nat, + Chars U64, + Escaped U64, + UnicodeA U64, + UnicodeB U64, + UnicodeC U64, + UnicodeD U64, + Finish U64, InvalidNumber, ] @@ -1176,14 +1175,14 @@ expect actual == expected ArrayOpeningState : [ - BeforeOpeningBracket Nat, - AfterOpeningBracket Nat, + BeforeOpeningBracket U64, + AfterOpeningBracket U64, ] ArrayClosingState : [ - BeforeNextElemOrClosingBracket Nat, - BeforeNextElement Nat, - AfterClosingBracket Nat, + BeforeNextElemOrClosingBracket U64, + BeforeNextElement U64, + AfterClosingBracket U64, ] # Test decoding an empty array @@ -1317,13 +1316,13 @@ objectHelp = \state, byte -> _ -> Break InvalidObject ObjectState : [ - BeforeOpeningBrace Nat, - AfterOpeningBrace Nat, - ObjectFieldNameStart Nat, - BeforeColon Nat, - AfterColon Nat, - AfterObjectValue Nat, - AfterComma Nat, - AfterClosingBrace Nat, + BeforeOpeningBrace U64, + AfterOpeningBrace U64, + ObjectFieldNameStart U64, + BeforeColon U64, + AfterColon U64, + AfterObjectValue U64, + AfterComma U64, + AfterClosingBrace U64, InvalidObject, ] From ef9623798b01fd10cc5121d6d2fdaa1c032d17e0 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 16:55:21 -0500 Subject: [PATCH 15/80] Update CLI testing examples to not use Nat --- crates/cli_testing_examples/algorithms/quicksort.roc | 8 ++++---- crates/cli_testing_examples/benchmarks/Base64/Decode.roc | 4 ++-- crates/cli_testing_examples/benchmarks/Base64/Encode.roc | 2 +- crates/cli_testing_examples/benchmarks/Bytes/Decode.roc | 2 +- crates/cli_testing_examples/benchmarks/Bytes/Encode.roc | 8 ++++---- crates/cli_testing_examples/benchmarks/Quicksort.roc | 8 ++++---- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/cli_testing_examples/algorithms/quicksort.roc b/crates/cli_testing_examples/algorithms/quicksort.roc index d3b2f9a8324..828295a8b3e 100644 --- a/crates/cli_testing_examples/algorithms/quicksort.roc +++ b/crates/cli_testing_examples/algorithms/quicksort.roc @@ -8,7 +8,7 @@ quicksort = \originalList -> quicksortHelp originalList 0 (n - 1) -quicksortHelp : List (Num a), Nat, Nat -> List (Num a) +quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -19,7 +19,7 @@ quicksortHelp = \list, low, high -> else list -partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] +partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -30,7 +30,7 @@ partition = \low, high, initialList -> Err _ -> Pair low initialList -partitionHelp : Nat, Nat, List (Num c), Nat, Num c -> [Pair Nat (List (Num c))] +partitionHelp : U64, U64, List (Num c), U64, Num c -> [Pair U64 (List (Num c))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is @@ -45,7 +45,7 @@ partitionHelp = \i, j, list, high, pivot -> else Pair i list -swap : Nat, Nat, List a -> List a +swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> diff --git a/crates/cli_testing_examples/benchmarks/Base64/Decode.roc b/crates/cli_testing_examples/benchmarks/Base64/Decode.roc index 35680025d94..362b92ee80d 100644 --- a/crates/cli_testing_examples/benchmarks/Base64/Decode.roc +++ b/crates/cli_testing_examples/benchmarks/Base64/Decode.roc @@ -4,10 +4,10 @@ fromBytes : List U8 -> Result Str DecodeProblem fromBytes = \bytes -> Bytes.Decode.decode bytes (decodeBase64 (List.len bytes)) -decodeBase64 : Nat -> ByteDecoder Str +decodeBase64 : U64 -> ByteDecoder Str decodeBase64 = \width -> Bytes.Decode.loop loopHelp { remaining: width, string: "" } -loopHelp : { remaining : Nat, string : Str } -> ByteDecoder (Bytes.Decode.Step { remaining : Nat, string : Str } Str) +loopHelp : { remaining : U64, string : Str } -> ByteDecoder (Bytes.Decode.Step { remaining : U64, string : Str } Str) loopHelp = \{ remaining, string } -> if remaining >= 3 then x, y, z <- Bytes.Decode.map3 Bytes.Decode.u8 Bytes.Decode.u8 Bytes.Decode.u8 diff --git a/crates/cli_testing_examples/benchmarks/Base64/Encode.roc b/crates/cli_testing_examples/benchmarks/Base64/Encode.roc index 74a6ef9009c..bfdb7bfbbcc 100644 --- a/crates/cli_testing_examples/benchmarks/Base64/Encode.roc +++ b/crates/cli_testing_examples/benchmarks/Base64/Encode.roc @@ -18,7 +18,7 @@ encodeChunks = \bytes -> List.walk bytes { output: [], accum: None } folder |> encodeResidual -coerce : Nat, a -> a +coerce : U64, a -> a coerce = \_, x -> x # folder : { output : List ByteEncoder, accum : State }, U8 -> { output : List ByteEncoder, accum : State } diff --git a/crates/cli_testing_examples/benchmarks/Bytes/Decode.roc b/crates/cli_testing_examples/benchmarks/Bytes/Decode.roc index e52395ca3ad..705e9f49a27 100644 --- a/crates/cli_testing_examples/benchmarks/Bytes/Decode.roc +++ b/crates/cli_testing_examples/benchmarks/Bytes/Decode.roc @@ -1,6 +1,6 @@ interface Bytes.Decode exposes [ByteDecoder, decode, map, map2, u8, loop, Step, succeed, DecodeProblem, after, map3] imports [] -State : { bytes : List U8, cursor : Nat } +State : { bytes : List U8, cursor : U64 } DecodeProblem : [OutOfBytes] diff --git a/crates/cli_testing_examples/benchmarks/Bytes/Encode.roc b/crates/cli_testing_examples/benchmarks/Bytes/Encode.roc index 97437211649..c44192e529e 100644 --- a/crates/cli_testing_examples/benchmarks/Bytes/Encode.roc +++ b/crates/cli_testing_examples/benchmarks/Bytes/Encode.roc @@ -2,7 +2,7 @@ interface Bytes.Encode exposes [ByteEncoder, sequence, u8, u16, bytes, empty, en Endianness : [BE, LE] -ByteEncoder : [Signed8 I8, Unsigned8 U8, Signed16 Endianness I16, Unsigned16 Endianness U16, Sequence Nat (List ByteEncoder), Bytes (List U8)] +ByteEncoder : [Signed8 I8, Unsigned8 U8, Signed16 Endianness I16, Unsigned16 Endianness U16, Sequence U64 (List ByteEncoder), Bytes (List U8)] u8 : U8 -> ByteEncoder u8 = \value -> Unsigned8 value @@ -24,7 +24,7 @@ sequence : List ByteEncoder -> ByteEncoder sequence = \encoders -> Sequence (getWidths encoders 0) encoders -getWidth : ByteEncoder -> Nat +getWidth : ByteEncoder -> U64 getWidth = \encoder -> when encoder is Signed8 _ -> 1 @@ -40,7 +40,7 @@ getWidth = \encoder -> Sequence w _ -> w Bytes bs -> List.len bs -getWidths : List ByteEncoder, Nat -> Nat +getWidths : List ByteEncoder, U64 -> U64 getWidths = \encoders, initial -> List.walk encoders initial \accum, encoder -> accum + getWidth encoder @@ -51,7 +51,7 @@ encode = \encoder -> encodeHelp encoder 0 output |> .output -encodeHelp : ByteEncoder, Nat, List U8 -> { output : List U8, offset : Nat } +encodeHelp : ByteEncoder, U64, List U8 -> { output : List U8, offset : U64 } encodeHelp = \encoder, offset, output -> when encoder is Unsigned8 value -> diff --git a/crates/cli_testing_examples/benchmarks/Quicksort.roc b/crates/cli_testing_examples/benchmarks/Quicksort.roc index 0e934709c48..28d9de34a5c 100644 --- a/crates/cli_testing_examples/benchmarks/Quicksort.roc +++ b/crates/cli_testing_examples/benchmarks/Quicksort.roc @@ -24,7 +24,7 @@ sortWith = \list, order -> quicksortHelp list order 0 (n - 1) -quicksortHelp : List a, Order a, Nat, Nat -> List a +quicksortHelp : List a, Order a, U64, U64 -> List a quicksortHelp = \list, order, low, high -> if low < high then when partition low high list order is @@ -35,7 +35,7 @@ quicksortHelp = \list, order, low, high -> else list -partition : Nat, Nat, List a, Order a -> [Pair Nat (List a)] +partition : U64, U64, List a, Order a -> [Pair U64 (List a)] partition = \low, high, initialList, order -> when List.get initialList high is Ok pivot -> @@ -46,7 +46,7 @@ partition = \low, high, initialList, order -> Err _ -> Pair low initialList -partitionHelp : Nat, Nat, List c, Order c, Nat, c -> [Pair Nat (List c)] +partitionHelp : U64, U64, List c, Order c, U64, c -> [Pair U64 (List c)] partitionHelp = \i, j, list, order, high, pivot -> if j < high then when List.get list j is @@ -63,7 +63,7 @@ partitionHelp = \i, j, list, order, high, pivot -> else Pair i list -swap : Nat, Nat, List a -> List a +swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> From 69f6d8e99ad87a72c11cd5ba86538647e13d8c6c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 17:02:08 -0500 Subject: [PATCH 16/80] Update more examples to not use Nat --- examples/Community.roc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/Community.roc b/examples/Community.roc index 8a79d3dd446..370d599a2c8 100644 --- a/examples/Community.roc +++ b/examples/Community.roc @@ -13,7 +13,7 @@ interface Community Community := { people : List Person, - friends : List (Set Nat), + friends : List (Set U64), } implements [Inspect] @@ -81,4 +81,3 @@ walkFriendNames = \@Community { people, friends }, s0, nextFn -> (nextFn s1 personName friendNames, id + 1) out - From ef030ae65612295aaf8747c68ab0b9235c9088f8 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 17:02:18 -0500 Subject: [PATCH 17/80] Update a comment --- crates/compiler/can/src/builtins.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index 534c8afd706..9e5886b622d 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -226,7 +226,7 @@ map_symbol_to_lowlevel_and_arity! { /// Some builtins cannot be constructed in code gen alone, and need to be defined /// as separate Roc defs. For example, List.get has this type: /// -/// List.get : List elem, Nat -> Result elem [OutOfBounds]* +/// List.get : List elem, U64 -> Result elem [OutOfBounds]* /// /// Because this returns an open tag union for its Err type, it's not possible /// for code gen to return a hardcoded value for OutOfBounds. For example, From 47561266d417f2f7188278a1b1470f8650309e87 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 22:43:12 -0500 Subject: [PATCH 18/80] Update False interpreter to not use Nat --- examples/cli/false-interpreter/Context.roc | 4 ++-- examples/cli/false-interpreter/Variable.roc | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cli/false-interpreter/Context.roc b/examples/cli/false-interpreter/Context.roc index 86cf21ca5eb..6f9bdcd782a 100644 --- a/examples/cli/false-interpreter/Context.roc +++ b/examples/cli/false-interpreter/Context.roc @@ -8,8 +8,8 @@ Option a : [Some a, None] Data : [Lambda (List U8), Number I32, Var Variable] # While loops are special and have their own Scope specific state. WhileState : { cond : List U8, body : List U8, state : [InCond, InBody] } -Scope : { data : Option File.Handle, index : Nat, buf : List U8, whileInfo : Option WhileState } -State : [Executing, InComment, InLambda Nat (List U8), InString (List U8), InNumber I32, InSpecialChar, LoadChar] +Scope : { data : Option File.Handle, index : U64, buf : List U8, whileInfo : Option WhileState } +State : [Executing, InComment, InLambda U64 (List U8), InString (List U8), InNumber I32, InSpecialChar, LoadChar] Context : { scopes : List Scope, stack : List Data, vars : List Data, state : State } pushStack : Context, Data -> Context diff --git a/examples/cli/false-interpreter/Variable.roc b/examples/cli/false-interpreter/Variable.roc index e7b959d2f14..dbf9bc78806 100644 --- a/examples/cli/false-interpreter/Variable.roc +++ b/examples/cli/false-interpreter/Variable.roc @@ -6,7 +6,7 @@ interface Variable # This opaque type deals with ensure we always have valid variables. Variable := U8 -totalCount : Nat +totalCount : U64 totalCount = 0x7A # "z" - 0x61 # "a" @@ -30,7 +30,7 @@ fromUtf8 = \char -> else Err InvalidVariableUtf8 -toIndex : Variable -> Nat +toIndex : Variable -> U64 toIndex = \@Variable char -> Num.intCast (char - 0x61) # "a" # List.first (Str.toUtf8 "a") From 6f354b9678972597991ca8678c4c7db117bbbc92 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 21 Jan 2024 22:55:33 -0500 Subject: [PATCH 19/80] Update more examples to stop using Nat --- examples/virtual-dom-wip/platform/Effect.roc | 4 ++-- examples/virtual-dom-wip/platform/Html/Internal/Client.roc | 6 +++--- examples/virtual-dom-wip/platform/Html/Internal/Shared.roc | 6 +++--- examples/virtual-dom-wip/platform/client-side.roc | 2 +- examples/virtual-dom-wip/platform/src/client-side/host.zig | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/virtual-dom-wip/platform/Effect.roc b/examples/virtual-dom-wip/platform/Effect.roc index 99e0fc5c5ec..d90037bc047 100644 --- a/examples/virtual-dom-wip/platform/Effect.roc +++ b/examples/virtual-dom-wip/platform/Effect.roc @@ -29,8 +29,8 @@ hosted Effect generates Effect with [after, always, map] # TODO: private types -NodeId : Nat -HandlerId : Nat +NodeId : U64 +HandlerId : U64 # TODO: make these tag unions to avoid encoding/decoding standard names # but for now, this is much easier to code and debug! diff --git a/examples/virtual-dom-wip/platform/Html/Internal/Client.roc b/examples/virtual-dom-wip/platform/Html/Internal/Client.roc index bbe23151065..cc625b938c9 100644 --- a/examples/virtual-dom-wip/platform/Html/Internal/Client.roc +++ b/examples/virtual-dom-wip/platform/Html/Internal/Client.roc @@ -131,7 +131,7 @@ initClientAppHelp = \json, app -> # In Roc, we maintain a matching List of virtual DOM nodes with the same indices. # They are both initialised separately, but use the same indexing algorithm. # (We *could* pass this data in as JSON from the HTML file, but it would roughly double the size of that HTML file!) -indexNodes : { nodes : List RenderedNode, siblingIds : List Nat }, Html state -> { nodes : List RenderedNode, siblingIds : List Nat } +indexNodes : { nodes : List RenderedNode, siblingIds : List U64 }, Html state -> { nodes : List RenderedNode, siblingIds : List U64 } indexNodes = \{ nodes, siblingIds }, unrendered -> when unrendered is Text content -> @@ -667,11 +667,11 @@ expect html = Element "a" 43 [HtmlAttr "href" "https://www.roc-lang.org/"] [Text "Roc"] - actual : { nodes : List RenderedNode, siblingIds : List Nat } + actual : { nodes : List RenderedNode, siblingIds : List U64 } actual = indexNodes { nodes: [], siblingIds: [] } html - expected : { nodes : List RenderedNode, siblingIds : List Nat } + expected : { nodes : List RenderedNode, siblingIds : List U64 } expected = { nodes: [ RenderedText "Roc", diff --git a/examples/virtual-dom-wip/platform/Html/Internal/Shared.roc b/examples/virtual-dom-wip/platform/Html/Internal/Shared.roc index 92188fe5cb4..68ebe2e7200 100644 --- a/examples/virtual-dom-wip/platform/Html/Internal/Shared.roc +++ b/examples/virtual-dom-wip/platform/Html/Internal/Shared.roc @@ -32,7 +32,7 @@ Html state : [ ] # The pre-calculated byte size of the rendered HTML string -Size : Nat +Size : U64 Attribute state : [ EventListener Str (List CyclicStructureAccessor) (Handler state), @@ -74,14 +74,14 @@ text = \content -> Text content none : Html state none = None -nodeSize : Html state -> Nat +nodeSize : Html state -> U64 nodeSize = \node -> when node is Text content -> Str.countUtf8Bytes content Element _ size _ _ -> size None -> 0 -attrSize : Attribute state -> Nat +attrSize : Attribute state -> U64 attrSize = \attr -> when attr is EventListener _ _ _ -> 0 diff --git a/examples/virtual-dom-wip/platform/client-side.roc b/examples/virtual-dom-wip/platform/client-side.roc index bfa0c19fb8a..e24c5896435 100644 --- a/examples/virtual-dom-wip/platform/client-side.roc +++ b/examples/virtual-dom-wip/platform/client-side.roc @@ -11,7 +11,7 @@ platform "client-side" # Fields sorted by alignment, then alphabetically FromHost state initData : { - eventHandlerId : Nat, + eventHandlerId : U64, eventJsonList : List (List U8), eventPlatformState : Box (PlatformState state initData), initJson : List U8, diff --git a/examples/virtual-dom-wip/platform/src/client-side/host.zig b/examples/virtual-dom-wip/platform/src/client-side/host.zig index 029504e4fa4..85dcca3fde2 100644 --- a/examples/virtual-dom-wip/platform/src/client-side/host.zig +++ b/examples/virtual-dom-wip/platform/src/client-side/host.zig @@ -54,7 +54,7 @@ const RocList = extern struct { }; const FromHost = extern struct { - eventHandlerId: usize, + eventHandlerId: u64, eventJsonList: ?RocList, eventPlatformState: ?*anyopaque, initJson: RocList, @@ -79,7 +79,7 @@ export fn roc_vdom_init(init_pointer: ?[*]u8, init_length: usize, init_capacity: .capacity = init_capacity, }; const from_host = FromHost{ - .eventHandlerId = std.math.maxInt(usize), + .eventHandlerId = std.math.maxInt(u64), .eventJsonList = null, .eventPlatformState = null, .initJson = init_json, @@ -90,7 +90,7 @@ export fn roc_vdom_init(init_pointer: ?[*]u8, init_length: usize, init_capacity: } // Called from JS -export fn roc_dispatch_event(list_ptr: ?[*]u8, list_length: usize, handler_id: usize) usize { +export fn roc_dispatch_event(list_ptr: ?[*]u8, list_length: usize, handler_id: u64) usize { const json_list = RocList{ .bytes = list_ptr, .length = list_length, From d909cc5961066702886082c6b9d5d74e168d3214 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:45:47 -0500 Subject: [PATCH 20/80] Update glue to no longer use Nat --- crates/glue/platform/InternalTypeId.roc | 12 ++++++------ crates/glue/platform/Types.roc | 14 +++++++------- crates/glue/src/RustGlue.roc | 6 +++--- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/crates/glue/platform/InternalTypeId.roc b/crates/glue/platform/InternalTypeId.roc index ebdce6d1739..bae9254837b 100644 --- a/crates/glue/platform/InternalTypeId.roc +++ b/crates/glue/platform/InternalTypeId.roc @@ -1,11 +1,11 @@ interface InternalTypeId - exposes [InternalTypeId, fromNat, toNat] + exposes [InternalTypeId, fromU64, toU64] imports [] -InternalTypeId : Nat +InternalTypeId : U64 -toNat : InternalTypeId -> Nat -toNat = \x -> x +toU64 := InternalTypeId -> U64 +toU64 = \@InternalTypeId x -> x -fromNat : Nat -> InternalTypeId -fromNat = \x -> x +fromU64 : U64 -> InternalTypeId +fromU64 = \x -> @InternalTypeId x diff --git a/crates/glue/platform/Types.roc b/crates/glue/platform/Types.roc index eca34dc9fcd..f62c7814fb2 100644 --- a/crates/glue/platform/Types.roc +++ b/crates/glue/platform/Types.roc @@ -34,33 +34,33 @@ entryPoints = \@Types { entrypoints } -> entrypoints walkShapes : Types, state, (state, Shape, TypeId -> state) -> state walkShapes = \@Types { types: shapes }, originalState, update -> List.walkWithIndex shapes originalState \state, elem, index -> - id = InternalTypeId.fromNat index + id = InternalTypeId.fromU64 index update state elem id shape : Types, TypeId -> Shape shape = \@Types types, id -> - when List.get types.types (InternalTypeId.toNat id) is + when List.get types.types (InternalTypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toNat id) + idStr = Num.toStr (InternalTypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " alignment : Types, TypeId -> U32 alignment = \@Types types, id -> - when List.get types.aligns (InternalTypeId.toNat id) is + when List.get types.aligns (InternalTypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toNat id) + idStr = Num.toStr (InternalTypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " size : Types, TypeId -> U32 size = \@Types types, id -> - when List.get types.sizes (InternalTypeId.toNat id) is + when List.get types.sizes (InternalTypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toNat id) + idStr = Num.toStr (InternalTypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " diff --git a/crates/glue/src/RustGlue.roc b/crates/glue/src/RustGlue.roc index 284315f918e..286ec345564 100644 --- a/crates/glue/src/RustGlue.roc +++ b/crates/glue/src/RustGlue.roc @@ -167,7 +167,7 @@ generateEntryPoint = \buf, types, name, id -> when Types.shape types rocFn.ret is Function _ -> ("(_: *mut u8, \(arguments))", ret, Bool.true) - _ -> + _ -> ("(_: *mut \(ret), \(arguments))", ret, Bool.false) _ -> @@ -1358,7 +1358,7 @@ generateUnionField = \types -> # use unit as the payload Str.concat accum "\(indent)\(escapedFieldName): (),\n" -commaSeparated : Str, List a, (a, Nat -> Str) -> Str +commaSeparated : Str, List a, (a, U64 -> Str) -> Str commaSeparated = \buf, items, step -> length = List.len items List.walk items { buf, count: 0 } \accum, item -> @@ -2142,7 +2142,7 @@ isUnit = \shape -> Unit -> Bool.true _ -> Bool.false -toArgStr : List TypeId, Types, (TypeId, Shape, Nat -> Str) -> Str +toArgStr : List TypeId, Types, (TypeId, Shape, U64 -> Str) -> Str toArgStr = \args, types, fmt -> List.walkWithIndex args "" \state, argId, index -> shape = Types.shape types argId From 70a1def63bff27e699ff801a5f2f67bba38d0586 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:46:09 -0500 Subject: [PATCH 21/80] Update some docs to not reference Nat --- crates/compiler/mono/src/ir.rs | 2 +- crates/compiler/mono/src/tail_recursion.rs | 4 ++-- crates/repl_eval/src/eval.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index 8bb2347710b..ba7afdba2ff 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -818,7 +818,7 @@ type NumberSpecializations<'a> = VecMap, (Symbol, UseDepth)>; /// n = 1 /// use1 : U8 /// use1 = 1 -/// use2 : Nat +/// use2 : Dec /// use2 = 2 /// /// We keep track of the specializations of `myTag` and create fresh symbols when there is more diff --git a/crates/compiler/mono/src/tail_recursion.rs b/crates/compiler/mono/src/tail_recursion.rs index ad827e366e8..4d51e3a2bd1 100644 --- a/crates/compiler/mono/src/tail_recursion.rs +++ b/crates/compiler/mono/src/tail_recursion.rs @@ -569,7 +569,7 @@ fn trmc_candidates_help( // ```roc // LinkedList a : [ Nil, Cons a (LinkedList a) ] // -// repeat : a, Nat -> LinkedList a +// repeat : a, U64 -> LinkedList a // repeat = \element, n -> // when n is // 0 -> Nil @@ -581,7 +581,7 @@ fn trmc_candidates_help( // But there is a trick: TRMC. Using TRMC and join points, we are able to convert this function into a loop, which uses only one stack frame for the whole process. // // ```pseudo-roc -// repeat : a, Nat -> LinkedList a +// repeat : a, U64 -> LinkedList a // repeat = \initialElement, initialN -> // joinpoint trmc = \element, n, hole, head -> // when n is diff --git a/crates/repl_eval/src/eval.rs b/crates/repl_eval/src/eval.rs index 2f987ba09de..353010e2fbf 100644 --- a/crates/repl_eval/src/eval.rs +++ b/crates/repl_eval/src/eval.rs @@ -134,7 +134,7 @@ fn get_newtype_tag_and_var( /// Unrolls types that are newtypes. These include /// - Singleton tags with one type argument (e.g. `Container Str`) -/// - Records with exactly one field (e.g. `{ number: Nat }`) +/// - Records with exactly one field (e.g. `{ number: Dec }`) /// /// This is important in synchronizing `Content`s with `Layout`s, since `Layout`s will /// always unwrap newtypes and use the content of the underlying type. From 7e51dfd52694b3a5cccf53386ed7e1255ad3dbaa Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:46:33 -0500 Subject: [PATCH 22/80] Update test fixtures to not use Nat indices --- .../build/app_with_deps/Quicksort.roc | 8 ++--- .../build/app_with_deps/QuicksortMultiDef.roc | 8 ++--- .../build/interface_with_deps/Quicksort.roc | 8 ++--- .../compiler/load_internal/tests/test_load.rs | 24 ++++++------- crates/compiler/solve/tests/solve_expr.rs | 34 +++++++++---------- crates/compiler/test_gen/benches/list_map.rs | 4 +-- crates/compiler/test_gen/benches/quicksort.rs | 6 ++-- crates/compiler/test_gen/src/gen_list.rs | 32 ++++++++--------- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/Quicksort.roc b/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/Quicksort.roc index 459dd59a0a1..8e57a8b6d26 100644 --- a/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/Quicksort.roc +++ b/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/Quicksort.roc @@ -1,6 +1,6 @@ app "quicksort" provides [swap, partition, partitionHelp, quicksort] to "./platform" -quicksort : List (Num a), Nat, Nat -> List (Num a) +quicksort : List (Num a), U64, U64 -> List (Num a) quicksort = \list, low, high -> when partition low high list is Pair partitionIndex partitioned -> @@ -9,7 +9,7 @@ quicksort = \list, low, high -> |> quicksort (partitionIndex + 1) high -swap : Nat, Nat, List a -> List a +swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -21,7 +21,7 @@ swap = \i, j, list -> [] -partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] +partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -33,7 +33,7 @@ partition = \low, high, initialList -> Pair (low - 1) initialList -partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))] +partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is diff --git a/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/QuicksortMultiDef.roc b/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/QuicksortMultiDef.roc index 8a4d8ea78f8..a5de036e0b8 100644 --- a/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/QuicksortMultiDef.roc +++ b/crates/compiler/load_internal/tests/fixtures/build/app_with_deps/QuicksortMultiDef.roc @@ -1,6 +1,6 @@ app "quicksort" provides [quicksort] to "./platform" -quicksortHelp : List (Num a), Nat, Nat -> List (Num a) +quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -12,7 +12,7 @@ quicksortHelp = \list, low, high -> list -swap : Nat, Nat, List a -> List a +swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -23,7 +23,7 @@ swap = \i, j, list -> _ -> [] -partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] +partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -35,7 +35,7 @@ partition = \low, high, initialList -> Pair (low - 1) initialList -partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))] +partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is diff --git a/crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/Quicksort.roc b/crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/Quicksort.roc index d470758bbe9..344bc0151c8 100644 --- a/crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/Quicksort.roc +++ b/crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/Quicksort.roc @@ -2,7 +2,7 @@ interface Quicksort exposes [swap, partition, quicksort] imports [] -quicksort : List (Num a), Nat, Nat -> List (Num a) +quicksort : List (Num a), U64, U64 -> List (Num a) quicksort = \list, low, high -> when partition low high list is Pair partitionIndex partitioned -> @@ -11,7 +11,7 @@ quicksort = \list, low, high -> |> quicksort (partitionIndex + 1) high -swap : Nat, Nat, List a -> List a +swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -23,7 +23,7 @@ swap = \i, j, list -> [] -partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] +partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -35,7 +35,7 @@ partition = \low, high, initialList -> Pair (low - 1) initialList -partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))] +partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is diff --git a/crates/compiler/load_internal/tests/test_load.rs b/crates/compiler/load_internal/tests/test_load.rs index abdfb530487..9e3fded36b8 100644 --- a/crates/compiler/load_internal/tests/test_load.rs +++ b/crates/compiler/load_internal/tests/test_load.rs @@ -465,10 +465,10 @@ fn iface_quicksort() { expect_types( loaded_module, hashmap! { - "swap" => "Nat, Nat, List a -> List a", - "partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]", - "partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]", - "quicksort" => "List (Num a), Nat, Nat -> List (Num a)", + "swap" => "U64, U64, List a -> List a", + "partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]", + "partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]", + "quicksort" => "List (Num a), U64, U64 -> List (Num a)", }, ); } @@ -481,10 +481,10 @@ fn quicksort_one_def() { expect_types( loaded_module, hashmap! { - "swap" => "Nat, Nat, List a -> List a", - "partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]", - "partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]", - "quicksortHelp" => "List (Num a), Nat, Nat -> List (Num a)", + "swap" => "U64, U64, List a -> List a", + "partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]", + "partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]", + "quicksortHelp" => "List (Num a), U64, U64 -> List (Num a)", "quicksort" => "List (Num a) -> List (Num a)", }, ); @@ -498,10 +498,10 @@ fn app_quicksort() { expect_types( loaded_module, hashmap! { - "swap" => "Nat, Nat, List a -> List a", - "partition" => "Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))]", - "partitionHelp" => "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]", - "quicksort" => "List (Num a), Nat, Nat -> List (Num a)", + "swap" => "U64, U64, List a -> List a", + "partition" => "U64, U64, List (Num a) -> [Pair U64 (List (Num a))]", + "partitionHelp" => "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]", + "quicksort" => "List (Num a), U64, U64 -> List (Num a)", }, ); } diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs index 73259c4d400..b4d23dc435c 100644 --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -165,7 +165,7 @@ mod solve_expr { Str.fromUtf8 " ), - "List U8 -> Result Str [BadUtf8 Utf8ByteProblem Nat]", + "List U8 -> Result Str [BadUtf8 Utf8ByteProblem U64]", ); } @@ -3016,7 +3016,7 @@ mod solve_expr { infer_eq_without_problem( indoc!( r" - partition : Nat, Nat, List (Int a) -> [Pair Nat (List (Int a))] + partition : U64, U64, List (Int a) -> [Pair U64 (List (Int a))] partition = \low, high, initialList -> when List.get initialList high is Ok _ -> @@ -3028,7 +3028,7 @@ mod solve_expr { partition " ), - "Nat, Nat, List (Int a) -> [Pair Nat (List (Int a))]", + "U64, U64, List (Int a) -> [Pair U64 (List (Int a))]", ); } @@ -3037,7 +3037,7 @@ mod solve_expr { infer_eq_without_problem( indoc!( r" - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -3048,7 +3048,7 @@ mod solve_expr { _ -> list - partition : Nat, Nat, List (Int a) -> [Pair Nat (List (Int a))] + partition : U64, U64, List (Int a) -> [Pair U64 (List (Int a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -3076,7 +3076,7 @@ mod solve_expr { partition " ), - "Nat, Nat, List (Int a) -> [Pair Nat (List (Int a))]", + "U64, U64, List (Int a) -> [Pair U64 (List (Int a))]", ); } @@ -3116,7 +3116,7 @@ mod solve_expr { List.get " ), - "List a, Nat -> Result a [OutOfBounds]", + "List a, U64 -> Result a [OutOfBounds]", ); } @@ -3772,7 +3772,7 @@ mod solve_expr { fn list_walk_with_index_until() { infer_eq_without_problem( indoc!(r"List.walkWithIndexUntil"), - "List elem, state, (state, elem, Nat -> [Break state, Continue state]) -> state", + "List elem, state, (state, elem, U64 -> [Break state, Continue state]) -> state", ); } @@ -3784,7 +3784,7 @@ mod solve_expr { List.dropAt " ), - "List elem, Nat -> List elem", + "List elem, U64 -> List elem", ); } @@ -3820,7 +3820,7 @@ mod solve_expr { List.takeFirst " ), - "List elem, Nat -> List elem", + "List elem, U64 -> List elem", ); } @@ -3832,7 +3832,7 @@ mod solve_expr { List.takeLast " ), - "List elem, Nat -> List elem", + "List elem, U64 -> List elem", ); } @@ -3844,7 +3844,7 @@ mod solve_expr { List.sublist " ), - "List elem, { len : Nat, start : Nat } -> List elem", + "List elem, { len : U64, start : U64 } -> List elem", ); } @@ -3852,7 +3852,7 @@ mod solve_expr { fn list_split() { infer_eq_without_problem( indoc!("List.split"), - "List elem, Nat -> { before : List elem, others : List elem }", + "List elem, U64 -> { before : List elem, others : List elem }", ); } @@ -3864,7 +3864,7 @@ mod solve_expr { List.dropLast " ), - "List elem, Nat -> List elem", + "List elem, U64 -> List elem", ); } @@ -4400,7 +4400,7 @@ mod solve_expr { r#" app "test" provides [partitionHelp] to "./platform" - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -4411,7 +4411,7 @@ mod solve_expr { _ -> [] - partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))] + partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is @@ -4427,7 +4427,7 @@ mod solve_expr { Pair i list "# ), - "Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))]", + "U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))]", ); } diff --git a/crates/compiler/test_gen/benches/list_map.rs b/crates/compiler/test_gen/benches/list_map.rs index dadd2b97408..60653aa2636 100644 --- a/crates/compiler/test_gen/benches/list_map.rs +++ b/crates/compiler/test_gen/benches/list_map.rs @@ -30,7 +30,7 @@ const ROC_LIST_MAP: &str = indoc::indoc!( r#" app "bench" provides [main] to "./platform" - main : List I64 -> Nat + main : List I64 -> U64 main = \list -> list |> List.map (\x -> x + 2) @@ -42,7 +42,7 @@ const ROC_LIST_MAP_WITH_INDEX: &str = indoc::indoc!( r#" app "bench" provides [main] to "./platform" - main : List I64 -> Nat + main : List I64 -> U64 main = \list -> list |> List.mapWithIndex (\x, _ -> x + 2) diff --git a/crates/compiler/test_gen/benches/quicksort.rs b/crates/compiler/test_gen/benches/quicksort.rs index 96b94ff00f7..7299ae80938 100644 --- a/crates/compiler/test_gen/benches/quicksort.rs +++ b/crates/compiler/test_gen/benches/quicksort.rs @@ -40,7 +40,7 @@ const PURE_ROC_QUICKSORT: &str = indoc::indoc!( quicksortHelp originalList 0 (n - 1) - quicksortHelp : List (Num a), Nat, Nat -> List (Num a) + quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -51,7 +51,7 @@ const PURE_ROC_QUICKSORT: &str = indoc::indoc!( else list - partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] + partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -62,7 +62,7 @@ const PURE_ROC_QUICKSORT: &str = indoc::indoc!( Err _ -> Pair low initialList - partitionHelp : Nat, Nat, List (Num c), Nat, Num c -> [Pair Nat (List (Num c))] + partitionHelp : U64, U64, List (Num c), U64, Num c -> [Pair U64 (List (Num c))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is diff --git a/crates/compiler/test_gen/src/gen_list.rs b/crates/compiler/test_gen/src/gen_list.rs index 9ced967ecc9..769a76026cf 100644 --- a/crates/compiler/test_gen/src/gen_list.rs +++ b/crates/compiler/test_gen/src/gen_list.rs @@ -1014,7 +1014,7 @@ fn list_walk_implements_position() { r" Option a : [Some a, None] - find : List a, a -> Option Nat where a implements Eq + find : List a, a -> Option U64 where a implements Eq find = \list, needle -> findHelp list needle |> .v @@ -2412,7 +2412,7 @@ fn gen_swap() { app "quicksort" provides [main] to "./platform" - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -2447,7 +2447,7 @@ fn gen_quicksort() { quicksortHelp list 0 (n - 1) - quicksortHelp : List (Num a), Nat, Nat -> List (Num a) + quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -2459,7 +2459,7 @@ fn gen_quicksort() { list - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -2470,7 +2470,7 @@ fn gen_quicksort() { _ -> [] - partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] + partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -2482,7 +2482,7 @@ fn gen_quicksort() { Pair low initialList - partitionHelp : Nat, Nat, List (Num a), Nat, (Num a) -> [Pair Nat (List (Num a))] + partitionHelp : U64, U64, List (Num a), U64, (Num a) -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is @@ -2520,7 +2520,7 @@ fn quicksort() { quicksortHelp list 0 (List.len list - 1) - quicksortHelp : List (Num a), Nat, Nat -> List (Num a) + quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -2532,7 +2532,7 @@ fn quicksort() { list - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -2543,7 +2543,7 @@ fn quicksort() { _ -> [] - partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] + partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -2555,7 +2555,7 @@ fn quicksort() { Pair low initialList - partitionHelp : Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))] + partitionHelp : U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> # if j < high then if Bool.false then @@ -2596,7 +2596,7 @@ fn quicksort_singleton() { quicksortHelp list 0 (List.len list - 1) - quicksortHelp : List (Num a), Nat, Nat -> List (Num a) + quicksortHelp : List (Num a), U64, U64 -> List (Num a) quicksortHelp = \list, low, high -> if low < high then when partition low high list is @@ -2608,7 +2608,7 @@ fn quicksort_singleton() { list - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -2619,7 +2619,7 @@ fn quicksort_singleton() { _ -> [] - partition : Nat, Nat, List (Num a) -> [Pair Nat (List (Num a))] + partition : U64, U64, List (Num a) -> [Pair U64 (List (Num a))] partition = \low, high, initialList -> when List.get initialList high is Ok pivot -> @@ -2631,7 +2631,7 @@ fn quicksort_singleton() { Pair low initialList - partitionHelp : Nat, Nat, List (Num a), Nat, Num a -> [Pair Nat (List (Num a))] + partitionHelp : U64, U64, List (Num a), U64, Num a -> [Pair U64 (List (Num a))] partitionHelp = \i, j, list, high, pivot -> if j < high then when List.get list j is @@ -3512,7 +3512,7 @@ fn monomorphized_lists() { r" l = \{} -> [1, 2, 3] - f : List U8, List U16 -> Nat + f : List U8, List U16 -> U64 f = \_, _ -> 18 f (l {}) (l {}) @@ -3753,7 +3753,7 @@ fn list_walk_backwards_implements_position() { r" Option a : [Some a, None] - find : List a, a -> Option Nat where a implements Eq + find : List a, a -> Option U64 where a implements Eq find = \list, needle -> findHelp list needle |> .v From 17ba3eddb49677c790d592abab124f6ef92ec2b0 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:46:49 -0500 Subject: [PATCH 23/80] Remove Nat from examples --- examples/GuiFormatter.roc | 6 ------ 1 file changed, 6 deletions(-) diff --git a/examples/GuiFormatter.roc b/examples/GuiFormatter.roc index 1a060911a15..57867e4a0e3 100644 --- a/examples/GuiFormatter.roc +++ b/examples/GuiFormatter.roc @@ -37,7 +37,6 @@ GuiFormatter := { nodes : List Elem } i64: i64, u128: u128, i128: i128, - nat: nat, f32: f32, f64: f64, dec: dec, @@ -211,11 +210,6 @@ i128 = \num -> f0 <- Inspect.custom addNode f0 (num |> Num.toStr |> Text) -nat : Nat -> Inspector GuiFormatter -nat = \num -> - f0 <- Inspect.custom - addNode f0 (num |> Num.toStr |> Text) - f32 : F32 -> Inspector GuiFormatter f32 = \num -> f0 <- Inspect.custom From 4a38d3a1afa62c597fd0714a1b0ed37d650e3c4d Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:47:10 -0500 Subject: [PATCH 24/80] Remove Nat from some compiler tests that use lists --- crates/compiler/test_gen/src/gen_primitives.rs | 4 ++-- crates/compiler/test_mono/src/tests.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index d7cf8891bc3..19507282732 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -963,7 +963,7 @@ fn overflow_frees_list() { n : I64 n = 9_223_372_036_854_775_807 + (Num.intCast (List.len myList)) - index : Nat + index : U64 index = Num.intCast n List.get myList index @@ -4590,7 +4590,7 @@ fn linked_list_trmc() { LinkedList a : [Nil, Cons a (LinkedList a)] - repeat : a, Nat -> LinkedList a + repeat : a, U64 -> LinkedList a repeat = \value, n -> when n is 0 -> Nil diff --git a/crates/compiler/test_mono/src/tests.rs b/crates/compiler/test_mono/src/tests.rs index 44db63d142c..ff6478670de 100644 --- a/crates/compiler/test_mono/src/tests.rs +++ b/crates/compiler/test_mono/src/tests.rs @@ -244,7 +244,7 @@ fn verify_procedures<'a>( git add -u git commit -S -m "update mono tests" git push origin YOUR_BRANCH_NAME - + "# )); } @@ -975,7 +975,7 @@ fn rigids() { r#" app "test" provides [main] to "./platform" - swap : Nat, Nat, List a -> List a + swap : U64, U64, List a -> List a swap = \i, j, list -> when Pair (List.get list i) (List.get list j) is Pair (Ok atI) (Ok atJ) -> @@ -2512,8 +2512,8 @@ fn issue_4772_weakened_monomorphic_destructure() { #[mono_test] fn weakening_avoids_overspecialization() { // Without weakening of let-bindings, this program would force two specializations of - // `index` - to `Nat` and the default integer type, `I64`. The test is to ensure only one - // specialization, that of `Nat`, exists. + // `index` - to `U64` and the default integer type, `I64`. The test is to ensure only one + // specialization, that of `U64`, exists. indoc!( r#" app "test" provides [main] to "./platform" From e207a7ce53f707f2eacfdd99bd5809e88df07754 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:47:27 -0500 Subject: [PATCH 25/80] Use Variable::U64 for List.len in file load --- crates/compiler/load_internal/src/file.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index 1c7c6dd6ed1..a33d581d1b0 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -4664,7 +4664,7 @@ fn synth_import(subs: &mut Subs, content: roc_types::subs::Content) -> Variable fn synth_list_len_type(subs: &mut Subs) -> Variable { use roc_types::subs::{Content, FlatType, LambdaSet, OptVariable, SubsSlice, UnionLabels}; - // List.len : List a -> Nat + // List.len : List a -> U64 let a = synth_import(subs, Content::FlexVar(None)); let a_slice = SubsSlice::extend_new(&mut subs.variables, [a]); let list_a = synth_import( @@ -4685,7 +4685,7 @@ fn synth_list_len_type(subs: &mut Subs) -> Variable { let fn_args_slice = SubsSlice::extend_new(&mut subs.variables, [list_a]); subs.set_content( fn_var, - Content::Structure(FlatType::Func(fn_args_slice, clos_list_len, Variable::NAT)), + Content::Structure(FlatType::Func(fn_args_slice, clos_list_len, Variable::U64)), ); fn_var } From 27474d4ed896754e67c212f2655f772de902246d Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:48:21 -0500 Subject: [PATCH 26/80] Update List.reserve to no longer use Nat --- crates/compiler/builtins/bitcode/src/list.zig | 16 +++++++++++----- crates/compiler/gen_llvm/src/llvm/build_list.rs | 2 +- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 2 +- crates/compiler/gen_wasm/src/low_level.rs | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index b508a0eae53..7ae6f4f6c4b 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -482,16 +482,22 @@ pub fn listWithCapacity( pub fn listReserve( list: RocList, alignment: u32, - spare: usize, + spare: u64, element_width: usize, update_mode: UpdateMode, ) callconv(.C) RocList { - const old_length = list.len(); - if ((update_mode == .InPlace or list.isUnique()) and list.getCapacity() >= list.len() + spare) { + const original_len = list.len(); + const cap = @as(u64, @intCast(list.getCapacity())); + const desired_cap = @as(u64, @intCast(original_len)) +| spare; + + if ((update_mode == .InPlace or list.isUnique()) and cap >= desired_cap) { return list; } else { - var output = list.reallocate(alignment, old_length + spare, element_width); - output.length = old_length; + // Make sure on 32-bit targets we don't accidentally wrap when we cast our U64 desired capacity to U32. + const reserve_size: u64 = @min(desired_cap, @as(u64, @intCast(std.math.maxInt(usize)))); + + var output = list.reallocate(alignment, @as(usize, @intCast(reserve_size)), element_width); + output.length = original_len; return output; } } diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index 1580a8673be..b6f5302759c 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -169,7 +169,7 @@ pub(crate) fn list_get_unsafe<'a, 'ctx>( ) } -/// List.reserve : List elem, Nat -> List elem +/// List.reserve : List elem, U64 -> List elem pub(crate) fn list_reserve<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index de841c816ac..d22f5a2fd03 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -688,7 +688,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( list_prepend(env, layout_interner, original_wrapper, elem, elem_layout) } ListReserve => { - // List.reserve : List elem, Nat -> List elem + // List.reserve : List elem, U64 -> List elem debug_assert_eq!(args.len(), 2); let (list, list_layout) = scope.load_symbol_and_layout(&args[0]); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 35fc39c730a..55f043376c0 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -514,7 +514,7 @@ impl<'a> LowLevelCall<'a> { // (return pointer) i32 // list: RocList i32 // alignment: u32 i32 - // spare: usize i32 + // spare: u64 i64 // element_width: usize i32 // update_mode: UpdateMode i32 From 2cf7b5b5ca6e52046452d26d55b2422aa7471bfa Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 22:17:34 -0500 Subject: [PATCH 27/80] Update List.swap to no longer use Nat --- crates/compiler/builtins/bitcode/src/list.zig | 14 +++++++++----- crates/compiler/gen_dev/src/lib.rs | 8 ++++---- crates/compiler/gen_llvm/src/llvm/build_list.rs | 2 +- crates/compiler/gen_wasm/src/low_level.rs | 6 +++--- 4 files changed, 17 insertions(+), 13 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index 7ae6f4f6c4b..21d5b88cc1f 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -583,13 +583,13 @@ pub fn listSwap( list: RocList, alignment: u32, element_width: usize, - index_1: usize, - index_2: usize, + index_1: u64, + index_2: u64, update_mode: UpdateMode, ) callconv(.C) RocList { - const size = list.len(); + const size = @as(u64, @intCast(list.len())); if (index_1 == index_2 or index_1 >= size or index_2 >= size) { - // Either index out of bounds so we just return + // Either one index was out of bounds, or both indices were the same; just return return list; } @@ -602,7 +602,11 @@ pub fn listSwap( }; const source_ptr = @as([*]u8, @ptrCast(newList.bytes)); - swapElements(source_ptr, element_width, index_1, index_2); + + swapElements(source_ptr, element_width, @as(usize, + // We already verified that both indices are less than the stored list length, + // which is usize, so casting them to usize will definitely be lossless. + @intCast(index_1)), @as(usize, @intCast(index_2))); return newList; } diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index a00ff99a7c6..36ea4087982 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1918,8 +1918,8 @@ trait Backend<'a> { // list: RocList, // alignment: u32, // element_width: usize, - // index_1: usize, - // index_2: usize, + // index_1: u64, + // index_2: u64, // update_mode: UpdateMode, self.build_fn_call( @@ -1937,8 +1937,8 @@ trait Backend<'a> { list_layout, Layout::U32, layout_usize, - layout_usize, - layout_usize, + Layout::U64, + Layout::U64, Layout::U8, ], ret_layout, diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index b6f5302759c..024ec58d75b 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -250,7 +250,7 @@ pub(crate) fn list_prepend<'a, 'ctx>( ) } -/// List.swap : List elem, Nat, Nat -> List elem +/// List.swap : List elem, U64,U64 -> List elem pub(crate) fn list_swap<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 55f043376c0..ff9c45feee2 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -743,7 +743,7 @@ impl<'a> LowLevelCall<'a> { backend.call_host_fn_after_loading_args(bitcode::LIST_DROP_AT); } ListSwap => { - // List.swap : List elem, Nat, Nat -> List elem + // List.swap : List elem, U64, U64 -> List elem let list: Symbol = self.arguments[0]; let index_1: Symbol = self.arguments[1]; let index_2: Symbol = self.arguments[2]; @@ -758,8 +758,8 @@ impl<'a> LowLevelCall<'a> { // list: RocList, i32 // alignment: u32, i32 // element_width: usize, i32 - // index_1: usize, i32 - // index_2: usize, i32 + // index_1: u64, i64 + // index_2: u64, i64 // update_mode: UpdateMode, i32 // Load the return pointer and the list From a71188dc304bc76655c7b9c6891dff5a11cdc71b Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:12:18 -0500 Subject: [PATCH 28/80] Update List.sublist to no longer use Nat --- crates/compiler/builtins/bitcode/src/list.zig | 27 +++++++++++++++---- crates/compiler/gen_dev/src/lib.rs | 8 +++--- .../compiler/gen_llvm/src/llvm/build_list.rs | 2 +- crates/compiler/gen_wasm/src/low_level.rs | 4 +-- 4 files changed, 29 insertions(+), 12 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index 21d5b88cc1f..75b765d1905 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -615,12 +615,12 @@ pub fn listSublist( list: RocList, alignment: u32, element_width: usize, - start: usize, - len: usize, + start_u64: u64, + len_u64: u64, dec: Dec, ) callconv(.C) RocList { const size = list.len(); - if (len == 0 or start >= size) { + if (size == 0 or start_u64 >= @as(u64, @intCast(size))) { // Decrement the reference counts of all elements. if (list.bytes) |source_ptr| { var i: usize = 0; @@ -639,9 +639,26 @@ pub fn listSublist( } if (list.bytes) |source_ptr| { - const keep_len = @min(len, size - start); + // This cast is lossless because we would have early-returned already + // if `start_u64` were greater than `size`, and `size` fits in usize. + const start = @as(usize, @intCast(start_u64)); const drop_start_len = start; - const drop_end_len = size - (start + keep_len); + + // (size - start) can't overflow because we would have early-returned already + // if `start` were greater than `size`. + const size_minus_start = size - start; + + // This outer cast to usize is lossless. size, start, and size_minus_start all fit in usize, + // and @min guarantees that if `len_u64` gets returned, it's because it was smaller + // than something that fit in usize. + const keep_len = @as(usize, @intCast(@min(len_u64, @as(u64, @intCast(size_minus_start))))); + + // This can't overflow because if len > size_minus_start, + // then keep_len == size_minus_start and this will be 0. + // Alternatively, if len <= size_minus_start, then keep_len will + // be equal to len, meaning keep_len <= size_minus_start too, + // which in turn means this won't overflow. + const drop_end_len = size_minus_start - keep_len; // Decrement the reference counts of elements before `start`. var i: usize = 0; diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index 36ea4087982..bf14718ebde 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1867,8 +1867,8 @@ trait Backend<'a> { // list: RocList, // alignment: u32, // element_width: usize, - // start: usize, - // len: usize, + // start: u64, + // len: u64, // dec: Dec, let list = args[0]; @@ -1894,8 +1894,8 @@ trait Backend<'a> { arg_layouts[0], Layout::U32, layout_usize, - arg_layouts[1], - arg_layouts[2], + Layout::U64, + Layout::U64, layout_usize, ]; diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index 024ec58d75b..69d9bc5137f 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -274,7 +274,7 @@ pub(crate) fn list_swap<'a, 'ctx>( ) } -/// List.sublist : List elem, { start : Nat, len : Nat } -> List elem +/// List.sublist : List elem, { start : U64, len : U64 } -> List elem pub(crate) fn list_sublist<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index ff9c45feee2..cdf003f4234 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -676,8 +676,8 @@ impl<'a> LowLevelCall<'a> { // list: RocList, i32 // alignment: u32, i32 // element_width: usize, i32 - // start: usize, i32 - // len: usize, i32 + // start: u64, i64 + // len: u64, i64 // dec: Dec, i32 backend.storage.load_symbols_for_call( From 4a870c8ee09bc72c90d514f62d1f84f10279db49 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:18:55 -0500 Subject: [PATCH 29/80] Update Nat to U64 in some comments --- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 24 +++++++++---------- crates/compiler/gen_wasm/src/low_level.rs | 10 ++++---- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index d22f5a2fd03..7c0b46516a2 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -468,7 +468,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } StrRepeat => { - // Str.repeat : Str, Nat -> Str + // Str.repeat : Str, U64 -> Str arguments!(string, count); call_str_bitcode_fn( @@ -522,7 +522,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( BasicValueEnum::IntValue(is_zero) } StrCountUtf8Bytes => { - // Str.countUtf8Bytes : Str -> Nat + // Str.countUtf8Bytes : Str -> U64 arguments!(string); call_str_bitcode_fn( @@ -534,13 +534,13 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } StrGetCapacity => { - // Str.capacity : Str -> Nat + // Str.capacity : Str -> U64 arguments!(string); call_bitcode_fn(env, &[string], bitcode::STR_CAPACITY) } StrSubstringUnsafe => { - // Str.substringUnsafe : Str, Nat, Nat -> Str + // Str.substringUnsafe : Str, U64, U64 -> Str arguments!(string, start, length); call_str_bitcode_fn( @@ -552,7 +552,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } StrReserve => { - // Str.reserve : Str, Nat -> Str + // Str.reserve : Str, U64 -> Str arguments!(string, capacity); call_str_bitcode_fn( @@ -606,7 +606,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } StrWithCapacity => { - // Str.withCapacity : Nat -> Str + // Str.withCapacity : U64 -> Str arguments!(str_len); call_str_bitcode_fn( @@ -629,7 +629,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( .into() } ListGetCapacity => { - // List.capacity: List a -> Nat + // List.capacity: List a -> U64 arguments!(list); call_list_bitcode_fn( @@ -641,7 +641,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } ListWithCapacity => { - // List.withCapacity : Nat -> List a + // List.withCapacity : U64 -> List a arguments!(list_len); let result_layout = layout; @@ -714,7 +714,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( list_release_excess_capacity(env, layout_interner, list, element_layout, update_mode) } ListSwap => { - // List.swap : List elem, Nat, Nat -> List elem + // List.swap : List elem, U64, U64 -> List elem debug_assert_eq!(args.len(), 3); let (list, list_layout) = scope.load_symbol_and_layout(&args[0]); @@ -755,7 +755,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } ListDropAt => { - // List.dropAt : List elem, Nat -> List elem + // List.dropAt : List elem, U64 -> List elem debug_assert_eq!(args.len(), 2); let (list, list_layout) = scope.load_symbol_and_layout(&args[0]); @@ -774,7 +774,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } StrGetUnsafe => { - // Str.getUnsafe : Str, Nat -> u8 + // Str.getUnsafe : Str, U64 -> u8 arguments!(wrapper_struct, elem_index); call_str_bitcode_fn( @@ -786,7 +786,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( ) } ListGetUnsafe => { - // List.getUnsafe : List elem, Nat -> elem + // List.getUnsafe : List elem, U64 -> elem arguments_with_layouts!((wrapper_struct, list_layout), (element_index, _l)); list_get_unsafe( diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index cdf003f4234..200af3dbd98 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -361,7 +361,7 @@ impl<'a> LowLevelCall<'a> { } } ListReplaceUnsafe => { - // List.replace_unsafe : List elem, Nat, elem -> { list: List elem, value: elem } + // List.replace_unsafe : List elem, U64, elem -> { list: List elem, value: elem } let list: Symbol = self.arguments[0]; let index: Symbol = self.arguments[1]; @@ -449,7 +449,7 @@ impl<'a> LowLevelCall<'a> { backend.call_host_fn_after_loading_args(bitcode::LIST_REPLACE); } ListWithCapacity => { - // List.withCapacity : Nat -> List elem + // List.withCapacity : U64 -> List elem let capacity: Symbol = self.arguments[0]; let elem_layout = unwrap_list_elem_layout(self.ret_layout_raw); @@ -500,7 +500,7 @@ impl<'a> LowLevelCall<'a> { } ListReserve => { - // List.reserve : List elem, Nat -> List elem + // List.reserve : List elem, U64 -> List elem let list: Symbol = self.arguments[0]; let spare: Symbol = self.arguments[1]; @@ -649,7 +649,7 @@ impl<'a> LowLevelCall<'a> { } ListSublist => { // As a low-level, record is destructured - // List.sublist : List elem, start : Nat, len : Nat -> List elem + // List.sublist : List elem, start : U64, len : U64 -> List elem let list: Symbol = self.arguments[0]; let start: Symbol = self.arguments[1]; @@ -697,7 +697,7 @@ impl<'a> LowLevelCall<'a> { backend.call_host_fn_after_loading_args(bitcode::LIST_SUBLIST); } ListDropAt => { - // List.dropAt : List elem, Nat -> List elem + // List.dropAt : List elem, U64 -> List elem let list: Symbol = self.arguments[0]; let drop_index: Symbol = self.arguments[1]; From a8918a4e3b5676a0ea4b6a92db4b78797483aced Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:37:27 -0500 Subject: [PATCH 30/80] Update List.dropAt to no longer use Nat --- crates/compiler/builtins/bitcode/src/list.zig | 21 ++++++++++++------- crates/compiler/gen_dev/src/lib.rs | 4 ++-- .../compiler/gen_llvm/src/llvm/build_list.rs | 2 +- crates/compiler/gen_wasm/src/low_level.rs | 2 +- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index 75b765d1905..18bd64037f9 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -698,28 +698,33 @@ pub fn listDropAt( list: RocList, alignment: u32, element_width: usize, - drop_index: usize, + drop_index_u64: u64, dec: Dec, ) callconv(.C) RocList { const size = list.len(); + const size_u64 = @as(u64, @intCast(size)); // If droping the first or last element, return a seamless slice. // For simplicity, do this by calling listSublist. // In the future, we can test if it is faster to manually inline the important parts here. - if (drop_index == 0) { + if (drop_index_u64 == 0) { return listSublist(list, alignment, element_width, 1, size -| 1, dec); - } else if (drop_index == size -| 1) { + } else if (drop_index_u64 == size_u64 - 1) { // It's fine if (size - 1) wraps on size == 0 here, + // because if size is 0 then it's always fine for this branch to be taken; no + // matter what drop_index was, we're size == 0, so empty list will always be returned. return listSublist(list, alignment, element_width, 0, size -| 1, dec); } if (list.bytes) |source_ptr| { - if (drop_index >= size) { + if (drop_index_u64 >= size_u64) { return list; } - if (drop_index < size) { - const element = source_ptr + drop_index * element_width; - dec(element); - } + // This cast must be lossless, because we would have just early-returned if drop_index + // were >= than `size`, and we know `size` fits in usize. + const drop_index = @as(usize, @intCast(drop_index_u64)); + + const element = source_ptr + drop_index * element_width; + dec(element); // NOTE // we need to return an empty list explicitly, diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index bf14718ebde..e6aad344a41 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1991,7 +1991,7 @@ trait Backend<'a> { // list: RocList, // alignment: u32, // element_width: usize, - // drop_index: usize, + // drop_index: u64, // dec: Dec, self.build_fn_call( @@ -2008,7 +2008,7 @@ trait Backend<'a> { list_layout, Layout::U32, layout_usize, - layout_usize, + Layout::U64, layout_usize, ], ret_layout, diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index 69d9bc5137f..ab850df9b19 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -299,7 +299,7 @@ pub(crate) fn list_sublist<'a, 'ctx>( ) } -/// List.dropAt : List elem, Nat -> List elem +/// List.dropAt : List elem, U64 -> List elem pub(crate) fn list_drop_at<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 200af3dbd98..28575ee610b 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -722,7 +722,7 @@ impl<'a> LowLevelCall<'a> { // list: RocList, i32 // element_width: usize, i32 // alignment: u32, i32 - // drop_index: usize, i32 + // drop_index: u64, i64 // dec: Dec, i32 // Load the return pointer and the list From 5b2998966b49e727ab4418ee9c4e5b68126464a7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 23:37:39 -0500 Subject: [PATCH 31/80] Update List.replace to no longer use Nat --- crates/compiler/builtins/bitcode/src/list.zig | 14 ++++++++------ crates/compiler/gen_llvm/src/llvm/build_list.rs | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index 18bd64037f9..4ffafeb2284 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -938,7 +938,7 @@ pub fn listConcat(list_a: RocList, list_b: RocList, alignment: u32, element_widt pub fn listReplaceInPlace( list: RocList, - index: usize, + index: u64, element: Opaque, element_width: usize, out_element: ?[*]u8, @@ -948,14 +948,15 @@ pub fn listReplaceInPlace( // at the time of writing, the function is implemented roughly as // `if inBounds then LowLevelListReplace input index item else input` // so we don't do a bounds check here. Hence, the list is also non-empty, - // because inserting into an empty list is always out of bounds - return listReplaceInPlaceHelp(list, index, element, element_width, out_element); + // because inserting into an empty list is always out of bounds, + // and it's always safe to cast index to usize. + return listReplaceInPlaceHelp(list, @as(usize, @intCast(index)), element, element_width, out_element); } pub fn listReplace( list: RocList, alignment: u32, - index: usize, + index: u64, element: Opaque, element_width: usize, out_element: ?[*]u8, @@ -965,8 +966,9 @@ pub fn listReplace( // at the time of writing, the function is implemented roughly as // `if inBounds then LowLevelListReplace input index item else input` // so we don't do a bounds check here. Hence, the list is also non-empty, - // because inserting into an empty list is always out of bounds - return listReplaceInPlaceHelp(list.makeUnique(alignment, element_width), index, element, element_width, out_element); + // because inserting into an empty list is always out of bounds, + // and it's always safe to cast index to usize. + return listReplaceInPlaceHelp(list.makeUnique(alignment, element_width), @as(usize, @intCast(index)), element, element_width, out_element); } inline fn listReplaceInPlaceHelp( diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index ab850df9b19..643e5502747 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -322,7 +322,7 @@ pub(crate) fn list_drop_at<'a, 'ctx>( ) } -/// List.replace_unsafe : List elem, Nat, elem -> { list: List elem, value: elem } +/// List.replace_unsafe : List elem, U64, elem -> { list: List elem, value: elem } pub(crate) fn list_replace_unsafe<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, From 502b0fddf2646711ffd76a1f5df8ecbd631fd131 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:02:53 -0500 Subject: [PATCH 32/80] Remove Nat from Hash, Inspect, Encode, Decode --- crates/compiler/builtins/roc/Decode.roc | 3 +- crates/compiler/builtins/roc/Hash.roc | 18 +---- crates/compiler/builtins/roc/Inspect.roc | 10 +-- crates/compiler/derive/src/decoding/tuple.rs | 2 +- crates/compiler/derive_key/src/hash.rs | 3 - crates/compiler/load/tests/test_reporting.rs | 70 +------------------- crates/compiler/module/src/symbol.rs | 3 +- crates/compiler/solve/src/ability.rs | 31 +-------- crates/compiler/solve_problem/src/lib.rs | 14 +--- crates/reporting/src/error/type.rs | 46 +++---------- 10 files changed, 22 insertions(+), 178 deletions(-) diff --git a/crates/compiler/builtins/roc/Decode.roc b/crates/compiler/builtins/roc/Decode.roc index e8ca1f89b96..cddd35c455b 100644 --- a/crates/compiler/builtins/roc/Decode.roc +++ b/crates/compiler/builtins/roc/Decode.roc @@ -44,7 +44,6 @@ interface Decode I32, I64, I128, - Nat, F32, F64, Dec, @@ -113,7 +112,7 @@ DecoderFormatting implements ## index passed to `stepElem` is 0-indexed. ## ## `finalizer` should produce the tuple value from the decoded `state`. - tuple : state, (state, Nat -> [Next (Decoder state fmt), TooLong]), (state -> Result val DecodeError) -> Decoder val fmt where fmt implements DecoderFormatting + tuple : state, (state, U64 -> [Next (Decoder state fmt), TooLong]), (state -> Result val DecodeError) -> Decoder val fmt where fmt implements DecoderFormatting ## Build a custom [Decoder] function. For example the implementation of ## `decodeBool` could be defined as follows; diff --git a/crates/compiler/builtins/roc/Hash.roc b/crates/compiler/builtins/roc/Hash.roc index 6a520540916..fc04f7cbdfe 100644 --- a/crates/compiler/builtins/roc/Hash.roc +++ b/crates/compiler/builtins/roc/Hash.roc @@ -15,7 +15,6 @@ interface Hash hashI32, hashI64, hashI128, - hashNat, hashDec, complete, hashStrBytes, @@ -25,7 +24,7 @@ interface Hash Bool.{ Bool, isEq }, List, Str, - Num.{ U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, Nat, Dec }, + Num.{ U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, Dec }, ] ## A value that can be hashed. @@ -98,21 +97,6 @@ hashI64 = \hasher, n -> addU64 hasher (Num.toU64 n) hashI128 : a, I128 -> a where a implements Hasher hashI128 = \hasher, n -> addU128 hasher (Num.toU128 n) -## Adds a single Nat to a hasher. -hashNat : a, Nat -> a where a implements Hasher -hashNat = \hasher, n -> - isPlatform32bit = - x : Nat - x = 0xffff_ffff - y = Num.addWrap x 1 - - y == 0 - - if isPlatform32bit then - addU32 hasher (Num.toU32 n) - else - addU64 hasher (Num.toU64 n) - ## LOWLEVEL get the i128 representation of a Dec. i128OfDec : Dec -> I128 diff --git a/crates/compiler/builtins/roc/Inspect.roc b/crates/compiler/builtins/roc/Inspect.roc index e9235c9adf5..a409c04c13a 100644 --- a/crates/compiler/builtins/roc/Inspect.roc +++ b/crates/compiler/builtins/roc/Inspect.roc @@ -27,7 +27,6 @@ interface Inspect i64, u128, i128, - nat, f32, f64, dec, @@ -38,7 +37,7 @@ interface Inspect ] imports [ Bool.{ Bool }, - Num.{ U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, F32, F64, Dec, Nat }, + Num.{ U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, F32, F64, Dec }, List, Str, ] @@ -77,7 +76,6 @@ InspectFormatter implements i64 : I64 -> Inspector f where f implements InspectFormatter u128 : U128 -> Inspector f where f implements InspectFormatter i128 : I128 -> Inspector f where f implements InspectFormatter - nat : Nat -> Inspector f where f implements InspectFormatter f32 : F32 -> Inspector f where f implements InspectFormatter f64 : F64 -> Inspector f where f implements InspectFormatter dec : Dec -> Inspector f where f implements InspectFormatter @@ -131,7 +129,6 @@ DbgFormatter := { data : Str } i64: dbgI64, u128: dbgU128, i128: dbgI128, - nat: dbgNat, f32: dbgF32, f64: dbgF64, dec: dbgDec, @@ -326,11 +323,6 @@ dbgI128 = \num -> f0 <- custom dbgWrite f0 (num |> Num.toStr) -dbgNat : Nat -> Inspector DbgFormatter -dbgNat = \num -> - f0 <- custom - dbgWrite f0 (num |> Num.toStr) - dbgF32 : F32 -> Inspector DbgFormatter dbgF32 = \num -> f0 <- custom diff --git a/crates/compiler/derive/src/decoding/tuple.rs b/crates/compiler/derive/src/decoding/tuple.rs index a327bdfded1..2007a66740b 100644 --- a/crates/compiler/derive/src/decoding/tuple.rs +++ b/crates/compiler/derive/src/decoding/tuple.rs @@ -643,7 +643,7 @@ fn step_elem( Variable::NATURAL, index.to_string().into_boxed_str(), IntValue::I128((index as i128).to_ne_bytes()), - IntBound::Exact(IntLitWidth::Nat), + IntBound::Exact(IntLitWidth::U64), )), degenerate: false, }], diff --git a/crates/compiler/derive_key/src/hash.rs b/crates/compiler/derive_key/src/hash.rs index ae4ade208f8..d28a1b4c277 100644 --- a/crates/compiler/derive_key/src/hash.rs +++ b/crates/compiler/derive_key/src/hash.rs @@ -191,9 +191,6 @@ const fn builtin_symbol_to_hash_lambda(symbol: Symbol) -> Option { Symbol::NUM_I128 | Symbol::NUM_SIGNED128 => { Some(SingleLambdaSetImmediate(Symbol::HASH_HASH_I128)) } - Symbol::NUM_NAT | Symbol::NUM_NATURAL => { - Some(SingleLambdaSetImmediate(Symbol::HASH_HASH_NAT)) - } Symbol::NUM_DEC | Symbol::NUM_DECIMAL => { Some(SingleLambdaSetImmediate(Symbol::HASH_HASH_DEC)) } diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs index 2eb2b52735d..3972e9e6230 100644 --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -12678,14 +12678,14 @@ In roc, functions are always written as a lambda, like{} ), @r#" ── REDUNDANT PATTERN in /code/proj/Main.roc ──────────────────────────────────── - + The 2nd pattern is redundant: - + 6│ when l is 7│ [A, ..] -> "" 8│> [.., A] -> "" 9│ [..] -> "" - + Any value of this shape will be handled by a previous pattern, so this one should be removed. "# @@ -13636,70 +13636,6 @@ In roc, functions are always written as a lambda, like{} ) ); - test_report!( - derive_decoding_for_nat, - indoc!( - r#" - app "test" imports [Decode.{decoder}] provides [main] to "./platform" - - main = - myDecoder : Decoder Nat fmt where fmt implements DecoderFormatting - myDecoder = decoder - - myDecoder - "# - ), - @r" - ── TYPE MISMATCH in /code/proj/Main.roc ──────────────────────────────────────── - - This expression has a type that does not implement the abilities it's expected to: - - 5│ myDecoder = decoder - ^^^^^^^ - - I can't generate an implementation of the `Decoding` ability for - - Nat - - Note: Decoding to a Nat is not supported. Consider decoding to a - fixed-sized unsigned integer, like U64, then converting to a Nat if - needed. - " - ); - - test_report!( - derive_encoding_for_nat, - indoc!( - r#" - app "test" imports [] provides [main] to "./platform" - - x : Nat - - main = Encode.toEncoder x - "# - ), - @r" - ── TYPE MISMATCH in /code/proj/Main.roc ──────────────────────────────────────── - - This expression has a type that does not implement the abilities it's expected to: - - 5│ main = Encode.toEncoder x - ^ - - I can't generate an implementation of the `Encoding` ability for - - Int Natural - - In particular, an implementation for - - Natural - - cannot be generated. - - Tip: `Natural` does not implement `Encoding`. - " - ); - test_no_problem!( derive_decoding_for_tuple, indoc!( diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 162cd69c32a..005f3ad5c73 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1590,13 +1590,12 @@ define_builtins! { 12 HASH_HASH_I32: "hashI32" 13 HASH_HASH_I64: "hashI64" 14 HASH_HASH_I128: "hashI128" - 15 HASH_HASH_NAT: "hashNat" + 15 HASH_HASH_UNORDERED: "hashUnordered" 16 I128_OF_DEC: "i128OfDec" 17 HASH_HASH_DEC: "hashDec" 18 HASH_COMPLETE: "complete" 19 HASH_HASH_STR_BYTES: "hashStrBytes" 20 HASH_HASH_LIST: "hashList" - 21 HASH_HASH_UNORDERED: "hashUnordered" } 14 INSPECT: "Inspect" => { 0 INSPECT_INSPECT_ABILITY: "Inspect" exposed_type=true diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs index 47e33d62e30..52639de5ef5 100644 --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -491,11 +491,6 @@ fn is_builtin_fixed_int_alias(symbol: Symbol) -> bool { ) } -#[inline(always)] -fn is_builtin_nat_alias(symbol: Symbol) -> bool { - matches!(symbol, Symbol::NUM_NAT | Symbol::NUM_NATURAL) -} - #[inline(always)] #[rustfmt::skip] fn is_builtin_float_alias(symbol: Symbol) -> bool { @@ -1021,18 +1016,7 @@ impl DerivableVisitor for DeriveEncoding { #[inline(always)] fn visit_alias(var: Variable, symbol: Symbol) -> Result { - if is_builtin_number_alias(symbol) { - if is_builtin_nat_alias(symbol) { - Err(NotDerivable { - var, - context: NotDerivableContext::Encode(NotDerivableEncode::Nat), - }) - } else { - Ok(Descend(false)) - } - } else { - Ok(Descend(true)) - } + Ok(Descend(!is_builtin_number_alias(symbol))) } #[inline(always)] @@ -1137,18 +1121,7 @@ impl DerivableVisitor for DeriveDecoding { #[inline(always)] fn visit_alias(var: Variable, symbol: Symbol) -> Result { - if is_builtin_number_alias(symbol) { - if is_builtin_nat_alias(symbol) { - Err(NotDerivable { - var, - context: NotDerivableContext::Decode(NotDerivableDecode::Nat), - }) - } else { - Ok(Descend(false)) - } - } else { - Ok(Descend(true)) - } + Ok(Descend(!is_builtin_number_alias(symbol))) } #[inline(always)] diff --git a/crates/compiler/solve_problem/src/lib.rs b/crates/compiler/solve_problem/src/lib.rs index f8118a4495d..43de9204c46 100644 --- a/crates/compiler/solve_problem/src/lib.rs +++ b/crates/compiler/solve_problem/src/lib.rs @@ -121,22 +121,10 @@ pub enum NotDerivableContext { Function, UnboundVar, Opaque(Symbol), - Encode(NotDerivableEncode), - Decode(NotDerivableDecode), + DecodeOptionalRecordField(Lowercase), Eq(NotDerivableEq), } -#[derive(PartialEq, Eq, Debug, Clone)] -pub enum NotDerivableEncode { - Nat, -} - -#[derive(PartialEq, Eq, Debug, Clone)] -pub enum NotDerivableDecode { - Nat, - OptionalRecordField(Lowercase), -} - #[derive(PartialEq, Eq, Debug, Clone)] pub enum NotDerivableEq { FloatingPoint, diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs index 21d23c4c1e3..a074fe9cda3 100644 --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -413,41 +413,17 @@ fn underivable_hint<'b>( ])), ]))) } - NotDerivableContext::Encode(reason) => match reason { - NotDerivableEncode::Nat => { - Some(alloc.note("").append(alloc.concat([ - alloc.reflow("Encoding a "), - alloc.type_str("Nat"), - alloc.reflow(" is not supported. Consider using a fixed-sized unsigned integer, like a "), - alloc.type_str("U64"), - alloc.reflow(" instead."), - ]))) - } - }, - NotDerivableContext::Decode(reason) => match reason { - NotDerivableDecode::Nat => { - Some(alloc.note("").append(alloc.concat([ - alloc.reflow("Decoding to a "), - alloc.type_str("Nat"), - alloc.reflow(" is not supported. Consider decoding to a fixed-sized unsigned integer, like "), - alloc.type_str("U64"), - alloc.reflow(", then converting to a "), - alloc.type_str("Nat"), - alloc.reflow(" if needed."), - ]))) - } - NotDerivableDecode::OptionalRecordField(field) => { - Some(alloc.note("").append(alloc.concat([ - alloc.reflow("I can't derive decoding for a record with an optional field, which in this case is "), - alloc.record_field(field), - alloc.reflow(". Optional record fields are polymorphic over records that may or may not contain them at compile time, "), - alloc.reflow("but are not a concept that extends to runtime!"), - alloc.hardline(), - alloc.reflow("Maybe you wanted to use a "), - alloc.symbol_unqualified(Symbol::RESULT_RESULT), - alloc.reflow("?"), - ]))) - } + NotDerivableContext::DecodeOptionalRecordField(field) => { + Some(alloc.note("").append(alloc.concat([ + alloc.reflow("I can't derive decoding for a record with an optional field, which in this case is "), + alloc.record_field(field), + alloc.reflow(". Optional record fields are polymorphic over records that may or may not contain them at compile time, "), + alloc.reflow("but are not a concept that extends to runtime!"), + alloc.hardline(), + alloc.reflow("Maybe you wanted to use a "), + alloc.symbol_unqualified(Symbol::RESULT_RESULT), + alloc.reflow("?"), + ]))) }, NotDerivableContext::Eq(reason) => match reason { NotDerivableEq::FloatingPoint => { From 8768f150f27fc364e0ceaf33d9694f426aeae81c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:04:20 -0500 Subject: [PATCH 33/80] Remove `Nat` from roc-for-elm-programmers --- roc-for-elm-programmers.md | 190 ++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 100 deletions(-) diff --git a/roc-for-elm-programmers.md b/roc-for-elm-programmers.md index 8967a7f4709..ea9bd3b26e0 100644 --- a/roc-for-elm-programmers.md +++ b/roc-for-elm-programmers.md @@ -162,10 +162,10 @@ List.reverse : List a -> List a [] : List a ``` -The `a` in `List.reverse` is a *bound* type variable, because it appears more than once in the type. +The `a` in `List.reverse` is a _bound_ type variable, because it appears more than once in the type. Whatever the first list's `a` is, that's what the second list's `a` must be as well. -The `a` in `[] : List a` is an *unbound* type variable. It has no restrictions, +The `a` in `[] : List a` is an _unbound_ type variable. It has no restrictions, which is why `[]` can be passed to any function that expects a `List`. In Roc, this distinction between bound and unbound type variables is reflected at @@ -264,7 +264,7 @@ In Roc: ``` > Like in Elm, using records with bound variables should be extremely rare. -> They need to exist for the type system to work, and they aren't *useless*, +> They need to exist for the type system to work, and they aren't _useless_, > but any time you find yourself reaching for them, there is a very high chance > that there's a better way to write that code! @@ -288,7 +288,7 @@ The record before the `&` can be qualified, like so: { Foo.defaultConfig & timeZone: utc } ``` -However, it cannot involve record field access. So this would *not* compile: +However, it cannot involve record field access. So this would _not_ compile: ```elm { Foo.defaults.config & timeZone: utc } @@ -323,7 +323,7 @@ Here's how that `table` function would be implemented in Roc: table = \{ height, width, title ? "", description ? "" } -> ``` -This is using *optional field destructuring* to destructure a record while +This is using _optional field destructuring_ to destructure a record while also providing default values for any fields that might be missing. Here's the type of `table`: @@ -339,8 +339,8 @@ table : table = \{ height, width, title ? "", description ? "" } -> ``` -This says that `table` takes a record with two *required* fields (`height` and -`width` and two *optional* fields (`title` and `description`). It also says that +This says that `table` takes a record with two _required_ fields (`height` and +`width` and two _optional_ fields (`title` and `description`). It also says that the `height` and `width` fields have the type `Pixels` (a type alias for some numeric type), whereas the `title` and `description` fields have the type `Str`. This means you can choose to omit `title`, `description`, or both, when calling @@ -367,8 +367,8 @@ ergonomics of destructuring mean this wouldn't be a good fit for data modeling. Roc's pattern matching conditionals work about the same as how they do in Elm. Here are two differences: -- Roc uses the syntax `when`...`is` instead of `case`...`of` -- In Roc, you can use `|` to handle multiple patterns in the same way +- Roc uses the syntax `when`...`is` instead of `case`...`of` +- In Roc, you can use `|` to handle multiple patterns in the same way For example: @@ -415,9 +415,9 @@ This is the biggest semantic difference between Roc and Elm. Let's start with the motivation. Suppose I'm using a platform for making a web server, and I want to: -- Read some data from a file -- Send an HTTP request containing some of the data from the file -- Write some data to a file containing some of the data from the HTTP response +- Read some data from a file +- Send an HTTP request containing some of the data from the file +- Write some data to a file containing some of the data from the HTTP response Assuming I'm writing this on a Roc platform which has a `Task`-based API, and that `Task.await` is like Elm's `Task.andThen` but with the arguments @@ -447,7 +447,7 @@ Task.await : Task a err, (a -> Task b err) -> Task b err If these are the types, the result would be a type mismatch. Those `Task` values have incompatible error types, so `await` won't be able to chain them together. -This situation is one of the motivations behind Roc's *tags* feature. Using tags, +This situation is one of the motivations behind Roc's _tags_ feature. Using tags, not only will this type-check, but at the end we get a combined error type which has the union of all the possible errors that could have occurred in this sequence. We can then handle those errors using a single `when`, like so: @@ -481,7 +481,7 @@ Http.get : Url -> Task Http.Response (Http.Err *) await : Task a err, (a -> Task b err) -> Task b err ``` -The key is that each of the error types is a type alias for a Roc *tag union*. +The key is that each of the error types is a type alias for a Roc _tag union_. Here's how those look: ```elm @@ -524,19 +524,19 @@ type File.WriteErr There are a few differences between them, but the most significant one here is that the Roc version has a type variable. -That type variable has a similar purpose to the type variable in Elm's *open records* +That type variable has a similar purpose to the type variable in Elm's _open records_ (e.g. the `a` in `{ a | name : String, email : String }` which in Roc would be `{ name : Str, email : Str }a`) - except applied to sum types (such as Elm's custom types) instead of product types (such as records). > If you were to remove the type variables from the Roc declarations for > `Http.Err`, `File.ReadErr`, and `File.WriteErr`, they would work practically -> the same way as the Elm one. Roc *tag unions* can be used as traditional +> the same way as the Elm one. Roc _tag unions_ can be used as traditional > algebraic data types, and they have the usual support for pattern matching, > exhaustiveness checking, and so on. You don't need to declare tag unions before using them. Instead, you can -just write a *tag* (essentially a variant) anywhere you like, and Roc will infer +just write a _tag_ (essentially a variant) anywhere you like, and Roc will infer the type of the union it goes in. Here are some examples of using tags in a REPL: @@ -564,15 +564,15 @@ Foo "hi" Bar : [Foo Str [Bar]*]* Foo ["str1", "str2"] : [Foo (List Str)]* ``` -The `[` `]`s in the types are tag *unions*, and they list all the possible -different *tags* that the value could be at runtime. In all of these tag unions, +The `[` `]`s in the types are tag _unions_, and they list all the possible +different _tags_ that the value could be at runtime. In all of these tag unions, there is only one tag. Notice the `*` at the end; that's the type variable we saw earlier. Similarly to how if you put `{ name = "" }` into `elm repl`, it will -infer a type of `{ a | name : String }` - that is, an *open record* with an +infer a type of `{ a | name : String }` - that is, an _open record_ with an unbound type variable and `name : Str` field - if you put a tag `Foo ""` into -`roc repl`, it will infer a type of `[Foo Str]*` - that is, an *open tag union* +`roc repl`, it will infer a type of `[Foo Str]*` - that is, an _open tag union_ with one alternative: a `Foo` tag with a `Str` payload. The same tag can be used with different arities and types. In the REPL above, @@ -593,11 +593,11 @@ when blah is The inferred type of this expression would be `[MyStr Str, MyBool Bool]`. -> Exhaustiveness checking is still in full effect here. It's based on usage; +> Exhaustiveness checking is still in full effect here. It's based on usage; > if any code pathways led to `blah` being set to the tag `Foo`, I'd get > an exhaustiveness error because this `when` does not have a `Foo` branch. -There's an important interaction here between the inferred type of a *when-expression* and +There's an important interaction here between the inferred type of a _when-expression_ and the inferred type of a tag value. Note which types have a `*` and which do not. ```elm @@ -614,17 +614,17 @@ tagToStr = \tag -> Bar str -> Str.concat str "!" ``` -Each of these type annotations involves a *tag union* - a collection of tags bracketed by `[` and `]`. +Each of these type annotations involves a _tag union_ - a collection of tags bracketed by `[` and `]`. -- The type `[Foo, Bar Str]` is a **closed** tag union. -- The type `[Foo]*` is an **open** tag union. +- The type `[Foo, Bar Str]` is a **closed** tag union. +- The type `[Foo]*` is an **open** tag union. You can pass `x` to `tagToStr` because an open tag union is type-compatible with any closed tag union which contains its tags (in this case, the `Foo` tag). You can also pass `y` to `tagToStr` for the same reason. In general, when you make a tag value, you'll get an open tag union (with a `*`). -Using `when` *can* get you a closed union (a union without a `*`) but that's not +Using `when` _can_ get you a closed union (a union without a `*`) but that's not always what happens. Here's a `when` in which the inferred type is an open tag union: ```elm @@ -638,11 +638,11 @@ alwaysFoo = \tag -> The return value is an open tag union because all branches return something tagged with `Foo`. -The argument is also an open tag union, because this *when-expression* has +The argument is also an open tag union, because this _when-expression_ has a default branch; that argument is compatible with any tag union. This means you can pass the function some totally nonsensical tag, and it will still compile. -> Note that the argument does *not* have the type `*`. That's because you +> Note that the argument does _not_ have the type `*`. That's because you > cannot pass it values of any type; you can only pass it tags! > > You could, if you wanted, change the argument's annotation to be `[]*` and @@ -662,7 +662,7 @@ alwaysFoo : [Foo Str, Bar Bool] -> [Foo Str]* out your own annotations, you can get the same level of restriction you get with traditional algebraic data types (which, after all, come with the requirement that you write out their annotations). Using annotations, you can restrict even -*when-expressions* with default branches to accept only the values you define to be valid. +_when-expressions_ with default branches to accept only the values you define to be valid. In fact, if you want a traditional algebraic data type in Roc, you can get about the same functionality by making (and then using) a type alias for a closed tag union. @@ -705,8 +705,8 @@ includes in its union." ## Opaque Types In Elm, you can choose to expose (or not) custom types' constructors in order to create [opaque types](http://sporto.github.io/elm-patterns/advanced/opaque-types.html). -Since Roc's *tags* can be constructed in any module without importing anything, Roc has a separate -*opaque type* language feature to enable information hiding. +Since Roc's _tags_ can be constructed in any module without importing anything, Roc has a separate +_opaque type_ language feature to enable information hiding. As an example, suppose I define these inside the `Username` module: @@ -760,7 +760,7 @@ app imports [Parser, Http.{ Request }, Task.{ Task, await }] `app` modules are application entry points, and they don't formally expose anything. They also don't have names, so other modules can't even import them! -Modules that *can* be imported are `interface` modules. Their headers look like this: +Modules that _can_ be imported are `interface` modules. Their headers look like this: ```elm interface Parser @@ -833,8 +833,8 @@ a b c # f (a b c) x y ``` -In Roc, the `|>` operator inserts the previous expression as the *first* argument -to the subsequent expression, rather than as the *last* argument as it does in Elm. +In Roc, the `|>` operator inserts the previous expression as the _first_ argument +to the subsequent expression, rather than as the _last_ argument as it does in Elm. This makes a number of operations more useful in pipelines. For example, in Roc, `|> Num.div 2.0` divides by 2: @@ -845,7 +845,7 @@ This makes a number of operations more useful in pipelines. For example, in Roc, # 1000.0 ``` -In Elm, where `|>` inserts 2 as the last argument, 2 ends up being the *numerator* +In Elm, where `|>` inserts 2 as the last argument, 2 ends up being the _numerator_ rather than the denominator: ```elm @@ -1014,7 +1014,7 @@ readLicense = \filename -> |> Task.mapFail InvalidFormat ``` -This uses *backpassing* syntax to nest anonymous functions without indenting them. +This uses _backpassing_ syntax to nest anonymous functions without indenting them. Here's a smaller demonstration of backpassing; the second snippet is sugar for the first. ```elm @@ -1041,8 +1041,8 @@ written backwards, like this: num + 1 ``` -This is called *backpassing* because you write the function *backwards* and then -immediately *pass* it as an argument to another function. +This is called _backpassing_ because you write the function _backwards_ and then +immediately _pass_ it as an argument to another function. The other function - the one you're passing this one to - goes right after the `<-` symbol. That function should be called with one argument missing at @@ -1141,8 +1141,8 @@ Like Elm, Roc organizes numbers into integers and floating-point numbers. However, Roc breaks them down even further. For example, Roc has two different sizes of float types to choose from: -- `F64` - a 64-bit [IEEE 754 binary floating point number](https://en.wikipedia.org/wiki/IEEE_754#Binary) -- `F32` - a 32-bit [IEEE 754 binary floating point number](https://en.wikipedia.org/wiki/IEEE_754#Binary) +- `F64` - a 64-bit [IEEE 754 binary floating point number](https://en.wikipedia.org/wiki/IEEE_754#Binary) +- `F32` - a 32-bit [IEEE 754 binary floating point number](https://en.wikipedia.org/wiki/IEEE_754#Binary) Both types are desirable in different situations. For example, when doing simulations, the precision of the `F64` type is desirable. On the other hand, @@ -1159,24 +1159,14 @@ them take longer than they do with floats. Similarly to how there are different sizes of floating point numbers, there are also different sizes of integer to choose from: -- `I8` -- `I16` -- `I32` -- `I64` -- `I128` +- `I8` +- `I16` +- `I32` +- `I64` +- `I128` -Roc also has *unsigned* integers which are never negative. They are -`U8`, `U16`, `U32`, `U64`, `U128`, and `Nat`. - -The size of `Nat` depends on what target you're building for; on a 64-bit target -(the most common), at runtime `Nat` will be the same as `U64`, whereas on a 32-bit -target (for example, WebAssembly) at runtime it will be the same as `U32` instead. -`Nat` comes up most often with collection lengths and indexing into collections. -For example: - -- `List.len : List * -> Nat` -- `List.get : List elem, Nat -> Result elem [OutOfBounds]*` -- `List.set : List elem, Nat, elem -> List elem` +Roc also has _unsigned_ integers which are never negative. They are +`U8`, `U16`, `U32`, `U64`, and `U128`. As with floats, which integer type to use depends on the values you want to support as well as your performance needs. For example, raw sequences of bytes are typically @@ -1195,10 +1185,10 @@ This accepts any of the numeric types discussed above, from `I128` to `F32` to `D64` and everything in between. This is because those are all type aliases for `Num` types. For example: -- `I64` is a type alias for `Num (Integer Signed64)` -- `U8` is a type alias for `Num (Integer Unsigned8)` -- `F32` is a type alias for `Num (Fraction Binary32)` -- `Dec` is a type alias for `Num (Fraction Decimal)` +- `I64` is a type alias for `Num (Integer Signed64)` +- `U8` is a type alias for `Num (Integer Unsigned8)` +- `F32` is a type alias for `Num (Fraction Binary32)` +- `Dec` is a type alias for `Num (Fraction Decimal)` (Those types like `Integer`, `Fraction`, and `Signed64` are all defined like `Never`; you can never instantiate one. They are used only as phantom types.) @@ -1212,7 +1202,7 @@ that can work on any integer or any fractional number. For example, `Num.bitwiseAnd : Int a, Int a -> Int a`. In Roc, number literals with decimal points are `Frac *` values. -Number literals *without* a decimal point are `Num *` values. Almost always these +Number literals _without_ a decimal point are `Num *` values. Almost always these will end up becoming something more specific, but in the unlikely event (most often in a REPL) that you actually do end up with an operation that runs on either an `Int *` or a `Num *` value, it will default to being treated as @@ -1261,9 +1251,9 @@ for details. `comparable`, `appendable`, and `number` don't exist in Roc. -- `number` is replaced by `Num`, as described previously. -- `appendable` is only used in Elm for the `(++)` operator, and Roc doesn't have that operator. -- `comparable` is used in Elm for comparison operators (like `<` and such), plus `List.sort`, `Dict`, and `Set`. Roc's comparison operators (like `<`) only accept numbers; `"foo" < "bar"` is valid Elm, but will not compile in Roc. Roc's dictionaries and sets are hashmaps behind the scenes (rather than ordered trees), so their keys need to be hashable but not necessarily comparable. +- `number` is replaced by `Num`, as described previously. +- `appendable` is only used in Elm for the `(++)` operator, and Roc doesn't have that operator. +- `comparable` is used in Elm for comparison operators (like `<` and such), plus `List.sort`, `Dict`, and `Set`. Roc's comparison operators (like `<`) only accept numbers; `"foo" < "bar"` is valid Elm, but will not compile in Roc. Roc's dictionaries and sets are hashmaps behind the scenes (rather than ordered trees), so their keys need to be hashable but not necessarily comparable. That said, Roc's `Dict` and `Set` do have a restriction on their keys, just not `comparable`. See the section on Abilities in [the tutorial](https://roc-lang.org/tutorial) for details. @@ -1272,23 +1262,23 @@ See the section on Abilities in [the tutorial](https://roc-lang.org/tutorial) fo `elm/core` has these modules: -- `Array` -- `Basics` -- `Bitwise` -- `Char` -- `Debug` -- `Dict` -- `List` -- `Maybe` -- `Platform` -- `Platform.Cmd` -- `Platform.Sub` -- `Process` -- `Result` -- `Set` -- `String` -- `Task` -- `Tuple` +- `Array` +- `Basics` +- `Bitwise` +- `Char` +- `Debug` +- `Dict` +- `List` +- `Maybe` +- `Platform` +- `Platform.Cmd` +- `Platform.Sub` +- `Process` +- `Result` +- `Set` +- `String` +- `Task` +- `Tuple` In Roc, the standard library is not a standalone package. It is baked into the compiler, and you can't upgrade it independently of a compiler release; whatever version of @@ -1298,26 +1288,26 @@ possible to ship Roc's standard library as a separate package!) Roc's standard library has these modules: -- `Str` -- `Bool` -- `Num` -- `List` -- `Dict` -- `Set` -- `Result` +- `Str` +- `Bool` +- `Num` +- `List` +- `Dict` +- `Set` +- `Result` Some differences to note: -- All these standard modules are imported by default into every module. They also expose all their types (e.g. `Bool`, `List`, `Result`) but they do not expose any values - not even `negate` or `not`. (`Ok` and `Err` are ordinary tags, so they do not need to be exposed; they are globally available regardless!) -- In Roc it's called `Str` instead of `String`. -- `List` refers to something more like Elm's `Array`, as noted earlier. -- No `Char`. This is by design. What most people think of as a "character" is a rendered glyph. However, rendered glyphs are comprised of [grapheme clusters](https://stackoverflow.com/a/27331885), which are a variable number of Unicode code points - and there's no upper bound on how many code points there can be in a single cluster. In a world of emoji, I think this makes `Char` error-prone and it's better to have `Str` be the only first-class unit. For convenience when working with unicode code points (e.g. for performance-critical tasks like parsing), the single-quote syntax is sugar for the corresponding `U32` code point - for example, writing `'鹏'` is exactly the same as writing `40527`. Like Rust, you get a compiler error if you put something in single quotes that's not a valid [Unicode scalar value](http://www.unicode.org/glossary/#unicode_scalar_value). -- No `Basics`. You use everything from the standard library fully-qualified; e.g. `Bool.not` or `Num.negate` or `Num.ceiling`. There is no `Never` because `[]` already serves that purpose. (Roc's standard library doesn't include an equivalent of `Basics.never`, but it's one line of code and anyone can implement it: `never = \a -> never a`.) -- No `Tuple` module, but there is syntax support for tuples which allows not only destructuring (like in Elm) but also direct field access - which looks like record field access, but with numbered indices instead of named fields. For example, the Elm code `Tuple.first ( "a", "b" )` and `Tuple.second ( "a", "b" )` could be written in Roc as `("a", "b").0` and `("a", "b").1`. Roc tuples can also have more than two fields. -- No `Task`. By design, platform authors implement `Task` (or don't; it's up to them) - it's not something that really *could* be usefully present in Roc's standard library. -- No `Process`, `Platform`, `Cmd`, or `Sub` - similarly to `Task`, these are things platform authors would include, or not. -- No `Debug`. Roc has a [built-in `dbg` keyword](https://www.roc-lang.org/tutorial#debugging) instead of `Debug.log` and a [`crash` keyword](https://www.roc-lang.org/tutorial#crashing) instead of `Debug.todo`. -- No `Maybe`. This is by design. If a function returns a potential error, use `Result` with an error type that uses a zero-arg tag to describe what went wrong. (For example, `List.first : List a -> Result a [ListWasEmpty]*` instead of `List.first : List a -> Maybe a`.) If you want to have a record field be optional, use an Optional Record Field directly (see earlier). If you want to describe something that's neither an operation that can fail nor an optional field, use a more descriptive tag - e.g. for a nullable JSON decoder, instead of `nullable : Decoder a -> Decoder (Maybe a)`, make a self-documenting API like `nullable : Decoder a -> Decoder [Null, NonNull a]*`. +- All these standard modules are imported by default into every module. They also expose all their types (e.g. `Bool`, `List`, `Result`) but they do not expose any values - not even `negate` or `not`. (`Ok` and `Err` are ordinary tags, so they do not need to be exposed; they are globally available regardless!) +- In Roc it's called `Str` instead of `String`. +- `List` refers to something more like Elm's `Array`, as noted earlier. +- No `Char`. This is by design. What most people think of as a "character" is a rendered glyph. However, rendered glyphs are comprised of [grapheme clusters](https://stackoverflow.com/a/27331885), which are a variable number of Unicode code points - and there's no upper bound on how many code points there can be in a single cluster. In a world of emoji, I think this makes `Char` error-prone and it's better to have `Str` be the only first-class unit. For convenience when working with unicode code points (e.g. for performance-critical tasks like parsing), the single-quote syntax is sugar for the corresponding `U32` code point - for example, writing `'鹏'` is exactly the same as writing `40527`. Like Rust, you get a compiler error if you put something in single quotes that's not a valid [Unicode scalar value](http://www.unicode.org/glossary/#unicode_scalar_value). +- No `Basics`. You use everything from the standard library fully-qualified; e.g. `Bool.not` or `Num.negate` or `Num.ceiling`. There is no `Never` because `[]` already serves that purpose. (Roc's standard library doesn't include an equivalent of `Basics.never`, but it's one line of code and anyone can implement it: `never = \a -> never a`.) +- No `Tuple` module, but there is syntax support for tuples which allows not only destructuring (like in Elm) but also direct field access - which looks like record field access, but with numbered indices instead of named fields. For example, the Elm code `Tuple.first ( "a", "b" )` and `Tuple.second ( "a", "b" )` could be written in Roc as `("a", "b").0` and `("a", "b").1`. Roc tuples can also have more than two fields. +- No `Task`. By design, platform authors implement `Task` (or don't; it's up to them) - it's not something that really _could_ be usefully present in Roc's standard library. +- No `Process`, `Platform`, `Cmd`, or `Sub` - similarly to `Task`, these are things platform authors would include, or not. +- No `Debug`. Roc has a [built-in `dbg` keyword](https://www.roc-lang.org/tutorial#debugging) instead of `Debug.log` and a [`crash` keyword](https://www.roc-lang.org/tutorial#crashing) instead of `Debug.todo`. +- No `Maybe`. This is by design. If a function returns a potential error, use `Result` with an error type that uses a zero-arg tag to describe what went wrong. (For example, `List.first : List a -> Result a [ListWasEmpty]*` instead of `List.first : List a -> Maybe a`.) If you want to have a record field be optional, use an Optional Record Field directly (see earlier). If you want to describe something that's neither an operation that can fail nor an optional field, use a more descriptive tag - e.g. for a nullable JSON decoder, instead of `nullable : Decoder a -> Decoder (Maybe a)`, make a self-documenting API like `nullable : Decoder a -> Decoder [Null, NonNull a]*`. ## Operator Desugaring Table From 521cb45c99bccf29e2f317cc97c171781214796e Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:06:45 -0500 Subject: [PATCH 34/80] Remove Nat from repl eval --- design/language/Abilities.md | 172 ++++++++++++----------------------- 1 file changed, 58 insertions(+), 114 deletions(-) diff --git a/design/language/Abilities.md b/design/language/Abilities.md index 7526f1eb860..b71241d4295 100644 --- a/design/language/Abilities.md +++ b/design/language/Abilities.md @@ -4,20 +4,19 @@ Status: we invite you to try out abilities for beta use, and are working on reso This design idea addresses a variety of problems in Roc at once. It also unlocks some very exciting benefits that I didn't expect at the outset! It's a significant addition to the language, but it also means two other language features can be removed, and numbers can get a lot simpler. - Thankfully it's a non-breaking change for most Roc code, and in the few places where it actually is a breaking change, the fix should consist only of shifting a handful of characters around. Still, it feels like a big change because of all the implications it brings. Here we go! ## Background -Elm has a few specially constrained type variables: `number`, `comparable`, `appendable`, and the lesser-known `compappend`. Roc does not have these; it has no `appendable` or `compappend` equivalent, and instead of `number` and `comparable` it has: +Elm has a few specially constrained type variables: `number`, `comparable`, `appendable`, and the lesser-known `compappend`. Roc does not have these; it has no `appendable` or `compappend` equivalent, and instead of `number` and `comparable` it has: -- `Num *` as the type of number literals, with type aliases like `I64 : Num (Integer Signed64)` -- The functionless constraint for type variables; for example, the type of `Bool.isEq` is `'var, 'var -> Bool` - and the apostrophe at the beginning of `'var` means that it must represent a type that has no functions anywhere in it. - +- `Num *` as the type of number literals, with type aliases like `I64 : Num (Integer Signed64)` +- The functionless constraint for type variables; for example, the type of `Bool.isEq` is `'var, 'var -> Bool` - and the apostrophe at the beginning of `'var` means that it must represent a type that has no functions anywhere in it. There are a few known problems with this design, as well as some missed opportunities. ### Problem 1: Nonsense numbers type-check + Right now in Roc, the following type-checks: ```coffee @@ -27,34 +26,30 @@ x = 5 This type-checks because the number literal 5 has the type `Num *`, which unifies with any `Num` - even if the type variable is complete nonsense. - It's not clear what should happen here after type-checking. What machine instructions should Roc generate for this nonsense number type? Suppose I later wrote (`if x + 1 > 0 then … `) - what hardware addition instruction should be generated there? - Arguably the compiler should throw an error - but when? We could do it at compile time, during code generation, but that goes against the design goal of "you can always run your Roc program, even if there are compile-time errors, and it will get as far as it can." - So then do we generate a runtime exception as soon as you encounter this code? Now Roc's type system is arguably unsound, because this is a runtime type error which the type checker approved. - Do we add an extra special type constraint just for Num to detect this during the type-checking phase? Now Num is special-cased in a way that no other type is… - None of these potential solutions have ever felt great to me. ### Problem 2: Custom number types can't use arithmetic operators -Roc's ordinary numbers should be enough for most use cases, but there are nice packages like [elm-units](https://package.elm-lang.org/packages/ianmackenzie/elm-units/latest/) which can prevent [really expensive errors](https://spacemath.gsfc.nasa.gov/weekly/6Page53.pdf) by raising compile-time errors for mismatched units...at the cost of having to sacrifice normal arithmetic operators. You can't use `+` on your unit-ful numbers, because `+` in Roc desugars to `Num.add`, not (for example) `Quantity.add`. +Roc's ordinary numbers should be enough for most use cases, but there are nice packages like [elm-units](https://package.elm-lang.org/packages/ianmackenzie/elm-units/latest/) which can prevent [really expensive errors](https://spacemath.gsfc.nasa.gov/weekly/6Page53.pdf) by raising compile-time errors for mismatched units...at the cost of having to sacrifice normal arithmetic operators. You can't use `+` on your unit-ful numbers, because `+` in Roc desugars to `Num.add`, not (for example) `Quantity.add`. Also, if 128-bit integers aren't big enough, because the numbers you're working with are outside the undecillion range (perhaps recording the distance between the Earth and the edge of the universe in individual atoms or something?) maybe you want to make an arbitrary-sized integer package. Again, you can do that, but you can't use `+` with it. Same with vector packages, matrix packages, etc. - This might not sound like a big problem (e.g. people deal with it in Java land), but in domains where you want to use custom numeric types, not having this is (so I've heard) a significant incentive to use plain numbers instead of more helpful data types. ### Problem 3: Decoders are still hard to learn + Roc is currently no different from Elm in this regard. I only recently realized that the design I'm about to describe can also address this problem, but I was very excited to discover that! ### Problem 4: Custom collection equality + Let's suppose I'm creating a custom data structure: a dictionary, possibly backed by a hash map or a tree. We'll ignore the internal structure of the storage field for now, but the basic technique we'd use would be a private tag wrapper to make an opaque type: ```coffee @@ -63,74 +58,63 @@ Dict k v : [ @Dict { storage : … } ] Today in Roc I can make a very nice API for this dictionary, but one thing I can't do is get `==` to do the right thing if my internal storage representation is sensitive to insertion order. - For example, suppose this `Dict` has an internal storage of a binary tree, which means it's possible to get two different internal storage representations depending on the order in which someone makes the same `Dict.insert` calls. Insertion order shouldn't affect equality - what matters is if the two dictionaries contain the same elements! - but by default it does, because `==` only knows how to check if the internal structures match exactly. - This feels like a significantly bigger problem in Roc than it is in Elm, because: - -- It's more likely that people will have applications where custom data structures are valuable, e.g. to efficiently store and retrieve millions of values in memory on a server. (This wouldn't likely happen in a browser-based UI.) Discord [ran into a use case like this](https://discord.com/blog/using-rust-to-scale-elixir-for-11-million-concurrent-users) in Elixir, and ended up turning to Rust FFI to get the performance they needed; I'm optimistic that we can get acceptable performance for use cases like this out of pure Roc data structure implementations, and pure Roc data structures would be much more ergonomic than interop - since having to use Task for every operation would be a significant downside for a data structure. -- I want to make testing low-friction, especially within the editor, and some of the ideas I have for how to do that rely on `==` being automatically used behind the scenes to compare values against known good values. If someone wrote tests that relied on `==` and then wanted to swap out a data structure for a custom one (e.g. because they ran into the scaling issues Discord did), it would be extra bad if the new data structure stopped working with all the existing tests and they all had to be rewritten to no longer use these convenient testing features and instead use a custom `Dict.contentsEq` or something instead. - +- It's more likely that people will have applications where custom data structures are valuable, e.g. to efficiently store and retrieve millions of values in memory on a server. (This wouldn't likely happen in a browser-based UI.) Discord [ran into a use case like this](https://discord.com/blog/using-rust-to-scale-elixir-for-11-million-concurrent-users) in Elixir, and ended up turning to Rust FFI to get the performance they needed; I'm optimistic that we can get acceptable performance for use cases like this out of pure Roc data structure implementations, and pure Roc data structures would be much more ergonomic than interop - since having to use Task for every operation would be a significant downside for a data structure. +- I want to make testing low-friction, especially within the editor, and some of the ideas I have for how to do that rely on `==` being automatically used behind the scenes to compare values against known good values. If someone wrote tests that relied on `==` and then wanted to swap out a data structure for a custom one (e.g. because they ran into the scaling issues Discord did), it would be extra bad if the new data structure stopped working with all the existing tests and they all had to be rewritten to no longer use these convenient testing features and instead use a custom `Dict.contentsEq` or something instead. This is one of the most serious problems on this list. Not for the short term, but for the long term. ### Problem 5: How to specify functionlessness in documentation -In Roc's current design, certain types have a functionless constraint. For example, in `Bool.isEq : 'val, 'val -> Bool`, the type variable `'val` means "a type that contains no functions, which we are naming val here." +In Roc's current design, certain types have a functionless constraint. For example, in `Bool.isEq : 'val, 'val -> Bool`, the type variable `'val` means "a type that contains no functions, which we are naming val here." In this design, it's necessarily a breaking change when a type goes from functionless to function-ful, because that type can no longer be used with the `==` operator (among other things). - How do we report on that breaking change? What's the type diff? Just write the sentence "The type Foo was functionless before, but now it isn't" and call it a day? There are solutions to this, but I haven't encountered any I'm particularly fond of. - There's also a related problem with how to display it in documentation. If I have an opaque type that is functionless (as they usually will be), how should the docs display that? A little icon or something? It's more noteworthy when a type is function-ful, so should that be displayed as an icon instead even though there's only syntax in the language for function-less? - This is definitely solvable, but once again I can't name any solutions I love. ### Problem 6: No nice way to specify editor-specific code -One of the goals for Roc is to have packages ship with editor integrations. +One of the goals for Roc is to have packages ship with editor integrations. For example, let's say I'm making a custom data structure like the `Dict` from earlier. I want to be able to render an interactive "expando" style `Dict` in the editor, so when someone is in the editor looking at a trace of the values running through their program, they can expand the dictionary to look at just its key-value pairs instead of having to wade through its potentially gnarly internal storage representation. It's a similar problem to equality: as the author of `Dict`, I want to customize that! - The question is how I should specify the rendering function for `Dict`. There isn't an obvious answer in current Roc. Would I write a view function in `Dict.roc`, and the editor just looks for a function by that name? If so, would I expose it directly from that module? If so, then does that mean the API docs for Dict will include a view function that's only there for the editor's benefit? Should there be some special language keyword to annotate it as "editor-only" so it doesn't clutter up the rest of the API docs? - As with the `Num *` problem, there are various ways to solve this using the current language primitives, but I haven't found any that seem really nice. ### Problem 7: Record-of-function passing -This is a minor problem, but worth noting briefly. +This is a minor problem, but worth noting briefly. In Roc's development backend, we do mostly the same thing when generating X86-64 instructions and ARM instructions. However, there are also several points in the process where slightly different things need to happen depending on what architecture we're targeting. - In Rust, we can use traits to specialize these function calls in a way where Rust's compiler will monomorphize specialized versions of one generic function for each architecture, such that each specialized function does direct calls to the appropriate architecture-specific functions at the appropriate moments. It's exactly as efficient as if those specialized functions had each been written by hand, except they all get to share code. - In Roc, you can achieve this same level of reuse by passing around a record of functions, and calling them at the appropriate moments. While this works, it has strictly more overhead potential than the trait-based approach we're using in Rust. Maybe after a bunch of LLVM inlining and optimization passes, it will end up being equivalent, but presumably there will be cases where it does not. - Is the amount of overhead we're talking about here a big deal? Maybe, maybe not, depending on the use case. This is definitely a niche situation, but nevertheless a missed opportunity for some amount of speed compared to what other languages can do. ## Proposal: Abilities -This proposal is about a new language feature called "abilities," which addresses all of these problems in a nice way, while also making some other things possible in the language. +This proposal is about a new language feature called "abilities," which addresses all of these problems in a nice way, while also making some other things possible in the language. Abilities are similar to traits in Rust. Here's how the type of addition would change from today's world to the Abilities world: - **Today:** + ```coffee Num.add : Num a, Num a -> Num a ``` **Abilities:** + ```coffee Num.add : number, number -> number where number has Num @@ -138,19 +122,16 @@ Num.add : number, number -> number The new language keywords are emphasized in bold. - -That where `number` has `Num` part is saying that whatever type gets used in place of the number type variable needs to have the Num ability. All the current number types (`I64`, `Nat`, etc.) would have the `Num` ability, the integer types would have the `Int` ability, and the fractional types would have the `Frac` ability. - +That where `number` has `Num` part is saying that whatever type gets used in place of the number type variable needs to have the Num ability. All the current number types (`I64`, `Dec`, etc.) would have the `Num` ability, the integer types would have the `Int` ability, and the fractional types would have the `Frac` ability. All of those numeric abilities would be builtins, but you could also define your own custom abilities. Like Rust traits today (that is, Rust 1.56), abilities would not be higher-kinded. The explicit plan would be that they would never be higher-kinded, so it would never be possible to make a `Functor` or `Monad` ability. ### Number Literals -Abilities can require other abilities. For example, to have the `Int` ability, you also need to have the `Num` ability. This means that **has `Int`** is strictly more constraining than **has `Num`**, which in turn means that we can change the type of number literals to be "an unbound variable that has the `Num` ability," similarly to what Haskell does. +Abilities can require other abilities. For example, to have the `Int` ability, you also need to have the `Num` ability. This means that **has `Int`** is strictly more constraining than **has `Num`**, which in turn means that we can change the type of number literals to be "an unbound variable that has the `Num` ability," similarly to what Haskell does. Here's how that would look in the REPL: - **Today:** ```coffee @@ -159,6 +140,7 @@ Here's how that would look in the REPL: ``` **Abilities:** + ```coffee » 5 5 : number @@ -167,9 +149,7 @@ Here's how that would look in the REPL: I'm not sure which version is more beginner-friendly, to be honest. - -The latter is more verbose, but it's much easier to guess roughly what it means. The `*` in `Num *` isn't really self-descriptive, so a beginner playing around in the repl who hasn't learned about type variables yet (let alone wildcard type variables) seems less likely to have any useful intuition about what `Num *` is saying compared to what `where number has Num` is saying. - +The latter is more verbose, but it's much easier to guess roughly what it means. The `*` in `Num *` isn't really self-descriptive, so a beginner playing around in the repl who hasn't learned about type variables yet (let alone wildcard type variables) seems less likely to have any useful intuition about what `Num *` is saying compared to what `where number has Num` is saying. This change to number literals would solve [Problem #1](#problem-1-nonsense-numbers-type-check) (nonsense numbers type-check) completely. The following would no longer type-check: @@ -198,25 +178,26 @@ x = 5 ``` ```coffee -x : Nat +x : U64 x = 5 ``` ...but there's no opportunity to inject any nonsense that the type checker would accept. - Since you can add abilities to your own custom types (as we'll see later), this means you can add `Num` to your own custom number types (as well as `Int` or `Frac`) and then use them with all the usual arithmetic operators. This solves [Problem #2](#problem-2-custom-number-types-cant-use-arithmetic-operators). ### Functionless Constraints -Here's how the type of `Bool.isEq` would change from the current world (using the functionless constraint with the ' syntax) to an Abilities world: +Here's how the type of `Bool.isEq` would change from the current world (using the functionless constraint with the ' syntax) to an Abilities world: **Today:** + ```coffee Bool.isEq : 'val, 'val -> Bool ``` **Abilities:** + ```coffee Bool.isEq : val, val -> Bool where val has Eq @@ -231,47 +212,38 @@ Dict.insert : k, v, Dict k v -> Dict k v If Hash doesn't require `Eq` for some reason (although it probably should), then `Dict.insert` could require multiple abilities as part of the annotation, e.g. `where k has Hash, Eq` - -In the Abilities world, Roc no longer needs the concept of the *functionless* constraint, and it can be removed from the language. Abilities can cover all those use cases. +In the Abilities world, Roc no longer needs the concept of the _functionless_ constraint, and it can be removed from the language. Abilities can cover all those use cases. ### Default Abilities -One of the many things I like about Elm is that I can make anonymous records and tuples have them Just Work with the `==` operator. In contrast, in Rust I have to name the struct and then add `#[deriving(Eq)]` to it if I want `==` to work on it. +One of the many things I like about Elm is that I can make anonymous records and tuples have them Just Work with the `==` operator. In contrast, in Rust I have to name the struct and then add `#[deriving(Eq)]` to it if I want `==` to work on it. However, in Rust, tuples work basically like how they do in Elm: equality Just Works as long as all the elements in the tuple have `Eq`. In fact, Rust tuples automatically derive a bunch of traits. We can do something similar in Roc. - Specifically, the idea would be to have all records and tags automatically have the following abilities by default, wherever possible. (For example, types that contain functions wouldn't get these abilities, because these operations are unsupported for functions!) - 1. Eq 2. Hash 3. Sort 4. Encode 5. Decode - Eq and Hash work like they do in Rust, although as previously noted, I think Hash should probably require Eq. Sort is like Ord in Rust, although I prefer the name Sort because I think it should only be for sorting and not general ordering (e.g. I think the <, >, <=, and >= operators should continue to only accept numbers, not other sortable types like strings and booleans). - As for Encode and Decode...to put it mildly, they are exciting. ### Encode and Decode -[serde](https://docs.serde.rs/serde/) is among the most widely used Rust crates in the world - maybe the absolute most. It's for **ser**ializing and **de**serializing; hence, **serde**. +[serde](https://docs.serde.rs/serde/) is among the most widely used Rust crates in the world - maybe the absolute most. It's for **ser**ializing and **de**serializing; hence, **serde**. The way it works is that it provides `Serializable` and `Deserializable` traits that you can derive for your types (e.g. for your User type), as well as `Serializer` and `Deserializer` traits that anyone can define for their encoding formats (e.g. a JSON serializer). - [Putting these together](https://github.com/serde-rs/json#parsing-json-as-strongly-typed-data-structures), I can add `#[deriving(Serialiable, Deserializable)]` to my struct User definition, and then run something like `let user: User = serde_json::from_str(json)?` to turn my JSON into a User while handling failed decoding along the way via a `Result`. - Having spent a lot of time teaching JSON decoders to beginning Elm programmers, I can confidently say this seems massively easier for beginners to learn - even if it means they will abruptly have a lot to learn on the day where they want to do some more advanced decoding. It's also much more concise. - In the Abilities world, we can take this a step further than Rust does. We can have `Encode` and `Decode` as builtin abilities (and then also `Encoder` and `Decoder`, except they work like Serializers and Deserializers do in serde; you have an Encoder or Decoder for a particular encoding - e.g. JSON or XML - rather than for the value you want to encode or decode), and we can have the compiler automatically define them when possible, just like it does for `Eq` and the others. - This would mean that in Roc you could do, without any setup other than importing a package to get a generic **Json.decoder**, the following: ```coffee @@ -281,27 +253,24 @@ result = Decode.decode Json.decoder jsonStr So it would be like serde in Rust, except that - like with Elm records - you wouldn't even need to mark your User as deriving Encode and Decode; those abilities would already be there by default, just like `Eq`, `Hash`, and `Sort`. - This would solve [Problem #3](#problem-3-decoders-are-still-hard-to-learn), eliminating the need for a beginner curriculum to include the one technique I've seen beginning Elm programmers struggle the most to learn. That's a very big deal to me! I don't know whether decoding serialized data will be as common in Roc as it is in Elm, but I certainly expect it to come up often. - Other nice things about this design: - -- Since Encode and Decode are builtins, no packages need to depend on anything to make use of them. In Rust, it's currently a bit awkward that all packages that want to offer serializability have to depend on serde; it has become a nearly ubiquitous dependency in the Cargo ecosystem. By making it a builtin, Roc can avoid that problem. -- Since Encode and Decode are agnostic to the actual encoding format, anyone can write a new Encoder and Decoder for whatever their new format is (e.g. XSON, the format that looks at XML and JSON and says "why not both?" - which I just made up) and have every serializable Roc type across the entire ecosystem instantly able to be serialized to/from that format. -- This design still allows for evolving a default decoder into a bespoke decoder that can cover the same use cases that elm/json does (and a potentially very similar API). - +- Since Encode and Decode are builtins, no packages need to depend on anything to make use of them. In Rust, it's currently a bit awkward that all packages that want to offer serializability have to depend on serde; it has become a nearly ubiquitous dependency in the Cargo ecosystem. By making it a builtin, Roc can avoid that problem. +- Since Encode and Decode are agnostic to the actual encoding format, anyone can write a new Encoder and Decoder for whatever their new format is (e.g. XSON, the format that looks at XML and JSON and says "why not both?" - which I just made up) and have every serializable Roc type across the entire ecosystem instantly able to be serialized to/from that format. +- This design still allows for evolving a default decoder into a bespoke decoder that can cover the same use cases that elm/json does (and a potentially very similar API). I haven't looked into the details of what the exact design of this system would be, but at a glance it seems like based on the design of abilities and the design of serde, it should work out. (There may always be unexpected issues though!) ## Adding Abilities to a Type -So we've talked about default abilities, and how various builtins would use them. What about custom types? How would I make an actual `Dict` type with its own definition of equality? +So we've talked about default abilities, and how various builtins would use them. What about custom types? How would I make an actual `Dict` type with its own definition of equality? To do that, we need to talk about a change to the language that was originally motivated by abilities, but which ultimately seems like a good change even if abilities weren't a thing. ### Newtypes + Let's suppose Roc no longer has private tags, but does have this syntax: ```coffee @@ -310,7 +279,6 @@ UserId := U64 This declares a new concrete type in scope called `UserId`, which at runtime is a `U64` with no additional overhead. - To create one of these `UserId` values, we put a @ before the type and call it: ```coffee @@ -326,7 +294,6 @@ UserId := U64 Trying to use `@UserId` when a `UserId :=` declaration isn't in scope would give a compiler error. - `@UserId` can also be used in a pattern, to destructure the wrapped `U64`: ```coffee @@ -336,29 +303,26 @@ getU64 = \@UserId u64 -> u64 In this way, `@UserId` can be used almost identically to how private tags work today: call (`@UserId someU64`) to create a wrapped `U64`, and pattern match on `\@UserId someU64 ->` to destructure it. The only difference is that the resulting type is `UserId` instead of `[ @UserId ]`. - Because the `@` prefix syntax can only refer to a newtype declaration that's currently in scope, the newtype's implementation is hidden from other modules by default. (Of course you can still expose the type and functions to work on it.) - This design has a few advantages over private tags: + 1. It's more focused. Wrapper types with hidden implementations are really the exact use case that private tags were designed for; the concept of a union of multiple private tags was never really necessary, and in this world it doesn't even exist. 2. It means there's just one "tags" concept, just like there's one "records" concept. No more "global tags and private tags" split. 3. The `UserId := U64` declaration is more concise than the private tag equivalent of `UserId : [ @UserId U64 ]`, and it speeds up type checking because there would be (many) fewer type aliases for the compiler to resolve. 4. It enables traditional phantom types, which Roc currently lacks - e.g. -`Quantity count units := count` -in Roc would make units a phantom type like in this Elm declaration: -`type Quantity count units = Quantity count` - + `Quantity count units := count` + in Roc would make units a phantom type like in this Elm declaration: + `type Quantity count units = Quantity count` Even considered completely separately from Abilities, this "newtypes" design seems like a better design than private tags. ### Newtypes and Abilities -Another advantage the newtypes design has over private tags is that it offers a natural place to declare what abilities a type has. +Another advantage the newtypes design has over private tags is that it offers a natural place to declare what abilities a type has. With private tags, this isn't really possible because I can use @Foo in multiple different places in the same module, with multiple different payload arities and types - and even if I use a type alias to give it a shorter name, that type alias is still just an alias; it can't alter the characteristics of the type it's referring to. With the newtypes design, I can refer to a specific concrete type, and not just an alias of it - meaning I actually can alter its characteristics. - As an example, let's make a newtype declaration for Dict, and once again ignore the internal structure of the storage field for now: ```coffee @@ -367,7 +331,6 @@ Dict k v := { storage : … } This lets us construct a Dict by calling `@Dict { storage }` and destructure it similarly. - As discussed earlier, one problem with creating custom data structures like this in today's Roc is that `==` doesn't necessarily do the right thing. Here's a way to solve this issue: ```coffee @@ -384,13 +347,12 @@ isNotEq : Dict k v, Dict k v -> Bool In this `Eq { isEq, isNotEq }` declaration, I'm saying that `isEq` and `isNotEq` are functions already in scope. I could also choose different names using record literal syntax, e.g. `Eq { isEq: dictIsEq, isNotEq: dictIsNotEq }` - the relevant part is that I'm specifying the names of the functions (which must also be in scope) which specify how `Eq` for Dict should work. - Now that I've specified this, when I use `==` on two `Dict` values, this `isEq` function will get run instead of the default `==` implementation. This solves [Problem #3](#problem-3-decoders-are-still-hard-to-learn)! I can also write something like has `Num` and provide the relevant functions to obtain a unit-ful number type - which solves [Problem #2](#problem-2-custom-number-types-cant-use-arithmetic-operators). ### Default Abilities for Newtypes -By default, if I don't use the has keyword when defining a newtype, Roc will give the type all the default builtin abilities it's eligible to have - so for example, it would get `Eq` and `Hash` by default unless it contains a function, in which case it's not eligible. +By default, if I don't use the has keyword when defining a newtype, Roc will give the type all the default builtin abilities it's eligible to have - so for example, it would get `Eq` and `Hash` by default unless it contains a function, in which case it's not eligible. In this example, because I wrote has, the `Dict` type has `Eq` as well as the other default ones. I could instead use has `only`, which means `Dict` should not have any of the default abilities, and should instead have only the ones I list. @@ -406,10 +368,8 @@ Dict k v := { storage : … } has Using `has` means if new default abilities are later added to the language, `Dict` will get them automatically. This may or may not be desirable, depending on what the ability is; maybe, like equality, it will be wrong by default for `Dict`, and maybe I'll wish I had chosen has `only`. - On the other hand, if everyone uses has `only` everywhere as a precaution, and a new default ability gets added to the language, a staggering amount of collective hours would be spent going around adding it to all the has `only` declarations for `UserId` and such. So a good guideline might be for custom collections like `Dict` to recommend using has `only`, and for thin wrappers like `UserId` to use `has custom`. - Of note, this syntax neatly solves [Problem #5](#problem-5-how-to-specify-functionlessness-in-documentation) - where functionlessness is awkward to talk about in API type diffs and documentation. This is a straightforward way to render the `Dict` type in documentation: ```coffee @@ -420,27 +380,25 @@ Dict k v has only I can immediately see exactly what abilities this type has. The same is true if I used has `custom` or omitted the has clause entirely. API diffs can use this same representation, with a diff like +Eq -Sort to show which abilities were added or removed. ### Encode and Hash -I'm not sure if we actually need separate Hash and Encode abilities. At a high level, hashing is essentially encoding a value as an integer. Since all default types will get Encode anyway, maybe all we need is to have "hashers" be implemented as Encoders. This would mean there's one less default ability in the mix, which would be a nice simplification. +I'm not sure if we actually need separate Hash and Encode abilities. At a high level, hashing is essentially encoding a value as an integer. Since all default types will get Encode anyway, maybe all we need is to have "hashers" be implemented as Encoders. This would mean there's one less default ability in the mix, which would be a nice simplification. However, I'm not sure what the differences are between Rust's Hash trait and Hasher type, and serde's Serializable trait and Serializer types. Maybe there's a relevant difference that would justify having a separate Hash ability. I'm not sure! I figure it's at least worth exploring. - -It might look surprising at first for a `Dict` implemented as a hash map to require that its keys have `Encode`, but I don't think that's a significant downside. +It might look surprising at first for a `Dict` implemented as a hash map to require that its keys have `Encode`, but I don't think that's a significant downside. ### Encode and toStr -Similarly, anyone could write a `toStr` function that works on any type that has `Encode`, by using an Encoder which encodes strings. +Similarly, anyone could write a `toStr` function that works on any type that has `Encode`, by using an Encoder which encodes strings. In Elm, having a general toString function proved error-prone (because it was so flexible it masked type mismatches - at work I saw this cause a production bug!) which was why it was replaced by String.fromInt and String.fromFloat. I had originally planned to do the same in Roc, but Encode would mean that anyone can write a flexible toStr and publish it as a package without acknowledging the potential for masking bugs. - Knowing that there's a 100% chance that would happen eventually, it seems like it would be better to just publish an Encode.str which encodes values as strings, and which can be used like toStr except you have to actually call (`Encode.encode Encode.str value`) instead of `toStr`. This would mean that although it's an option, it's (by design!) less ergonomic than a flexible function like Num.fromStr, which means the path of least resistance (and least error-proneness) is to use `Num.fromStr` instead of this. - One benefit to having something like `Encode.str` available in the language is that it can be nice for logging - e.g. when sending tracing information to a server that only programmers will ever see, not users. That's the only situation where I've ever personally missed the old Elm `toString`. ## Defining New Abilities + Here's how I might have defined Eq if it weren't already a builtin ability: ```coffee @@ -454,22 +412,20 @@ isNotEq : val, val -> Bool where val has Eq ``` There are two steps here: -1. Define what functions Eq has -2. Declare those functions as top-level type annotations with no bodies +1. Define what functions Eq has +2. Declare those functions as top-level type annotations with no bodies Having done both, now if anyone wants to say that another type **has Eq**, that type needs to implement these two functions. I can also expose these functions from this module directly - so for example, if I'm in the Bool module, I can have it do `exposes [ isEq, isNotEq ]`, and now anyone can call `Bool.isEq` and it will run this function (or rather, the implementation of this function on whatever type that **has Eq** which was passed to `Bool.isEq`!) - Within these `isEq` and `isNotEq` functions' types, **has Eq** is allowed even though those functions are part of the definition of what `Eq` means. The compiler detects these and treats them essentially like "Self" in Rust - that is, when I say that my `Dict k v` newtype **has Eq**, its `isEq` implementation will have the type` Dict k v, Dict k v -> Bool` because the compiler will have replaced the val in the `Eq` definition with `Dict k v`. - The compiler knew to do that substitution with **val** because of **val has Eq** in the declaration of `isEq` itself. If `isEq` also had other abilities in its has clause, e.g. **val has Eq, foo has Sort**, it wouldn't do the substitutions with foo because **Sort** is not the name of the ability currently being defined. - For this reason, if you are defining a function on **Eq** (such as **isEq**), and you have more than one type variable which **has Eq**, the result is a compiler error. This would be like trying to have more than one `Self` in Rust! ### Abilities that depend on other abilities + I mentioned earlier that in order to have either Int or Frac, a type must also have the Num ability. You can add those constraints after the **has** keyword, like so: ```coffee @@ -479,70 +435,58 @@ Int has Num, { …functions go here as normal… } Now whenever someone wants to make a newtype which **has Int**, that newtype must also explicitly specify that it **has Num** - otherwise, they'll get a compiler error. Similarly, any function which requires that an argument **has Num** will also accept any type that **has Int**. ### Defining abilities for existing types after the fact -It's conceivable that defining a new ability could support adding that ability to existing types. For example, maybe I make a new ability called Foo, and I want all numbers to have Foo. +It's conceivable that defining a new ability could support adding that ability to existing types. For example, maybe I make a new ability called Foo, and I want all numbers to have Foo. It's too late for me to go back and get Num's newtype declaration to specify has Foo, because Num existed before Foo did! - It's possible that Roc could support a way to do this when defining a new ability. It could say for example `Eq has {...} with [ Num { isEq: numIsEq, … } ]` - However, upon reflection, I think this idea is fatally flawed and we shouldn't do it. - On the positive side, this wouldn't introduce any ambiguity. Because Roc doesn't allow cyclic imports, it's already impossible to define two conflicting definitions for a given ability function (e.g. if I define isEq for numbers when defining Num, then Num must import the module where Eq is defined, meaning I can't possibly have Eq's definition mention Num - or else the module where Eq is defined would have had to import Num as well, creating an import cycle!) so that can't happen. - This also wouldn't necessarily introduce any "you need to import a trait for this to work" compiler errors like we see in Rust. - If I'm passing a newtype named Blah to a function which expects that it **has Baz**, then by virtue of the fact that I have a Blah at all, I must have the module where it's defined already loaded in the current build (maybe not as a direct dependency of my module, but definitely as an indirect dependency). Similarly, because I'm calling a function that **has Baz**, I must also (at least indirectly) have the module where Baz is defined loaded. If both modules are loaded, I will definitely be able to find the function implementation(s) I need in either the one or the other, and because Roc wouldn't support orphan instances, I don't need to check any other modules. - However, this can cause some serious problems. Once I've done this, now the module where the type is defined can never import the module where the ability is defined. What if the author of that module wants to define that a different type defined in that module has this ability? Tough luck; can't import the ability module, because that would create an import cycle. Gotta move that type out of that module, even if that would create other problems. - This is even worse if the type and the ability are in different packages; now your entire package can't even depend on the package where the ability is defined! What if the reason the author of the ability added it to that other type was just to avoid having to coordinate with the author of the other package (or just to save them some time)? Now they've locked that author out from controlling their own type! - From this point, even if both authors coordinate, the only way to permit the author of the type to take back control over the implementation of that ability on that type is if the ability author releases a breaking change of that package which drops the ability from the type - so that the author of the type can finally import it without causing a cyclic dependency. I want to incentivize strong backwards compatibility commitments for package authors once their APIs have settled, and this feature would make such commitments unworkable. - All of this makes me think that "if you want a type to have the ability you're defining, you should coordinate with that author" is the best policy to encourage, and in that world, the feature makes no sense except perhaps in the very specific case of builtin types (which necessarily can't depend on packages). Since there are a (small) finite number of those, it seems plausible that the ability author can do one-off special-case workarounds for those instead of needing a separate language feature. ### Abilities for Editor-Specific Code + I don't know exactly what the API for editor plugins should be yet, but they do have some characteristics that are important: - * Making or modifying editor plugins should be so easy, basically everyone does it. This means that code for editor plugins should be written in normal Roc, and the API should have a shallow learning curve. - * Editor plugins should ship with packages (or even just modules within a local project), but should have no impact on runtime performance of those modules/packages. So it's located there, but can't affect the surrounding code. - * There's more than one way to integrate with the editor. For example: - * You can add entries to context menus for certain types - * You can override the default way a type would be rendered in the editor (e.g. an expando for a custom collection) - * You can make big, interactive integrations like a [regex explorer](https://www.youtube.com/watch?v=ZnYa99QoznE&t=6105s) +- Making or modifying editor plugins should be so easy, basically everyone does it. This means that code for editor plugins should be written in normal Roc, and the API should have a shallow learning curve. +- Editor plugins should ship with packages (or even just modules within a local project), but should have no impact on runtime performance of those modules/packages. So it's located there, but can't affect the surrounding code. +- There's more than one way to integrate with the editor. For example: +- You can add entries to context menus for certain types +- You can override the default way a type would be rendered in the editor (e.g. an expando for a custom collection) +- You can make big, interactive integrations like a [regex explorer](https://www.youtube.com/watch?v=ZnYa99QoznE&t=6105s) Abilities offer a nice way to address all of these. - * They can ship with modules and packages without affecting runtime performance. They describe a new ability for a type (namely, an editor integration for that type), but as long as no production code uses it, runtime performance is unaffected - they're just functions that never get called, and won't even be present in the final optimized binary. - * Since abilities are used elsewhere in the language, there's nothing editor-specific to learn other than the APIs themselves (which is unavoidable), so the learning curve for how to add editor plugins is minimal: just declare that your newtype has a particular ability, and the editor will pick up on it. - * Since any given type can have multiple abilities, the different ways to integrate with the editor can too. There can be one ability for adding context menu items, another for specifying how the type renders, etc. +- They can ship with modules and packages without affecting runtime performance. They describe a new ability for a type (namely, an editor integration for that type), but as long as no production code uses it, runtime performance is unaffected - they're just functions that never get called, and won't even be present in the final optimized binary. +- Since abilities are used elsewhere in the language, there's nothing editor-specific to learn other than the APIs themselves (which is unavoidable), so the learning curve for how to add editor plugins is minimal: just declare that your newtype has a particular ability, and the editor will pick up on it. +- Since any given type can have multiple abilities, the different ways to integrate with the editor can too. There can be one ability for adding context menu items, another for specifying how the type renders, etc. In this way, abilities solve [problem #6](#problem-6-no-nice-way-to-specify-editor-specific-code). ### Avoiding the Classification Trap -Although I think custom user-defined abilities are worth having in the language because they address [Problem #7](#problem-7-record-of-function-passing), I hope they are used rarely in practice. +Although I think custom user-defined abilities are worth having in the language because they address [Problem #7](#problem-7-record-of-function-passing), I hope they are used rarely in practice. -I chose the name "ability" rather than like Trait or Typeclass because I don't want to encourage *classification* - that is, using the language feature to spend a bunch of time thinking about how to classify types by what they "are." - +I chose the name "ability" rather than like Trait or Typeclass because I don't want to encourage _classification_ - that is, using the language feature to spend a bunch of time thinking about how to classify types by what they "are." This seems to be a common exercise in statically typed languages with classes; see for example the well-known introductory example "`a Bicycle is a Vehicle`" which to me is primarily teaching students how to waste time adding complexity to their code bases for the satisfaction of classifying things, and no practical benefit. - (This happens in FP too; I doubt [Semiring](https://pursuit.purescript.org/packages/purescript-prelude/5.0.1/docs/Data.Semiring) ends up in a standard library because people kept opening issues saying they were unable to write some really valuable production code without it. A more likely history of that design decision is that a semiring is the mathematically proper way to `classify` those particular `types`, and `typeclasses` encourage classifying types right there in the name.) - In my view, type classification is a tempting but ultimately counterproductive exercise that puts a tax on a community which grows linearly with the size of that community: once enough people start doing it, everyone becomes under pressure to do the same, lest their code look suspiciously under-classified. I don't want this to happen in Roc. - -Hopefully the name "abilities" will frame the feature as giving a type a new ability and nothing more. It's not about saying what the type *is*, but rather what you can do with it. +Hopefully the name "abilities" will frame the feature as giving a type a new ability and nothing more. It's not about saying what the type _is_, but rather what you can do with it. From 02bc54292fc4f76896d00e34ab0d59dcb1ff5a1c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:15:00 -0500 Subject: [PATCH 35/80] Update fmt tests to not use Nat --- crates/compiler/test_syntax/tests/test_fmt.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/crates/compiler/test_syntax/tests/test_fmt.rs b/crates/compiler/test_syntax/tests/test_fmt.rs index 3e26b04de79..ff51b9c3fd8 100644 --- a/crates/compiler/test_syntax/tests/test_fmt.rs +++ b/crates/compiler/test_syntax/tests/test_fmt.rs @@ -2434,7 +2434,7 @@ mod test_fmt { r" foo : Str, - Nat + U64 -> Bool foo @@ -2444,7 +2444,7 @@ mod test_fmt { expr_formats_same(indoc!( r" foo : - Str, Int, Nat -> Bool + Str, Int, U64 -> Bool foo " @@ -2455,7 +2455,7 @@ mod test_fmt { r" foo : Str, - Nat -> Bool + U64 -> Bool foo " @@ -2464,7 +2464,7 @@ mod test_fmt { r" foo : Str, - Nat + U64 -> Bool foo @@ -2478,7 +2478,7 @@ mod test_fmt { foo : Str, - Nat + U64 -> Bool @@ -2489,7 +2489,7 @@ mod test_fmt { r" foo : Str, - Nat + U64 -> Bool foo @@ -2502,7 +2502,7 @@ mod test_fmt { r" foo : - Str, Nat -> Bool + Str, U64 -> Bool foo " @@ -2510,7 +2510,7 @@ mod test_fmt { indoc!( r" foo : - Str, Nat -> Bool + Str, U64 -> Bool foo " @@ -5618,9 +5618,9 @@ mod test_fmt { r" Dict k v := { metadata : List I8, - dataIndices : List Nat, + dataIndices : List U64, data : List (T k v), - size : Nat, + size : U64, } where k implements Hash & Eq a @@ -6010,11 +6010,11 @@ mod test_fmt { r" when l1 is [ - .. + .. as rest ] - as + as l2 -> f rest From c4497f2c1ceed972eaac49df6088adaeb54617a9 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:05:52 -0500 Subject: [PATCH 36/80] Remove Nat from Num --- crates/compiler/builtins/roc/Num.roc | 1 - crates/compiler/can/src/num.rs | 1 - crates/compiler/derive_key/src/decoding.rs | 1 - crates/compiler/derive_key/src/encoding.rs | 1 - crates/compiler/derive_key/src/inspect.rs | 1 - crates/compiler/module/src/symbol.rs | 17 +++++++---------- crates/compiler/mono/src/layout.rs | 11 ----------- crates/compiler/types/src/num.rs | 12 +----------- crates/compiler/types/src/pretty_print.rs | 1 - crates/compiler/types/src/subs.rs | 1 - crates/compiler/types/src/types.rs | 1 - crates/compiler/uitest/tests/solve/to_int.txt | 3 +-- crates/compiler/unify/src/unify.rs | 3 --- 13 files changed, 9 insertions(+), 45 deletions(-) diff --git a/crates/compiler/builtins/roc/Num.roc b/crates/compiler/builtins/roc/Num.roc index 85cbefc283d..407ae694eeb 100644 --- a/crates/compiler/builtins/roc/Num.roc +++ b/crates/compiler/builtins/roc/Num.roc @@ -25,7 +25,6 @@ interface Num Unsigned32, Unsigned16, Unsigned8, - Nat, Dec, F64, F32, diff --git a/crates/compiler/can/src/num.rs b/crates/compiler/can/src/num.rs index 6efa4d3805a..9f9b3726de2 100644 --- a/crates/compiler/can/src/num.rs +++ b/crates/compiler/can/src/num.rs @@ -198,7 +198,6 @@ fn parse_literal_suffix(num_str: &str) -> (Option, &str) { "i32", ParsedWidth::Int(IntLitWidth::I32) "i64", ParsedWidth::Int(IntLitWidth::I64) "i128", ParsedWidth::Int(IntLitWidth::I128) - "nat", ParsedWidth::Int(IntLitWidth::Nat) "dec", ParsedWidth::Float(FloatWidth::Dec) "f32", ParsedWidth::Float(FloatWidth::F32) "f64", ParsedWidth::Float(FloatWidth::F64) diff --git a/crates/compiler/derive_key/src/decoding.rs b/crates/compiler/derive_key/src/decoding.rs index 509a0bf995a..765f251edcb 100644 --- a/crates/compiler/derive_key/src/decoding.rs +++ b/crates/compiler/derive_key/src/decoding.rs @@ -129,7 +129,6 @@ const fn from_builtin_symbol(symbol: Symbol) -> Option Some(Ok(Immediate(Symbol::DECODE_DEC))), Symbol::NUM_F32 | Symbol::NUM_BINARY32 => Some(Ok(Immediate(Symbol::DECODE_F32))), Symbol::NUM_F64 | Symbol::NUM_BINARY64 => Some(Ok(Immediate(Symbol::DECODE_F64))), - Symbol::NUM_NAT | Symbol::NUM_NATURAL => Some(Err(DeriveError::Underivable)), _ => None, } } diff --git a/crates/compiler/derive_key/src/encoding.rs b/crates/compiler/derive_key/src/encoding.rs index 423941bc7d6..fe2ea5a99ba 100644 --- a/crates/compiler/derive_key/src/encoding.rs +++ b/crates/compiler/derive_key/src/encoding.rs @@ -163,7 +163,6 @@ const fn from_builtin_symbol(symbol: Symbol) -> Option Some(Ok(Immediate(Symbol::ENCODE_DEC))), Symbol::NUM_F32 | Symbol::NUM_BINARY32 => Some(Ok(Immediate(Symbol::ENCODE_F32))), Symbol::NUM_F64 | Symbol::NUM_BINARY64 => Some(Ok(Immediate(Symbol::ENCODE_F64))), - Symbol::NUM_NAT | Symbol::NUM_NATURAL => Some(Err(DeriveError::Underivable)), _ => None, } } diff --git a/crates/compiler/derive_key/src/inspect.rs b/crates/compiler/derive_key/src/inspect.rs index a796efc63d0..e1b842a3549 100644 --- a/crates/compiler/derive_key/src/inspect.rs +++ b/crates/compiler/derive_key/src/inspect.rs @@ -204,7 +204,6 @@ impl FlatInspectable { Symbol::NUM_DEC | Symbol::NUM_DECIMAL => Some(Immediate(Symbol::INSPECT_DEC)), Symbol::NUM_F32 | Symbol::NUM_BINARY32 => Some(Immediate(Symbol::INSPECT_F32)), Symbol::NUM_F64 | Symbol::NUM_BINARY64 => Some(Immediate(Symbol::INSPECT_F64)), - Symbol::NUM_NAT | Symbol::NUM_NATURAL => Some(Immediate(Symbol::INSPECT_NAT)), _ => None, } } diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 005f3ad5c73..30a0e4a65d9 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1192,9 +1192,9 @@ define_builtins! { 80 NUM_MUL_SATURATED: "mulSaturated" 81 NUM_INT: "Int" exposed_type=true 82 NUM_FRAC: "Frac" exposed_type=true - 83 NUM_NATURAL: "Natural" exposed_type=true - 84 NUM_NAT: "Nat" exposed_type=true - 85 NUM_INT_CAST: "intCast" + 83 NUM_E: "e" + 84 NUM_PI: "pi" + 85 NUM_TAU: "tau" 86 NUM_IS_MULTIPLE_OF: "isMultipleOf" 87 NUM_DECIMAL: "Decimal" exposed_type=true 88 NUM_DEC: "Dec" exposed_type=true // the Num.Dectype alias @@ -1270,11 +1270,9 @@ define_builtins! { 158 NUM_IS_FINITE: "isFinite" 159 NUM_MIN: "min" 160 NUM_MAX: "max" - 161 NUM_E: "e" - 162 NUM_PI: "pi" - 163 NUM_TAU: "tau" - 164 NUM_BITWISE_NOT: "bitwiseNot" - 165 NUM_IS_APPROX_EQ: "isApproxEq" + 161 NUM_BITWISE_NOT: "bitwiseNot" + 162 NUM_INT_CAST: "intCast" + 163 NUM_IS_APPROX_EQ: "isApproxEq" } 4 BOOL: "Bool" => { 0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias @@ -1631,8 +1629,7 @@ define_builtins! { 30 INSPECT_CUSTOM: "custom" 31 INSPECT_APPLY: "apply" 32 INSPECT_TO_INSPECTOR: "toInspector" - 33 INSPECT_NAT: "nat" - 34 INSPECT_TO_STR: "toStr" + 33 INSPECT_TO_STR: "toStr" } 15 JSON: "TotallyNotJson" => { 0 JSON_JSON: "TotallyNotJson" diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index 6056f3e98db..d7dead893ae 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -574,12 +574,6 @@ impl<'a> RawFunctionLayout<'a> { cacheable(Ok(Self::ZeroArgumentThunk(Layout::F32))) } - // Nat - Alias(Symbol::NUM_NAT, args, _, _) => { - debug_assert!(args.is_empty()); - cacheable(Ok(Self::ZeroArgumentThunk(Layout::usize(env.target_info)))) - } - Alias(Symbol::INSPECT_ELEM_WALKER | Symbol::INSPECT_KEY_VAL_WALKER, _, var, _) => Self::from_var(env, var), Alias(symbol, _, var, _) if symbol.is_builtin() => { @@ -2505,10 +2499,6 @@ impl<'a> Layout<'a> { match symbol { Symbol::NUM_DECIMAL => cacheable(Ok(Layout::DEC)), - Symbol::NUM_NAT | Symbol::NUM_NATURAL => { - cacheable(Ok(Layout::usize(env.target_info))) - } - Symbol::NUM_NUM | Symbol::NUM_INT | Symbol::NUM_INTEGER if is_unresolved_var(env.subs, actual_var) => { @@ -3054,7 +3044,6 @@ impl<'a> Layout<'a> { I32 => Layout::I32, I64 => Layout::I64, I128 => Layout::I128, - Nat => Layout::usize(target_info), // f32 int literal bounded by +/- 2^24, so fit it into an i32 F32 => Layout::F32, // f64 int literal bounded by +/- 2^53, so fit it into an i32 diff --git a/crates/compiler/types/src/num.rs b/crates/compiler/types/src/num.rs index 83ed0a429a2..7f28500c13b 100644 --- a/crates/compiler/types/src/num.rs +++ b/crates/compiler/types/src/num.rs @@ -177,7 +177,6 @@ pub enum IntLitWidth { I32, I64, I128, - Nat, // An int literal can be promoted to an f32/f64/Dec if appropriate. The respective widths for // integers that can be stored in these float types without losing precision are: // f32: +/- 2^24 @@ -204,8 +203,6 @@ impl IntLitWidth { I32 => (Signed, 32), I64 => (Signed, 64), I128 => (Signed, 128), - // TODO: Nat is target specific! - Nat => (Unsigned, 64), F32 => (Signed, 24), F64 => (Signed, 53), Dec => (Signed, 128), @@ -229,7 +226,6 @@ impl IntLitWidth { I32 => "I32", I64 => "I64", I128 => "I128", - Nat => "Nat", F32 => "F32", F64 => "F64", Dec => "Dec", @@ -249,8 +245,6 @@ impl IntLitWidth { I32 => i32::MAX as u128, I64 => i64::MAX as u128, I128 => i128::MAX as u128, - // TODO: this is target specific! - Nat => u64::MAX as u128, // Max int value without losing precision: 2^24 F32 => 16_777_216, // Max int value without losing precision: 2^53 @@ -263,7 +257,7 @@ impl IntLitWidth { pub fn min_value(&self) -> i128 { use IntLitWidth::*; match self { - U8 | U16 | U32 | U64 | U128 | Nat => 0, + U8 | U16 | U32 | U64 | U128 => 0, I8 => i8::MIN as i128, I16 => i16::MIN as i128, I32 => i32::MIN as i128, @@ -330,7 +324,6 @@ impl IntLitWidth { IntLitWidth::I32 => Symbol::NUM_I32, IntLitWidth::I64 => Symbol::NUM_I64, IntLitWidth::I128 => Symbol::NUM_I128, - IntLitWidth::Nat => Symbol::NUM_NAT, IntLitWidth::F32 => Symbol::NUM_F32, IntLitWidth::F64 => Symbol::NUM_F64, IntLitWidth::Dec => Symbol::NUM_DEC, @@ -415,7 +408,6 @@ pub const fn int_lit_width_to_variable(w: IntLitWidth) -> Variable { IntLitWidth::I32 => Variable::I32, IntLitWidth::I64 => Variable::I64, IntLitWidth::I128 => Variable::I128, - IntLitWidth::Nat => Variable::NAT, IntLitWidth::F32 => Variable::F32, IntLitWidth::F64 => Variable::F64, IntLitWidth::Dec => Variable::DEC, @@ -440,7 +432,6 @@ const ALL_INT_OR_FLOAT_VARIABLES: &[Variable] = &[ Variable::U32, Variable::F64, Variable::I64, - Variable::NAT, // FIXME: Nat's order here depends on the target Variable::U64, Variable::I128, Variable::DEC, @@ -466,7 +457,6 @@ const ALL_INT_VARIABLES: &[Variable] = &[ Variable::I32, Variable::U32, Variable::I64, - Variable::NAT, // FIXME: Nat's order here depends on the target Variable::U64, Variable::I128, Variable::U128, diff --git a/crates/compiler/types/src/pretty_print.rs b/crates/compiler/types/src/pretty_print.rs index a4f4d85d7af..01ff370bb52 100644 --- a/crates/compiler/types/src/pretty_print.rs +++ b/crates/compiler/types/src/pretty_print.rs @@ -957,7 +957,6 @@ fn write_integer<'a>( "I32", Symbol::NUM_SIGNED32 "I64", Symbol::NUM_SIGNED64 "I128", Symbol::NUM_SIGNED128 - "Nat", Symbol::NUM_NATURAL } } diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs index 403f3ac8e4e..12077c606a3 100644 --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -1592,7 +1592,6 @@ fn define_integer_types(subs: &mut Subs) { integer_type( subs, - Symbol::NUM_NATURAL, Symbol::NUM_NAT, Variable::NATURAL, Variable::INTEGER_NATURAL, diff --git a/crates/compiler/types/src/types.rs b/crates/compiler/types/src/types.rs index 6310d9c628c..d04d1f96905 100644 --- a/crates/compiler/types/src/types.rs +++ b/crates/compiler/types/src/types.rs @@ -1553,7 +1553,6 @@ mod debug_types { U32 | I32 => "32", U64 | I64 => "64", U128 | I128 => "128", - Nat => "Nat", F32 => "F32", F64 => "F64", Dec => "Dec", diff --git a/crates/compiler/uitest/tests/solve/to_int.txt b/crates/compiler/uitest/tests/solve/to_int.txt index bcf87a847f7..d965bdbe07f 100644 --- a/crates/compiler/uitest/tests/solve/to_int.txt +++ b/crates/compiler/uitest/tests/solve/to_int.txt @@ -7,7 +7,6 @@ entry = toI32: Num.toI32, toI64: Num.toI64, toI128: Num.toI128, - toNat: Num.toNat, toU8: Num.toU8, toU16: Num.toU16, toU32: Num.toU32, @@ -16,4 +15,4 @@ entry = } main = entry -# ^^^^^ { toI128 : Int * -[[Num.toI128(125)]]-> I128, toI16 : Int w_a -[[Num.toI16(119)]]-> I16, toI32 : Int w_b -[[Num.toI32(121)]]-> I32, toI64 : Int w_c -[[Num.toI64(123)]]-> I64, toI8 : Int w_d -[[Num.toI8(117)]]-> I8, toNat : Int w_e -[[Num.toNat(137)]]-> Nat, toU128 : Int w_f -[[Num.toU128(135)]]-> U128, toU16 : Int w_g -[[Num.toU16(129)]]-> U16, toU32 : Int w_h -[[Num.toU32(131)]]-> U32, toU64 : Int w_i -[[Num.toU64(133)]]-> U64, toU8 : Int w_j -[[Num.toU8(127)]]-> U8 } +# ^^^^^ { toI128 : Int * -[[Num.toI128(125)]]-> I128, toI16 : Int w_a -[[Num.toI16(119)]]-> I16, toI32 : Int w_b -[[Num.toI32(121)]]-> I32, toI64 : Int w_c -[[Num.toI64(123)]]-> I64, toI8 : Int w_d -[[Num.toI8(117)]]-> I8, toU128 : Int w_f -[[Num.toU128(135)]]-> U128, toU16 : Int w_g -[[Num.toU16(129)]]-> U16, toU32 : Int w_h -[[Num.toU32(131)]]-> U32, toU64 : Int w_i -[[Num.toU64(133)]]-> U64, toU8 : Int w_j -[[Num.toU8(127)]]-> U8 } diff --git a/crates/compiler/unify/src/unify.rs b/crates/compiler/unify/src/unify.rs index 32441e3b522..ef81cd0c90a 100644 --- a/crates/compiler/unify/src/unify.rs +++ b/crates/compiler/unify/src/unify.rs @@ -637,9 +637,6 @@ fn check_and_merge_valid_range( Symbol::NUM_I64 | Symbol::NUM_SIGNED64 => { merge_if!(range.contains_int_width(IntLitWidth::I64)) } - Symbol::NUM_NAT | Symbol::NUM_NATURAL => { - merge_if!(range.contains_int_width(IntLitWidth::Nat)) - } Symbol::NUM_U64 | Symbol::NUM_UNSIGNED64 => { merge_if!(range.contains_int_width(IntLitWidth::U64)) } From 8f82bc38c0ca875bdf88ab5421322996b1ba187e Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 22 Jan 2024 15:26:05 -0500 Subject: [PATCH 37/80] Remove Nat from tests --- crates/compiler/test_gen/src/gen_num.rs | 8 ++++---- crates/compiler/test_mono/src/tests.rs | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index 9418599cf32..06a64a3ad68 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -19,7 +19,7 @@ fn nat_alias() { assert_evals_to!( indoc!( r" - i : Num.Nat + i : Num.U64 i = 1 i @@ -3375,7 +3375,7 @@ fn monomorphized_ints() { r" x = 100 - f : U8, U32 -> Nat + f : U8, U32 -> U64 f = \_, _ -> 18 f x x @@ -3394,7 +3394,7 @@ fn monomorphized_floats() { r" x = 100.0 - f : F32, F64 -> Nat + f : F32, F64 -> U64 f = \_, _ -> 18 f x x @@ -3411,7 +3411,7 @@ fn monomorphized_ints_names_dont_conflict() { assert_evals_to!( indoc!( r" - f : U8 -> Nat + f : U8 -> U64 f = \_ -> 9 x = n = 100 diff --git a/crates/compiler/test_mono/src/tests.rs b/crates/compiler/test_mono/src/tests.rs index ff6478670de..409de84f180 100644 --- a/crates/compiler/test_mono/src/tests.rs +++ b/crates/compiler/test_mono/src/tests.rs @@ -1190,7 +1190,7 @@ fn monomorphized_ints() { main = x = 100 - f : U8, U32 -> Nat + f : U8, U32 -> U64 f = \_, _ -> 18 f x x @@ -1207,7 +1207,7 @@ fn monomorphized_floats() { main = x = 100.0 - f : F32, F64 -> Nat + f : F32, F64 -> U64 f = \_, _ -> 18 f x x @@ -1229,10 +1229,10 @@ fn monomorphized_ints_aliased() { f = \_, _ -> 1 - f1 : U8, U32 -> Nat + f1 : U8, U32 -> U64 f1 = f - f2 : U32, U8 -> Nat + f2 : U32, U8 -> U64 f2 = f f1 w1 w2 + f2 w1 w2 @@ -1265,7 +1265,7 @@ fn monomorphized_tag_with_aliased_args() { b = Bool.false c = Bool.false a = A b c - f : [A Bool Bool] -> Nat + f : [A Bool Bool] -> U64 f = \_ -> 1 f a "# @@ -1281,7 +1281,7 @@ fn monomorphized_list() { main = l = \{} -> [1, 2, 3] - f : List U8, List U16 -> Nat + f : List U8, List U16 -> U64 f = \_, _ -> 18 f (l {}) (l {}) @@ -3050,7 +3050,7 @@ fn specialize_after_match() { LinkedList a : [Cons a (LinkedList a), Nil] - longestLinkedList : LinkedList a, LinkedList a -> Nat + longestLinkedList : LinkedList a, LinkedList a -> U64 longestLinkedList = \listA, listB -> when listA is Nil -> linkedListLength listB Cons a aa -> when listB is @@ -3062,7 +3062,7 @@ fn specialize_after_match() { then lengthA else lengthB - linkedListLength : LinkedList a -> Nat + linkedListLength : LinkedList a -> U64 linkedListLength = \list -> when list is Nil -> 0 Cons _ rest -> 1 + linkedListLength rest @@ -3092,7 +3092,7 @@ fn record_update() { r#" app "test" provides [main] to "./platform" main = f {a: [], b: [], c:[]} - f : {a: List Nat, b: List Nat, c: List Nat} -> {a: List Nat, b: List Nat, c: List Nat} + f : {a: List U64, b: List U64, c: List U64} -> {a: List U64, b: List U64, c: List U64} f = \record -> {record & a: List.set record.a 7 7, b: List.set record.b 8 8} "# ) @@ -3452,7 +3452,7 @@ fn inspect_derived_dict() { fn issue_6196() { indoc!( r#" - nth : List a, Nat -> Result a [OutOfBounds] + nth : List a, U64 -> Result a [OutOfBounds] nth = \l, i -> when (l, i) is ([], _) -> Err OutOfBounds From bf660ad09416df5accd3ddb3089a71104b8f6b54 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 23 Jan 2024 11:37:15 -0500 Subject: [PATCH 38/80] Remove Nat from tests --- crates/compiler/load/tests/test_reporting.rs | 6 +-- crates/compiler/solve/tests/solve_expr.rs | 18 +-------- crates/compiler/test_gen/src/gen_num.rs | 2 - ...number_literal_suffixes.expr.formatted.roc | 3 -- .../number_literal_suffixes.expr.result-ast | 38 ------------------- .../pass/number_literal_suffixes.expr.roc | 3 -- 6 files changed, 4 insertions(+), 66 deletions(-) diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs index 3972e9e6230..267a258abdc 100644 --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -7107,7 +7107,6 @@ In roc, functions are always written as a lambda, like{} 1, "i32", mismatched_suffix_i32 1, "i64", mismatched_suffix_i64 1, "i128", mismatched_suffix_i128 - 1, "nat", mismatched_suffix_nat 1, "dec", mismatched_suffix_dec 1, "f32", mismatched_suffix_f32 1, "f64", mismatched_suffix_f64 @@ -7177,7 +7176,6 @@ In roc, functions are always written as a lambda, like{} 1, "i32", mismatched_suffix_i32_pattern 1, "i64", mismatched_suffix_i64_pattern 1, "i128", mismatched_suffix_i128_pattern - 1, "nat", mismatched_suffix_nat_pattern 1, "dec", mismatched_suffix_dec_pattern 1, "f32", mismatched_suffix_f32_pattern 1, "f64", mismatched_suffix_f64_pattern @@ -11313,7 +11311,7 @@ In roc, functions are always written as a lambda, like{} custom_type_conflicts_with_builtin, indoc!( r#" - Nat := [ S Nat, Z ] + Dec := [ S Dec, Z ] "" "# @@ -11323,7 +11321,7 @@ In roc, functions are always written as a lambda, like{} This opaque type has the same name as a builtin: - 4│ Nat := [ S Nat, Z ] + 4│ Dec := [ S Dec, Z ] ^^^^^^^^^^^^^^^^^^^ All builtin opaque types are in scope by default, so I need this diff --git a/crates/compiler/solve/tests/solve_expr.rs b/crates/compiler/solve/tests/solve_expr.rs index b4d23dc435c..5378a1a8c21 100644 --- a/crates/compiler/solve/tests/solve_expr.rs +++ b/crates/compiler/solve/tests/solve_expr.rs @@ -4981,8 +4981,6 @@ mod solve_expr { i64: 123i64, i128: 123i128, - nat: 123nat, - bu8: 0b11u8, bu16: 0b11u16, bu32: 0b11u32, @@ -4995,8 +4993,6 @@ mod solve_expr { bi64: 0b11i64, bi128: 0b11i128, - bnat: 0b11nat, - dec: 123.0dec, f32: 123.0f32, f64: 123.0f64, @@ -5007,7 +5003,7 @@ mod solve_expr { } " ), - r"{ bi128 : I128, bi16 : I16, bi32 : I32, bi64 : I64, bi8 : I8, bnat : Nat, bu128 : U128, bu16 : U16, bu32 : U32, bu64 : U64, bu8 : U8, dec : Dec, f32 : F32, f64 : F64, fdec : Dec, ff32 : F32, ff64 : F64, i128 : I128, i16 : I16, i32 : I32, i64 : I64, i8 : I8, nat : Nat, u128 : U128, u16 : U16, u32 : U32, u64 : U64, u8 : U8 }", + r"{ bi128 : I128, bi16 : I16, bi32 : I32, bi64 : I64, bi8 : I8, bu128 : U128, bu16 : U16, bu32 : U32, bu64 : U64, bu8 : U8, dec : Dec, f32 : F32, f64 : F64, fdec : Dec, ff32 : F32, ff64 : F64, i128 : I128, i16 : I16, i32 : I32, i64 : I64, i8 : I8, u128 : U128, u16 : U16, u32 : U32, u64 : U64, u8 : U8 }", ) } @@ -5059,11 +5055,6 @@ mod solve_expr { 123i128 -> n _ -> n), - nat: (\n -> - when n is - 123nat -> n - _ -> n), - bu8: (\n -> when n is 0b11u8 -> n @@ -5106,11 +5097,6 @@ mod solve_expr { 0b11i128 -> n _ -> n), - bnat: (\n -> - when n is - 0b11nat -> n - _ -> n), - dec: (\n -> when n is 123.0dec -> n @@ -5139,7 +5125,7 @@ mod solve_expr { } " ), - r"{ bi128 : I128 -> I128, bi16 : I16 -> I16, bi32 : I32 -> I32, bi64 : I64 -> I64, bi8 : I8 -> I8, bnat : Nat -> Nat, bu128 : U128 -> U128, bu16 : U16 -> U16, bu32 : U32 -> U32, bu64 : U64 -> U64, bu8 : U8 -> U8, dec : Dec -> Dec, f32 : F32 -> F32, f64 : F64 -> F64, fdec : Dec -> Dec, ff32 : F32 -> F32, ff64 : F64 -> F64, i128 : I128 -> I128, i16 : I16 -> I16, i32 : I32 -> I32, i64 : I64 -> I64, i8 : I8 -> I8, nat : Nat -> Nat, u128 : U128 -> U128, u16 : U16 -> U16, u32 : U32 -> U32, u64 : U64 -> U64, u8 : U8 -> U8 }", + r"{ bi128 : I128 -> I128, bi16 : I16 -> I16, bi32 : I32 -> I32, bi64 : I64 -> I64, bi8 : I8 -> I8, bu128 : U128 -> U128, bu16 : U16 -> U16, bu32 : U32 -> U32, bu64 : U64 -> U64, bu8 : U8 -> U8, dec : Dec -> Dec, f32 : F32 -> F32, f64 : F64 -> F64, fdec : Dec -> Dec, ff32 : F32 -> F32, ff64 : F64 -> F64, i128 : I128 -> I128, i16 : I16 -> I16, i32 : I32 -> I32, i64 : I64 -> I64, i8 : I8 -> I8, u128 : U128 -> U128, u16 : U16 -> U16, u32 : U32 -> U32, u64 : U64 -> U64, u8 : U8 -> U8 }", ) } } diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index 06a64a3ad68..78696298e2a 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -2366,7 +2366,6 @@ num_conversion_tests! { to_f32_from_u32, "15u32", 15.0 to_f32_from_u64, "15u64", 15.0 to_f32_from_u128, "15u128", 15.0 - to_f32_from_nat, "15nat", 15.0 to_f32_from_f32, "1.5f32", 1.5 to_f32_from_f64, "1.5f64", 1.5 ) @@ -2381,7 +2380,6 @@ num_conversion_tests! { to_f64_from_u32, "15u32", 15.0 to_f64_from_u64, "15u64", 15.0 to_f64_from_u128, "15u128", 15.0 - to_f64_from_nat, "15nat", 15.0 to_f64_from_f32, "1.5f32", 1.5 to_f64_from_f64, "1.5f64", 1.5 ) diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.formatted.roc index 8f3f678ccc9..2c1c331116e 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.formatted.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.formatted.roc @@ -9,7 +9,6 @@ i32: 123i32, i64: 123i64, i128: 123i128, - nat: 123nat, dec: 123dec, u8Neg: -123u8, u16Neg: -123u16, @@ -21,7 +20,6 @@ i32Neg: -123i32, i64Neg: -123i64, i128Neg: -123i128, - natNeg: -123nat, decNeg: -123dec, u8Bin: 0b101u8, u16Bin: 0b101u16, @@ -33,5 +31,4 @@ i32Bin: 0b101i32, i64Bin: 0b101i64, i128Bin: 0b101i128, - natBin: 0b101nat, } \ No newline at end of file diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast index 8ee611e8f74..c67fcc468a4 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast @@ -121,18 +121,6 @@ Record( Newline, ], ), - @164-176 SpaceBefore( - RequiredValue( - @164-167 "nat", - [], - @170-176 Num( - "123nat", - ), - ), - [ - Newline, - ], - ), @180-192 SpaceBefore( RequiredValue( @180-183 "dec", @@ -265,18 +253,6 @@ Record( Newline, ], ), - @396-412 SpaceBefore( - RequiredValue( - @396-402 "natNeg", - [], - @405-412 Num( - "-123nat", - ), - ), - [ - Newline, - ], - ), @416-432 SpaceBefore( RequiredValue( @416-422 "decNeg", @@ -429,20 +405,6 @@ Record( Newline, ], ), - @646-663 SpaceBefore( - RequiredValue( - @646-652 "natBin", - [], - @655-663 NonBase10Int { - string: "101nat", - base: Binary, - is_negative: false, - }, - ), - [ - Newline, - ], - ), ], final_comments: [ Newline, diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.roc b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.roc index e76387bf3c5..f2714e384f6 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.roc +++ b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.roc @@ -9,7 +9,6 @@ i32: 123i32, i64: 123i64, i128: 123i128, - nat: 123nat, dec: 123dec, u8Neg: -123u8, u16Neg: -123u16, @@ -21,7 +20,6 @@ i32Neg: -123i32, i64Neg: -123i64, i128Neg: -123i128, - natNeg: -123nat, decNeg: -123dec, u8Bin: 0b101u8, u16Bin: 0b101u16, @@ -33,5 +31,4 @@ i32Bin: 0b101i32, i64Bin: 0b101i64, i128Bin: 0b101i128, - natBin: 0b101nat, } From ef634ba8e4014c5d2076c5c36c291710a77fb938 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 23 Jan 2024 11:37:51 -0500 Subject: [PATCH 39/80] Remove Nat from documentation --- crates/compiler/builtins/roc/Num.roc | 43 ++-------------------------- www/content/plans.md | 6 ---- www/content/tutorial.md | 26 +++++++++++++++-- 3 files changed, 26 insertions(+), 49 deletions(-) diff --git a/crates/compiler/builtins/roc/Num.roc b/crates/compiler/builtins/roc/Num.roc index 407ae694eeb..6b3b15589f3 100644 --- a/crates/compiler/builtins/roc/Num.roc +++ b/crates/compiler/builtins/roc/Num.roc @@ -192,9 +192,9 @@ interface Num ## a more specific type based on how they're used. ## ## For example, in `(1 + List.len myList)`, the `1` has the type `Num *` at first, -## but because `List.len` returns a `Nat`, the `1` ends up changing from -## `Num *` to the more specific `Nat`, and the expression as a whole -## ends up having the type `Nat`. +## but because `List.len` returns a `U64`, the `1` ends up changing from +## `Num *` to the more specific `U64`, and the expression as a whole +## ends up having the type `U64`. ## ## Sometimes number literals don't become more specific. For example, ## the `Num.toStr` function has the type `Num * -> Str`. This means that @@ -216,7 +216,6 @@ interface Num ## * `215u8` is a `215` value of type [U8] ## * `76.4f32` is a `76.4` value of type [F32] ## * `123.45dec` is a `123.45` value of type [Dec] -## * `12345nat` is a `12345` value of type [Nat] ## ## In practice, these are rarely needed. It's most common to write ## number literals without any suffix. @@ -326,16 +325,6 @@ Num range := range ## | ` (over 340 undecillion) 0` | [U128]| 16 Bytes | ## | ` 340_282_366_920_938_463_463_374_607_431_768_211_455` | | | ## -## Roc also has one variable-size integer type: [Nat]. The size of [Nat] is equal -## to the size of a memory address, which varies by system. For example, when -## compiling for a 64-bit system, [Nat] is the same as [U64]. When compiling for a -## 32-bit system, it's the same as [U32]. -## -## A common use for [Nat] is to store the length ("len" for short) of a -## collection like a [List]. 64-bit systems can represent longer -## lists in memory than 32-bit systems, which is why the length of a list -## is represented as a [Nat] in Roc. -## ## If any operation would result in an [Int] that is either too big ## or too small to fit in that range (e.g. calling `Num.maxI32 + 1`), ## then the operation will *overflow*. When an overflow occurs, the program will crash. @@ -443,18 +432,6 @@ U32 : Num (Integer Unsigned32) U16 : Num (Integer Unsigned16) U8 : Num (Integer Unsigned8) -## A [natural number](https://en.wikipedia.org/wiki/Natural_number) represented -## as a 64-bit unsigned integer on 64-bit systems, a 32-bit unsigned integer -## on 32-bit systems, and so on. -## -## This system-specific size makes it useful for certain data structure -## functions like [List.len], because the number of elements many data structures -## can hold is also system-specific. For example, the maximum number of elements -## a [List] can hold on a 64-bit system fits in a 64-bit unsigned integer, and -## on a 32-bit system it fits in 32-bit unsigned integer. This makes [Nat] a -## good fit for [List.len] regardless of system. -Nat : Num (Integer Natural) - Decimal := [] Binary64 := [] Binary32 := [] @@ -1446,20 +1423,6 @@ toU32 : Int * -> U32 toU64 : Int * -> U64 toU128 : Int * -> U128 -## Converts an [Int] to a [Nat]. If the given number doesn't fit in [Nat], it will be truncated! -## Since [Nat] has a different maximum number depending on the system you're building -## for, this may give a different answer on different systems. -## -## For example, on a 32-bit system, calling `Num.toNat 9_000_000_000` on a 32-bit -## system will return `Num.maxU32` instead of 9 billion, because 9 billion is -## higher than `Num.maxU32` and will not fit in a [Nat] on a 32-bit system. -## -## However, calling `Num.toNat 9_000_000_000` on a 64-bit system will return -## the [Nat] value of 9_000_000_000. This is because on a 64-bit system, [Nat] can -## hold up to `Num.maxU64`, and 9_000_000_000 is lower than `Num.maxU64`. -## -## To convert a [Frac] to a [Nat], first call either `Num.round`, `Num.ceil`, or `Num.floor` -## on it, then call this on the resulting [Int]. toNat : Int * -> Nat ## Converts a [Num] to an [F32]. If the given number can't be precisely represented in an [F32], diff --git a/www/content/plans.md b/www/content/plans.md index dde76d390ba..1495a32c8a7 100644 --- a/www/content/plans.md +++ b/www/content/plans.md @@ -30,12 +30,6 @@ Implementing the very important [module params](https://docs.google.com/document Work has not started on this yet, but we'd like to have the project completed sometime in 2024. -### Removal of `Nat` - -We are removing the `Nat` number type in favour of using `U64` as the default. This will further improve the portability of Roc programs, by removing a potential source of different behaviour across architectures. - -You can track progress in [this PR](https://github.com/roc-lang/roc/pull/5923). - ## Planned Non-Breaking Changes These are planned changes to how things work, which should be backwards-compatible and require no code changes. These won't include bugfixes, just changing something that currently works as designed to have a different design. diff --git a/www/content/tutorial.md b/www/content/tutorial.md index 53926eceb2b..7310e3326b6 100644 --- a/www/content/tutorial.md +++ b/www/content/tutorial.md @@ -1205,7 +1205,7 @@ Following this pattern, the 16 in `I16` means that it's a signed 16-bit integer. Choosing a size depends on your performance needs and the range of numbers you want to represent. Consider: - Larger integer sizes can represent a wider range of numbers. If you absolutely need to represent numbers in a certain range, make sure to pick an integer size that can hold them! -- Smaller integer sizes take up less memory. These savings rarely matter in variables and function arguments, but the sizes of integers that you use in data structures can add up. This can also affect whether those data structures fit in [cache lines](https://en.wikipedia.org/wiki/CPU_cache#Cache_performance), which can easily be a performance bottleneck. +- Smaller integer sizes take up less memory. These savings rarely matters in variables and function arguments, but the sizes of integers that you use in data structures can add up. This can also affect whether those data structures fit in [cache lines](https://en.wikipedia.org/wiki/CPU_cache#Cache_performance), which can easily be a performance bottleneck. - Certain processors work faster on some numeric sizes than others. There isn't even a general rule like "larger numeric sizes run slower" (or the reverse, for that matter) that applies to all processors. In fact, if the CPU is taking too long to run numeric calculations, you may find a performance improvement by experimenting with numeric sizes that are larger than otherwise necessary. However, in practice, doing this typically degrades overall performance, so be careful to measure properly! Here are the different fixed-size integer types that Roc supports: @@ -1221,11 +1221,23 @@ Here are the different fixed-size integer types that Roc supports: | `-9_223_372_036_854_775_808`
`9_223_372_036_854_775_807` | `I64` | | `0`
_(over 18 quintillion)_`18_446_744_073_709_551_615` | `U64` | | `-170_141_183_460_469_231_731_687_303_715_884_105_728`
`170_141_183_460_469_231_731_687_303_715_884_105_727` | `I128` | -| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | + +<<<<<<< HEAD +| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | Roc also has one variable-size integer type: `Nat` (short for "natural number"). The size of `Nat` is equal to the size of a memory address, which varies by system. For example, when compiling for a 64-bit system, `Nat` works the same way as `U64`. When compiling for a 32-bit system, it works the same way as `U32`. Most popular computing devices today are 64-bit, so `Nat` is usually the same as `U64`, but Web Assembly is typically 32-bit - so when running a Roc program built for Web Assembly, `Nat` will work like a `U32` in that program. A common use for `Nat` is to store the length of a collection like a `List`; there's a function `List.len : List * -> Nat` which returns the length of the given list. 64-bit systems can represent longer lists in memory than 32-bit systems can, which is why the length of a list is represented as a `Nat`. +||||||| parent of cda0cfb47 (Remove Nat from documentation) +| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | + +Roc also has one variable-size integer type: `Nat` (short for "natural number"). The size of `Nat` is equal to the size of a memory address, which varies by system. For example, when compiling for a 64-bit system, `Nat` works the same way as `U64`. When compiling for a 32-bit system, it works the same way as `U32`. Most popular computing devices today are 64-bit, so `Nat` is usually the same as `U64`, but Web Assembly is typically 32-bit - so when running a Roc program built for Web Assembly, `Nat` will work like a `U32` in that program. + +# A common use for `Nat` is to store the length of a collection like a `List`; there's a function `List.len : List * -> Nat` which returns the length of the given list. 64-bit systems can represent longer lists in memory than 32-bit systems can, which is why the length of a list is represented as a `Nat`. + +| `0`
_(over 340 undecillion)_`340_282_366_920_938_463_463_374_607_431_768_211_455` | `U128` | + +> > > > > > > cda0cfb47 (Remove Nat from documentation) If any operation would result in an integer that is either too big or too small to fit in that range (e.g. calling `Int.maxI32 + 1`, which adds 1 to the highest possible 32-bit integer), then the operation will [overflow](https://en.wikipedia.org/wiki/Integer_overflow). When an overflow occurs, the program will crash. @@ -1281,7 +1293,7 @@ You can give a number literal a more specific type by adding the type you want a The full list of possible suffixes includes: -`u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `u128`, `i128`, `nat`, `f32`, `f64`, `dec` +`u8`, `i8`, `u16`, `i16`, `u32`, `i32`, `u64`, `i64`, `u128`, `i128`, `f32`, `f64`, `dec` Integer literals can be written in [hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) form by prefixing with `0x` followed by hexadecimal characters (`a` - `f` in addition to `0` - `9`). For example, writing `0xfe` is the same as writing `254`. Similarly, the prefix `0b` specifies binary integers. Writing `0b0000_1000` is the same as writing `8`. @@ -1411,8 +1423,16 @@ These modules are not ordinary `.roc` files that live on your filesystem. Rather Besides being built into the compiler, the builtin modules are different from other modules in that: +<<<<<<< HEAD + - They are always imported. You never need to add them to `imports`. - All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module). + ||||||| parent of cda0cfb47 (Remove Nat from documentation) +- They are always imported. You never need to add them to `imports`. +- # All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module. +- They are always imported. You never need to add them to `imports`. +- All their types are imported unqualified automatically. So you never need to write `Num.Dec`, because it's as if the `Num` module was imported using `imports [Num.{ Dec }]` (the same is true for all the other types in the `Num` module. + > > > > > > > cda0cfb47 (Remove Nat from documentation) ### [App Module Header](#app-module-header) {#app-module-header} From 9518d76cd82dd75e9df7d868cc0377b7f8cd7161 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 23 Jan 2024 12:52:34 -0500 Subject: [PATCH 40/80] Remove Num.bytesTo___ functions These may be reintroduced in some form later, but they don't handle endianness and it's not clear builtins are the right place for them. --- crates/compiler/builtins/bitcode/src/main.zig | 5 - crates/compiler/builtins/bitcode/src/num.zig | 36 -- crates/compiler/builtins/roc/Num.roc | 49 --- crates/compiler/builtins/src/bitcode.rs | 5 - crates/compiler/can/src/builtins.rs | 4 - crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 53 --- crates/compiler/gen_wasm/src/low_level.rs | 4 - crates/compiler/module/src/low_level.rs | 8 - crates/compiler/module/src/symbol.rs | 41 +-- .../compiler/mono/src/drop_specialization.rs | 4 - crates/compiler/mono/src/inc_dec.rs | 4 - crates/compiler/mono/src/low_level.rs | 4 - crates/compiler/test_gen/src/gen_num.rs | 328 ------------------ 13 files changed, 15 insertions(+), 530 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/main.zig b/crates/compiler/builtins/bitcode/src/main.zig index 05583d99cf3..52bbb2b8cbb 100644 --- a/crates/compiler/builtins/bitcode/src/main.zig +++ b/crates/compiler/builtins/bitcode/src/main.zig @@ -90,11 +90,6 @@ const FLOATS = [_]type{ f32, f64 }; const NUMBERS = INTEGERS ++ FLOATS; comptime { - exportNumFn(num.bytesToU16C, "bytes_to_u16"); - exportNumFn(num.bytesToU32C, "bytes_to_u32"); - exportNumFn(num.bytesToU64C, "bytes_to_u64"); - exportNumFn(num.bytesToU128C, "bytes_to_u128"); - exportNumFn(num.shiftRightZeroFillI128, "shift_right_zero_fill.i128"); exportNumFn(num.shiftRightZeroFillU128, "shift_right_zero_fill.u128"); diff --git a/crates/compiler/builtins/bitcode/src/num.zig b/crates/compiler/builtins/bitcode/src/num.zig index d388859554a..fb224942b79 100644 --- a/crates/compiler/builtins/bitcode/src/num.zig +++ b/crates/compiler/builtins/bitcode/src/num.zig @@ -274,42 +274,6 @@ pub fn exportToIntCheckingMaxAndMin(comptime From: type, comptime To: type, comp @export(f, .{ .name = name ++ @typeName(From), .linkage = .Strong }); } -pub fn bytesToU16C(arg: RocList, position: usize) callconv(.C) u16 { - return @call(.always_inline, bytesToU16, .{ arg, position }); -} - -fn bytesToU16(arg: RocList, position: usize) u16 { - const bytes = @as([*]const u8, @ptrCast(arg.bytes)); - return @as(u16, @bitCast([_]u8{ bytes[position], bytes[position + 1] })); -} - -pub fn bytesToU32C(arg: RocList, position: usize) callconv(.C) u32 { - return @call(.always_inline, bytesToU32, .{ arg, position }); -} - -fn bytesToU32(arg: RocList, position: usize) u32 { - const bytes = @as([*]const u8, @ptrCast(arg.bytes)); - return @as(u32, @bitCast([_]u8{ bytes[position], bytes[position + 1], bytes[position + 2], bytes[position + 3] })); -} - -pub fn bytesToU64C(arg: RocList, position: usize) callconv(.C) u64 { - return @call(.always_inline, bytesToU64, .{ arg, position }); -} - -fn bytesToU64(arg: RocList, position: usize) u64 { - const bytes = @as([*]const u8, @ptrCast(arg.bytes)); - return @as(u64, @bitCast([_]u8{ bytes[position], bytes[position + 1], bytes[position + 2], bytes[position + 3], bytes[position + 4], bytes[position + 5], bytes[position + 6], bytes[position + 7] })); -} - -pub fn bytesToU128C(arg: RocList, position: usize) callconv(.C) u128 { - return @call(.always_inline, bytesToU128, .{ arg, position }); -} - -fn bytesToU128(arg: RocList, position: usize) u128 { - const bytes = @as([*]const u8, @ptrCast(arg.bytes)); - return @as(u128, @bitCast([_]u8{ bytes[position], bytes[position + 1], bytes[position + 2], bytes[position + 3], bytes[position + 4], bytes[position + 5], bytes[position + 6], bytes[position + 7], bytes[position + 8], bytes[position + 9], bytes[position + 10], bytes[position + 11], bytes[position + 12], bytes[position + 13], bytes[position + 14], bytes[position + 15] })); -} - fn isMultipleOf(comptime T: type, lhs: T, rhs: T) bool { if (rhs == 0 or rhs == -1) { // lhs is a multiple of rhs iff diff --git a/crates/compiler/builtins/roc/Num.roc b/crates/compiler/builtins/roc/Num.roc index 6b3b15589f3..aa286a496a6 100644 --- a/crates/compiler/builtins/roc/Num.roc +++ b/crates/compiler/builtins/roc/Num.roc @@ -97,10 +97,6 @@ interface Num mulSaturated, mulChecked, intCast, - bytesToU16, - bytesToU32, - bytesToU64, - bytesToU128, divCeil, divCeilChecked, divTrunc, @@ -551,51 +547,6 @@ tau = 2 * pi toStr : Num * -> Str intCast : Int a -> Int b -bytesToU16Lowlevel : List U8, Nat -> U16 -bytesToU32Lowlevel : List U8, Nat -> U32 -bytesToU64Lowlevel : List U8, Nat -> U64 -bytesToU128Lowlevel : List U8, Nat -> U128 - -bytesToU16 : List U8, Nat -> Result U16 [OutOfBounds] -bytesToU16 = \bytes, index -> - # we need at least 1 more byte - offset = 1 - - if Num.addSaturated index offset < List.len bytes then - Ok (bytesToU16Lowlevel bytes index) - else - Err OutOfBounds - -bytesToU32 : List U8, Nat -> Result U32 [OutOfBounds] -bytesToU32 = \bytes, index -> - # we need at least 3 more bytes - offset = 3 - - if Num.addSaturated index offset < List.len bytes then - Ok (bytesToU32Lowlevel bytes index) - else - Err OutOfBounds - -bytesToU64 : List U8, Nat -> Result U64 [OutOfBounds] -bytesToU64 = \bytes, index -> - # we need at least 7 more bytes - offset = 7 - - if Num.addSaturated index offset < List.len bytes then - Ok (bytesToU64Lowlevel bytes index) - else - Err OutOfBounds - -bytesToU128 : List U8, Nat -> Result U128 [OutOfBounds] -bytesToU128 = \bytes, index -> - # we need at least 15 more bytes - offset = 15 - - if Num.addSaturated index offset < List.len bytes then - Ok (bytesToU128Lowlevel bytes index) - else - Err OutOfBounds - compare : Num a, Num a -> [LT, EQ, GT] ## Returns `Bool.true` if the first number is less than the second. diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index 6292f6559d3..d816416e9d2 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -331,11 +331,6 @@ pub const NUM_COUNT_TRAILING_ZERO_BITS: IntrinsicName = int_intrinsic!("roc_builtins.num.count_trailing_zero_bits"); pub const NUM_COUNT_ONE_BITS: IntrinsicName = int_intrinsic!("roc_builtins.num.count_one_bits"); -pub const NUM_BYTES_TO_U16: &str = "roc_builtins.num.bytes_to_u16"; -pub const NUM_BYTES_TO_U32: &str = "roc_builtins.num.bytes_to_u32"; -pub const NUM_BYTES_TO_U64: &str = "roc_builtins.num.bytes_to_u64"; -pub const NUM_BYTES_TO_U128: &str = "roc_builtins.num.bytes_to_u128"; - pub const STR_INIT: &str = "roc_builtins.str.init"; pub const STR_COUNT_SEGMENTS: &str = "roc_builtins.str.count_segments"; pub const STR_CONCAT: &str = "roc_builtins.str.concat"; diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index 9e5886b622d..c848329c9b1 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -196,10 +196,6 @@ map_symbol_to_lowlevel_and_arity! { NumAtan; NUM_ATAN; 1, NumAcos; NUM_ACOS; 1, NumAsin; NUM_ASIN; 1, - NumBytesToU16; NUM_BYTES_TO_U16_LOWLEVEL; 2, - NumBytesToU32; NUM_BYTES_TO_U32_LOWLEVEL; 2, - NumBytesToU64; NUM_BYTES_TO_U64_LOWLEVEL; 2, - NumBytesToU128; NUM_BYTES_TO_U128_LOWLEVEL; 2, NumBitwiseAnd; NUM_BITWISE_AND; 2, NumBitwiseXor; NUM_BITWISE_XOR; 2, NumBitwiseOr; NUM_BITWISE_OR; 2, diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 7c0b46516a2..f5317cb7077 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -950,59 +950,6 @@ pub(crate) fn run_low_level<'a, 'ctx>( } } } - NumBytesToU16 => { - arguments!(list, position); - - call_list_bitcode_fn( - env, - &[list.into_struct_value()], - &[position], - BitcodeReturns::Basic, - bitcode::NUM_BYTES_TO_U16, - ) - } - NumBytesToU32 => { - arguments!(list, position); - - call_list_bitcode_fn( - env, - &[list.into_struct_value()], - &[position], - BitcodeReturns::Basic, - bitcode::NUM_BYTES_TO_U32, - ) - } - NumBytesToU64 => { - arguments!(list, position); - - call_list_bitcode_fn( - env, - &[list.into_struct_value()], - &[position], - BitcodeReturns::Basic, - bitcode::NUM_BYTES_TO_U64, - ) - } - NumBytesToU128 => { - arguments!(list, position); - - let ret = call_list_bitcode_fn( - env, - &[list.into_struct_value()], - &[position], - BitcodeReturns::Basic, - bitcode::NUM_BYTES_TO_U128, - ); - - if env.target_info.operating_system == roc_target::OperatingSystem::Windows { - // On windows the return type is not a i128, likely due to alignment - env.builder - .build_bitcast(ret, env.context.i128_type(), "empty_string") - .unwrap() - } else { - ret - } - } NumCompare => { arguments_with_layouts!((lhs_arg, lhs_layout), (rhs_arg, rhs_layout)); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 28575ee610b..5e07e3ea425 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -1722,10 +1722,6 @@ impl<'a> LowLevelCall<'a> { } _ => panic_ret_type(), }, - NumBytesToU16 => self.load_args_and_call_zig(backend, bitcode::NUM_BYTES_TO_U16), - NumBytesToU32 => self.load_args_and_call_zig(backend, bitcode::NUM_BYTES_TO_U32), - NumBytesToU64 => self.load_args_and_call_zig(backend, bitcode::NUM_BYTES_TO_U64), - NumBytesToU128 => self.load_args_and_call_zig(backend, bitcode::NUM_BYTES_TO_U128), NumBitwiseAnd => { self.load_args(backend); match CodeGenNumType::from(self.ret_layout) { diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 34b04ab105e..baa3d81365e 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -88,10 +88,6 @@ pub enum LowLevel { NumAtan, NumAcos, NumAsin, - NumBytesToU16, - NumBytesToU32, - NumBytesToU64, - NumBytesToU128, NumBitwiseAnd, NumBitwiseXor, NumBitwiseOr, @@ -330,10 +326,6 @@ map_symbol_to_lowlevel! { NumAtan <= NUM_ATAN; NumAcos <= NUM_ACOS; NumAsin <= NUM_ASIN; - NumBytesToU16 <= NUM_BYTES_TO_U16_LOWLEVEL; - NumBytesToU32 <= NUM_BYTES_TO_U32_LOWLEVEL; - NumBytesToU64 <= NUM_BYTES_TO_U64_LOWLEVEL; - NumBytesToU128 <= NUM_BYTES_TO_U128_LOWLEVEL; NumBitwiseAnd <= NUM_BITWISE_AND; NumBitwiseXor <= NUM_BITWISE_XOR; NumBitwiseOr <= NUM_BITWISE_OR; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 30a0e4a65d9..49d8ae6aa88 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1198,13 +1198,13 @@ define_builtins! { 86 NUM_IS_MULTIPLE_OF: "isMultipleOf" 87 NUM_DECIMAL: "Decimal" exposed_type=true 88 NUM_DEC: "Dec" exposed_type=true // the Num.Dectype alias - 89 NUM_BYTES_TO_U16: "bytesToU16" - 90 NUM_BYTES_TO_U32: "bytesToU32" - 91 NUM_BYTES_TO_U64: "bytesToU64" - 92 NUM_BYTES_TO_U128: "bytesToU128" - 93 NUM_CAST_TO_NAT: "#castToNat" - 94 NUM_DIV_CEIL: "divCeil" - 95 NUM_DIV_CEIL_CHECKED: "divCeilChecked" + 89 NUM_COUNT_ONE_BITS: "countOneBits" + 90 NUM_ABS_DIFF: "absDiff" + 91 NUM_IS_NAN: "isNaN" + 92 NUM_IS_INFINITE: "isInfinite" + 93 NUM_IS_FINITE: "isFinite" + 94 NUM_COUNT_LEADING_ZERO_BITS: "countLeadingZeroBits" + 95 NUM_COUNT_TRAILING_ZERO_BITS: "countTrailingZeroBits" 96 NUM_TO_STR: "toStr" 97 NUM_MIN_I8: "minI8" 98 NUM_MAX_I8: "maxI8" @@ -1246,8 +1246,8 @@ define_builtins! { 134 NUM_TO_U64_CHECKED: "toU64Checked" 135 NUM_TO_U128: "toU128" 136 NUM_TO_U128_CHECKED: "toU128Checked" - 137 NUM_TO_NAT: "toNat" - 138 NUM_TO_NAT_CHECKED: "toNatChecked" + 137 NUM_DIV_CEIL: "divCeil" + 138 NUM_DIV_CEIL_CHECKED: "divCeilChecked" 139 NUM_TO_F32: "toF32" 140 NUM_TO_F32_CHECKED: "toF32Checked" 141 NUM_TO_F64: "toF64" @@ -1257,22 +1257,11 @@ define_builtins! { 145 NUM_ADD_CHECKED_LOWLEVEL: "addCheckedLowlevel" 146 NUM_SUB_CHECKED_LOWLEVEL: "subCheckedLowlevel" 147 NUM_MUL_CHECKED_LOWLEVEL: "mulCheckedLowlevel" - 148 NUM_BYTES_TO_U16_LOWLEVEL: "bytesToU16Lowlevel" - 149 NUM_BYTES_TO_U32_LOWLEVEL: "bytesToU32Lowlevel" - 150 NUM_BYTES_TO_U64_LOWLEVEL: "bytesToU64Lowlevel" - 151 NUM_BYTES_TO_U128_LOWLEVEL: "bytesToU128Lowlevel" - 152 NUM_COUNT_LEADING_ZERO_BITS: "countLeadingZeroBits" - 153 NUM_COUNT_TRAILING_ZERO_BITS: "countTrailingZeroBits" - 154 NUM_COUNT_ONE_BITS: "countOneBits" - 155 NUM_ABS_DIFF: "absDiff" - 156 NUM_IS_NAN: "isNaN" - 157 NUM_IS_INFINITE: "isInfinite" - 158 NUM_IS_FINITE: "isFinite" - 159 NUM_MIN: "min" - 160 NUM_MAX: "max" - 161 NUM_BITWISE_NOT: "bitwiseNot" - 162 NUM_INT_CAST: "intCast" - 163 NUM_IS_APPROX_EQ: "isApproxEq" + 148 NUM_MIN: "min" + 149 NUM_MAX: "max" + 150 NUM_BITWISE_NOT: "bitwiseNot" + 151 NUM_INT_CAST: "intCast" + 152 NUM_IS_APPROX_EQ: "isApproxEq" } 4 BOOL: "Bool" => { 0 BOOL_BOOL: "Bool" exposed_type=true // the Bool.Bool type alias @@ -1313,7 +1302,7 @@ define_builtins! { 20 STR_TO_DEC: "toDec" 21 STR_TO_F64: "toF64" 22 STR_TO_F32: "toF32" - 23 STR_TO_NAT: "toNat" + 24 STR_TO_U128: "toU128" 25 STR_TO_I128: "toI128" 26 STR_TO_U64: "toU64" diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index d8814283585..aedf47dfbcc 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1593,10 +1593,6 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { | NumCountLeadingZeroBits | NumCountTrailingZeroBits | NumCountOneBits => RC::NoRc, - NumBytesToU16 => RC::NoRc, - NumBytesToU32 => RC::NoRc, - NumBytesToU64 => RC::NoRc, - NumBytesToU128 => RC::NoRc, I128OfDec => RC::NoRc, DictPseudoSeed => RC::NoRc, StrStartsWith | StrEndsWith => RC::NoRc, diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index 395323baaf9..9ad057d69cb 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1349,10 +1349,6 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { | NumCountTrailingZeroBits | NumCountOneBits | I128OfDec => arena.alloc_slice_copy(&[irrelevant]), - NumBytesToU16 => arena.alloc_slice_copy(&[borrowed, irrelevant]), - NumBytesToU32 => arena.alloc_slice_copy(&[borrowed, irrelevant]), - NumBytesToU64 => arena.alloc_slice_copy(&[borrowed, irrelevant]), - NumBytesToU128 => arena.alloc_slice_copy(&[borrowed, irrelevant]), StrStartsWith | StrEndsWith => arena.alloc_slice_copy(&[borrowed, borrowed]), StrFromUtf8Range => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]), StrToUtf8 => arena.alloc_slice_copy(&[owned]), diff --git a/crates/compiler/mono/src/low_level.rs b/crates/compiler/mono/src/low_level.rs index a0ab0fabece..1279b8eb34d 100644 --- a/crates/compiler/mono/src/low_level.rs +++ b/crates/compiler/mono/src/low_level.rs @@ -119,10 +119,6 @@ enum FirstOrder { NumBitwiseOr, NumShiftLeftBy, NumShiftRightBy, - NumBytesToU16, - NumBytesToU32, - NumBytesToU64, - NumBytesToU128, NumShiftRightZfBy, NumIntCast, NumFloatCast, diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index 78696298e2a..2c0b8b2eeff 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -2565,334 +2565,6 @@ fn is_multiple_of_unsigned() { assert_evals_to!("Num.isMultipleOf 0xFCu8 0xFE", false, bool); } -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u16_clearly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU16 bytes 234 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u16 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u16_subtly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU16 bytes 4 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u16 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u32_clearly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU32 bytes 234 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u32 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u32_subtly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU32 bytes 2 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u32 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u64_clearly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU64 bytes 234 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u64 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u64_subtly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello world" - when Num.bytesToU64 bytes 4 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u64 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u128_clearly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Num.bytesToU128 bytes 234 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u128 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u128_subtly_out_of_bounds() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello world!!!!!!" - when Num.bytesToU128 bytes 2 is - Ok v -> v - Err OutOfBounds -> 1 - "# - ), - 1, - u128 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u16_max_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU16 [255, 255] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 65535, - u16 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u16_min_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU16 [0, 0] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 0, - u16 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u16_random_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU16 [164, 215] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 55_204, - u16 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u32_min_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU32 [0, 0, 0, 0] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 0, - u32 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u32_max_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU32 [255, 255, 255, 255] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 4_294_967_295, - u32 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u32_random_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU32 [252, 124, 128, 121] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 2_038_463_740, - u32 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u64_min_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU64 [0, 0, 0, 0, 0, 0, 0, 0] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 0, - u64 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u64_max_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU64 [255, 255, 255, 255, 255, 255, 255, 255] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 18_446_744_073_709_551_615, - u64 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u64_random_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU64 [252, 124, 128, 121, 1, 32, 177, 211] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 15_254_008_603_586_100_476, - u64 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u128_min_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU128 [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 0, - u128 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u128_max_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU128 [255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 340_282_366_920_938_463_463_374_607_431_768_211_455, - u128 - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] -fn bytes_to_u128_random_u8s() { - assert_evals_to!( - indoc!( - r" - when Num.bytesToU128 [252, 124, 128, 121, 1, 32, 177, 211, 3, 57, 203, 122, 95, 164, 23, 145] 0 is - Ok v -> v - Err OutOfBounds -> 1 - " - ), - 192_860_816_096_412_392_720_639_456_393_488_792_828, - u128 - ); -} - #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] fn when_on_i32() { From fb84c9487dbcda4920b73ad174b5a37a9cef3001 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 23 Jan 2024 12:54:46 -0500 Subject: [PATCH 41/80] Remove Num.Natural, Num.toNat, and Num.toNatChecked --- crates/compiler/builtins/roc/Num.roc | 8 -------- crates/compiler/can/src/builtins.rs | 2 -- crates/compiler/test_gen/src/gen_num.rs | 24 ------------------------ examples/cli/ingested-file-bytes.roc | 2 +- 4 files changed, 1 insertion(+), 35 deletions(-) diff --git a/crates/compiler/builtins/roc/Num.roc b/crates/compiler/builtins/roc/Num.roc index aa286a496a6..227cb208a6f 100644 --- a/crates/compiler/builtins/roc/Num.roc +++ b/crates/compiler/builtins/roc/Num.roc @@ -28,7 +28,6 @@ interface Num Dec, F64, F32, - Natural, Decimal, Binary32, Binary64, @@ -147,8 +146,6 @@ interface Num toU64Checked, toU128, toU128Checked, - toNat, - toNatChecked, toF32, toF32Checked, toF64, @@ -410,8 +407,6 @@ Unsigned32 := [] Unsigned16 := [] Unsigned8 := [] -Natural := [] - Integer range := range I128 : Num (Integer Signed128) @@ -1374,8 +1369,6 @@ toU32 : Int * -> U32 toU64 : Int * -> U64 toU128 : Int * -> U128 -toNat : Int * -> Nat - ## Converts a [Num] to an [F32]. If the given number can't be precisely represented in an [F32], ## the returned number may be different from the given number. toF32 : Num * -> F32 @@ -1397,6 +1390,5 @@ toU16Checked : Int * -> Result U16 [OutOfBounds] toU32Checked : Int * -> Result U32 [OutOfBounds] toU64Checked : Int * -> Result U64 [OutOfBounds] toU128Checked : Int * -> Result U128 [OutOfBounds] -toNatChecked : Int * -> Result Nat [OutOfBounds] toF32Checked : Num * -> Result F32 [OutOfBounds] toF64Checked : Num * -> Result F64 [OutOfBounds] diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index c848329c9b1..5b6bd755629 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -33,7 +33,6 @@ macro_rules! map_symbol_to_lowlevel_and_arity { Symbol::NUM_TO_U32 => Some(lowlevel_1(Symbol::NUM_TO_U32, LowLevel::NumIntCast, var_store)), Symbol::NUM_TO_U64 => Some(lowlevel_1(Symbol::NUM_TO_U64, LowLevel::NumIntCast, var_store)), Symbol::NUM_TO_U128 => Some(lowlevel_1(Symbol::NUM_TO_U128, LowLevel::NumIntCast, var_store)), - Symbol::NUM_TO_NAT => Some(lowlevel_1(Symbol::NUM_TO_NAT, LowLevel::NumIntCast, var_store)), Symbol::NUM_INT_CAST => Some(lowlevel_1(Symbol::NUM_INT_CAST, LowLevel::NumIntCast, var_store)), @@ -50,7 +49,6 @@ macro_rules! map_symbol_to_lowlevel_and_arity { Symbol::NUM_TO_U32_CHECKED => Some(to_num_checked(Symbol::NUM_TO_U32_CHECKED, var_store, LowLevel::NumToIntChecked)), Symbol::NUM_TO_U64_CHECKED => Some(to_num_checked(Symbol::NUM_TO_U64_CHECKED, var_store, LowLevel::NumToIntChecked)), Symbol::NUM_TO_U128_CHECKED => Some(to_num_checked(Symbol::NUM_TO_U128_CHECKED, var_store, LowLevel::NumToIntChecked)), - Symbol::NUM_TO_NAT_CHECKED => Some(to_num_checked(Symbol::NUM_TO_NAT_CHECKED, var_store, LowLevel::NumToIntChecked)), Symbol::NUM_TO_F32_CHECKED => Some(to_num_checked(Symbol::NUM_TO_F32_CHECKED, var_store, LowLevel::NumToFloatChecked)), Symbol::NUM_TO_F64_CHECKED => Some(to_num_checked(Symbol::NUM_TO_F64_CHECKED, var_store, LowLevel::NumToFloatChecked)), diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index 2c0b8b2eeff..ede7197b831 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -2271,13 +2271,6 @@ fn min_f32() { assert_evals_to!("Num.minF32", f32::MIN, f32); } -#[test] -#[cfg(all(feature = "gen-llvm", not(feature = "gen-llvm-wasm")))] -fn to_nat_truncate_wraps() { - let input = "Num.toNat 10_000_000_000_000_000_000_000i128"; - assert_evals_to!(input, 1864712049423024128, u64) -} - macro_rules! num_conversion_tests { ($($fn:expr, $typ:ty, ($($test_name:ident, $input:expr, $output:expr $(, [$($support_gen:literal),*])? )*))*) => {$($( #[test] @@ -2350,11 +2343,6 @@ num_conversion_tests! { to_u128_same_width, "15i128", 15 to_u128_extend, "15i8", 15 ) - "Num.toNat", usize, ( - to_nat_same_width, "15i64", 15, ["gen-wasm", "gen-dev"] - to_nat_extend, "15i8", 15, ["gen-wasm", "gen-dev"] - to_nat_truncate, "115i128", 115 - ) "Num.toF32", f32, ( to_f32_from_i8, "15i8", 15.0 to_f32_from_i16, "15i16", 15.0 @@ -2516,18 +2504,6 @@ to_int_checked_tests! { to_u128_checked_same_width_signed_fits, "15i128", 15 to_u128_checked_same_width_signed_oob, "-1i128", None ) - "Num.toNatChecked", usize, ( - to_nat_checked_smaller_width_pos, "15i8", 15 - to_nat_checked_smaller_width_neg_oob, "-15i8", None - to_nat_checked_same, "15u64", 15 - to_nat_checked_same_width_signed_fits, "15i64", 15 - to_nat_checked_same_width_signed_oob, "-1i64", None - to_nat_checked_larger_width_signed_fits_pos, "15i128", 15 - to_nat_checked_larger_width_signed_oob_pos, "18446744073709551616i128", None - to_nat_checked_larger_width_signed_oob_neg, "-1i128", None - to_nat_checked_larger_width_unsigned_fits_pos, "15u128", 15 - to_nat_checked_larger_width_unsigned_oob_pos, "18446744073709551616u128", None - ) } #[test] diff --git a/examples/cli/ingested-file-bytes.roc b/examples/cli/ingested-file-bytes.roc index 4473ccf110c..7a53690ff52 100644 --- a/examples/cli/ingested-file-bytes.roc +++ b/examples/cli/ingested-file-bytes.roc @@ -9,7 +9,7 @@ app "ingested-file-bytes" main = # Due to how license is used, it will be a List U8. license - |> List.map Num.toNat + |> List.map Num.toU64 |> List.sum |> Num.toStr |> Stdout.line From eb3dc3d5825b0835bb01043bbb17164b1a4f84c3 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:28:50 -0500 Subject: [PATCH 42/80] Drop unused import in Hash.roc --- crates/compiler/builtins/roc/Hash.roc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/builtins/roc/Hash.roc b/crates/compiler/builtins/roc/Hash.roc index fc04f7cbdfe..51626693721 100644 --- a/crates/compiler/builtins/roc/Hash.roc +++ b/crates/compiler/builtins/roc/Hash.roc @@ -21,7 +21,7 @@ interface Hash hashList, hashUnordered, ] imports [ - Bool.{ Bool, isEq }, + Bool.{ Bool }, List, Str, Num.{ U8, U16, U32, U64, U128, I8, I16, I32, I64, I128, Dec }, From 2b4d0d080bf8af4c106e9670d6f2efd57a34c389 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:29:23 -0500 Subject: [PATCH 43/80] Use Variable::U64 over Variable::NAT --- crates/compiler/derive/src/decoding/tuple.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/compiler/derive/src/decoding/tuple.rs b/crates/compiler/derive/src/decoding/tuple.rs index 2007a66740b..cfb8173ce56 100644 --- a/crates/compiler/derive/src/decoding/tuple.rs +++ b/crates/compiler/derive/src/decoding/tuple.rs @@ -639,8 +639,8 @@ fn step_elem( WhenBranch { patterns: vec![WhenBranchPattern { pattern: Loc::at_zero(Pattern::IntLiteral( - Variable::NAT, - Variable::NATURAL, + Variable::U64, + Variable::UNSIGNED64, index.to_string().into_boxed_str(), IntValue::I128((index as i128).to_ne_bytes()), IntBound::Exact(IntLitWidth::U64), @@ -676,12 +676,12 @@ fn step_elem( // when index is let body = Expr::When { - loc_cond: Box::new(Loc::at_zero(Expr::Var(index_arg_symbol, Variable::NAT))), - cond_var: Variable::NAT, + loc_cond: Box::new(Loc::at_zero(Expr::Var(index_arg_symbol, Variable::U64))), + cond_var: Variable::U64, expr_var: keep_or_skip_var, region: Region::zero(), branches, - branches_cond_var: Variable::NAT, + branches_cond_var: Variable::U64, exhaustive: ExhaustiveMark::known_exhaustive(), }; @@ -699,7 +699,7 @@ fn step_elem( }; { - let args_slice = SubsSlice::insert_into_subs(env.subs, [state_record_var, Variable::NAT]); + let args_slice = SubsSlice::insert_into_subs(env.subs, [state_record_var, Variable::U64]); env.subs.set_content( function_type, @@ -721,7 +721,7 @@ fn step_elem( Loc::at_zero(Pattern::Identifier(state_arg_symbol)), ), ( - Variable::NAT, + Variable::U64, AnnotatedMark::known_exhaustive(), Loc::at_zero(Pattern::Identifier(index_arg_symbol)), ), From 87ec602b1e16aad87b2f6376ce668ed84a4604ef Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:29:38 -0500 Subject: [PATCH 44/80] Fix gap in symbols --- crates/compiler/module/src/symbol.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 49d8ae6aa88..eafcfcec615 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1299,10 +1299,10 @@ define_builtins! { 17 STR_TRIM: "trim" 18 STR_TRIM_START: "trimStart" 19 STR_TRIM_END: "trimEnd" - 20 STR_TO_DEC: "toDec" + 20 STR_WITH_CAPACITY: "withCapacity" 21 STR_TO_F64: "toF64" 22 STR_TO_F32: "toF32" - + 23 STR_TO_DEC: "toDec" 24 STR_TO_U128: "toU128" 25 STR_TO_I128: "toI128" 26 STR_TO_U64: "toU64" @@ -1327,8 +1327,7 @@ define_builtins! { 45 STR_REPLACE_EACH: "replaceEach" 46 STR_REPLACE_FIRST: "replaceFirst" 47 STR_REPLACE_LAST: "replaceLast" - 48 STR_WITH_CAPACITY: "withCapacity" - 49 STR_RELEASE_EXCESS_CAPACITY: "releaseExcessCapacity" + 48 STR_RELEASE_EXCESS_CAPACITY: "releaseExcessCapacity" } 6 LIST: "List" => { 0 LIST_LIST: "List" exposed_apply_type=true // the List.List type alias From 76dcbee25ff228d5d2b2e441ad80a5f124d2e35c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:30:55 -0500 Subject: [PATCH 45/80] Drop unused target_info from layout --- crates/compiler/mono/src/ir.rs | 54 +++++++------------------- crates/compiler/mono/src/ir/pattern.rs | 24 +++--------- crates/compiler/mono/src/layout.rs | 39 ++++--------------- crates/repl_eval/src/eval.rs | 18 ++------- 4 files changed, 31 insertions(+), 104 deletions(-) diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index ba7afdba2ff..7a79555c25e 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -3120,8 +3120,7 @@ fn specialize_host_specializations<'a>( let symbol = env.unique_symbol(); let lambda_name = LambdaName::no_niche(symbol); - let mut layout_env = - layout::Env::from_components(layout_cache, env.subs, env.arena, env.target_info); + let mut layout_env = layout::Env::from_components(layout_cache, env.subs, env.arena); let lambda_set = env.subs.get_lambda_set(var); let raw_function_layout = RawFunctionLayout::from_var(&mut layout_env, lambda_set.ambient_function) @@ -4542,12 +4541,8 @@ pub fn with_hole<'a>( tuple_var, elems, .. } => { let sorted_elems_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_tuple_elems(&mut layout_env, tuple_var) }; let sorted_elems = match sorted_elems_result { @@ -4577,12 +4572,8 @@ pub fn with_hole<'a>( .. } => { let sorted_fields_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_record_fields(&mut layout_env, record_var) }; let sorted_fields = match sorted_fields_result { @@ -4916,12 +4907,8 @@ pub fn with_hole<'a>( .. } => { let sorted_fields_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_record_fields(&mut layout_env, record_var) }; let sorted_fields = match sorted_fields_result { @@ -5029,12 +5016,8 @@ pub fn with_hole<'a>( .. } => { let sorted_elems_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_tuple_elems(&mut layout_env, tuple_var) }; let sorted_elems = match sorted_elems_result { @@ -5142,12 +5125,8 @@ pub fn with_hole<'a>( // This has the benefit that we don't need to do anything special for reference // counting let sorted_fields_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_record_fields(&mut layout_env, record_var) }; @@ -6368,8 +6347,7 @@ fn convert_tag_union<'a>( ) -> Stmt<'a> { use crate::layout::UnionVariant::*; let res_variant = { - let mut layout_env = - layout::Env::from_components(layout_cache, env.subs, env.arena, env.target_info); + let mut layout_env = layout::Env::from_components(layout_cache, env.subs, env.arena); crate::layout::union_sorted_tags(&mut layout_env, variant_var) }; let variant = match res_variant { @@ -8046,12 +8024,8 @@ fn can_reuse_symbol<'a>( .. } => { let sorted_fields_result = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); layout::sort_record_fields(&mut layout_env, *record_var) }; diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index 173744d3446..38ebdcfe04d 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -385,12 +385,8 @@ fn from_can_pattern_help<'a>( use roc_exhaustive::Union; let res_variant = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); crate::layout::union_sorted_tags(&mut layout_env, *whole_var).map_err(Into::into) }; @@ -880,12 +876,8 @@ fn from_can_pattern_help<'a>( } => { // sorted fields based on the type let sorted_elems = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); crate::layout::sort_tuple_elems(&mut layout_env, *whole_var) .map_err(RuntimeError::from)? }; @@ -936,12 +928,8 @@ fn from_can_pattern_help<'a>( } => { // sorted fields based on the type let sorted_fields = { - let mut layout_env = layout::Env::from_components( - layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(layout_cache, env.subs, env.arena); crate::layout::sort_record_fields(&mut layout_env, *whole_var) .map_err(RuntimeError::from)? }; diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index d7dead893ae..432ef6d2ffc 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -160,7 +160,6 @@ impl<'a> LayoutCache<'a> { arena, subs, seen: Vec::new_in(arena), - target_info: self.target_info, cache: self, }; @@ -186,7 +185,6 @@ impl<'a> LayoutCache<'a> { arena, subs, seen: Vec::new_in(arena), - target_info: self.target_info, cache: self, }; @@ -1821,7 +1819,7 @@ impl<'a> LambdaSet<'a> { ret_var: Variable, target_info: TargetInfo, ) -> Result { - let mut env = Env::from_components(cache, subs, arena, target_info); + let mut env = Env::from_components(cache, subs, arena); Self::from_var(&mut env, args, closure_var, ret_var).value() } @@ -2229,7 +2227,6 @@ macro_rules! list_element_layout { } pub struct Env<'a, 'b> { - target_info: TargetInfo, pub(crate) arena: &'a Bump, seen: Vec<'a, Variable>, pub(crate) subs: &'b Subs, @@ -2241,14 +2238,12 @@ impl<'a, 'b> Env<'a, 'b> { cache: &'b mut LayoutCache<'a>, subs: &'b Subs, arena: &'a Bump, - target_info: TargetInfo, ) -> Self { Self { cache, subs, seen: Vec::new_in(arena), arena, - target_info, } } @@ -2518,7 +2513,7 @@ impl<'a> Layout<'a> { } } - RangedNumber(range) => Self::layout_from_ranged_number(env, range), + RangedNumber(range) => Self::layout_from_ranged_number(range), Error => cacheable(Err(LayoutProblem::Erroneous)), } @@ -2539,18 +2534,12 @@ impl<'a> Layout<'a> { } } - fn layout_from_ranged_number( - env: &mut Env<'a, '_>, - range: NumericRange, - ) -> Cacheable> { + fn layout_from_ranged_number(range: NumericRange) -> Cacheable> { // We don't pass the range down because `RangedNumber`s are somewhat rare, they only // appear due to number literals, so no need to increase parameter list sizes. let num_layout = range.default_compilation_width(); - cacheable(Ok(Layout::int_literal_width_to_int( - num_layout, - env.target_info, - ))) + cacheable(Ok(Layout::int_literal_width_to_int(num_layout))) } /// Returns Err(()) if given an error, or Ok(Layout) if given a non-erroneous Structure. @@ -3028,10 +3017,7 @@ impl<'a> Layout<'a> { Layout::DEC } - pub fn int_literal_width_to_int( - width: roc_types::num::IntLitWidth, - target_info: TargetInfo, - ) -> InLayout<'a> { + pub fn int_literal_width_to_int(width: roc_types::num::IntLitWidth) -> InLayout<'a> { use roc_types::num::IntLitWidth::*; match width { U8 => Layout::U8, @@ -3229,7 +3215,6 @@ fn layout_from_flat_type<'a>( let arena = env.arena; let subs = env.subs; - let target_info = env.target_info; match flat_type { Apply(symbol, args) => { @@ -3237,11 +3222,6 @@ fn layout_from_flat_type<'a>( match symbol { // Ints - Symbol::NUM_NAT => { - debug_assert_eq!(args.len(), 0); - cacheable(Ok(Layout::usize(env.target_info))) - } - Symbol::NUM_I128 => { debug_assert_eq!(args.len(), 0); cacheable(Ok(Layout::I128)) @@ -3305,7 +3285,7 @@ fn layout_from_flat_type<'a>( let var = args[0]; let content = subs.get_content_without_compacting(var); - layout_from_num_content(content, target_info) + layout_from_num_content(content) } Symbol::STR_STR => cacheable(Ok(Layout::STR)), @@ -4539,10 +4519,7 @@ pub fn ext_var_is_empty_tag_union(_: &Subs, _: TagExt) -> bool { unreachable!(); } -fn layout_from_num_content<'a>( - content: &Content, - target_info: TargetInfo, -) -> Cacheable> { +fn layout_from_num_content<'a>(content: &Content) -> Cacheable> { use roc_types::subs::Content::*; use roc_types::subs::FlatType::*; @@ -4558,8 +4535,6 @@ fn layout_from_num_content<'a>( FlexAbleVar(_, _) | RigidAbleVar(_, _) => todo_abilities!("Not reachable yet"), Structure(Apply(symbol, args)) => match *symbol { // Ints - Symbol::NUM_NAT => Ok(Layout::usize(target_info)), - Symbol::NUM_INTEGER => Ok(Layout::I64), Symbol::NUM_I128 => Ok(Layout::I128), Symbol::NUM_I64 => Ok(Layout::I64), diff --git a/crates/repl_eval/src/eval.rs b/crates/repl_eval/src/eval.rs index 353010e2fbf..fb7d5edae23 100644 --- a/crates/repl_eval/src/eval.rs +++ b/crates/repl_eval/src/eval.rs @@ -99,12 +99,8 @@ fn get_newtype_tag_and_var( tags: UnionTags, ) -> Option<(TagName, Variable)> { let union_variant = { - let mut layout_env = roc_mono::layout::Env::from_components( - &mut env.layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + roc_mono::layout::Env::from_components(&mut env.layout_cache, env.subs, env.arena); roc_mono::layout::union_sorted_tags(&mut layout_env, var).unwrap() }; @@ -253,12 +249,8 @@ fn get_tags_vars_and_variant<'a>( let vars_of_tag: MutMap<_, _> = tags_vec.iter().cloned().collect(); let union_variant = { - let mut layout_env = layout::Env::from_components( - &mut env.layout_cache, - env.subs, - env.arena, - env.target_info, - ); + let mut layout_env = + layout::Env::from_components(&mut env.layout_cache, env.subs, env.arena); union_sorted_tags_pub(&mut layout_env, tags_vec, opt_rec_var) }; @@ -1415,7 +1407,6 @@ fn byte_to_ast<'a>(env: &mut Env<'a, '_>, value: u8, content: &Content) -> Expr< &mut env.layout_cache, env.subs, env.arena, - env.target_info, ); union_sorted_tags_pub(&mut layout_env, tags_vec, None) }; @@ -1446,7 +1437,6 @@ fn byte_to_ast<'a>(env: &mut Env<'a, '_>, value: u8, content: &Content) -> Expr< &mut env.layout_cache, env.subs, env.arena, - env.target_info, ); union_sorted_tags_pub(&mut layout_env, tags_vec, None) }; From 204cee7d60ce2d274b47aac74d7c37d6df1108d4 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 24 Jan 2024 23:32:10 -0500 Subject: [PATCH 46/80] Clean up more unused Nat stuff --- crates/compiler/mono/src/ir.rs | 1 - crates/compiler/mono/src/layout.rs | 1 - crates/compiler/solve/src/ability.rs | 27 +++++++++++---------------- crates/compiler/types/src/subs.rs | 19 ------------------- crates/reporting/src/error/type.rs | 3 +-- 5 files changed, 12 insertions(+), 39 deletions(-) diff --git a/crates/compiler/mono/src/ir.rs b/crates/compiler/mono/src/ir.rs index 7a79555c25e..19571a5a23c 100644 --- a/crates/compiler/mono/src/ir.rs +++ b/crates/compiler/mono/src/ir.rs @@ -6845,7 +6845,6 @@ fn register_capturing_closure<'a>( args, closure_var, ret, - env.target_info, ) }; diff --git a/crates/compiler/mono/src/layout.rs b/crates/compiler/mono/src/layout.rs index 432ef6d2ffc..f5acdacf411 100644 --- a/crates/compiler/mono/src/layout.rs +++ b/crates/compiler/mono/src/layout.rs @@ -1817,7 +1817,6 @@ impl<'a> LambdaSet<'a> { args: VariableSubsSlice, closure_var: Variable, ret_var: Variable, - target_info: TargetInfo, ) -> Result { let mut env = Env::from_components(cache, subs, arena); Self::from_var(&mut env, args, closure_var, ret_var).value() diff --git a/crates/compiler/solve/src/ability.rs b/crates/compiler/solve/src/ability.rs index 52639de5ef5..05ee2dd45a8 100644 --- a/crates/compiler/solve/src/ability.rs +++ b/crates/compiler/solve/src/ability.rs @@ -10,8 +10,7 @@ use roc_error_macros::internal_error; use roc_module::symbol::{ModuleId, Symbol}; use roc_region::all::{Loc, Region}; use roc_solve_problem::{ - NotDerivableContext, NotDerivableDecode, NotDerivableEncode, NotDerivableEq, TypeError, - UnderivableReason, Unfulfilled, + NotDerivableContext, NotDerivableEq, TypeError, UnderivableReason, Unfulfilled, }; use roc_solve_schema::UnificationMode; use roc_types::num::NumericRange; @@ -508,7 +507,6 @@ fn is_builtin_dec_alias(symbol: Symbol) -> bool { #[inline(always)] fn is_builtin_number_alias(symbol: Symbol) -> bool { is_builtin_fixed_int_alias(symbol) - || is_builtin_nat_alias(symbol) || is_builtin_float_alias(symbol) || is_builtin_dec_alias(symbol) } @@ -947,8 +945,7 @@ impl DerivableVisitor for DeriveEncoding { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { - (is_builtin_number_alias(symbol) && !is_builtin_nat_alias(symbol)) - || is_builtin_bool_alias(symbol) + is_builtin_number_alias(symbol) || is_builtin_bool_alias(symbol) } #[inline(always)] @@ -1015,7 +1012,7 @@ impl DerivableVisitor for DeriveEncoding { } #[inline(always)] - fn visit_alias(var: Variable, symbol: Symbol) -> Result { + fn visit_alias(_var: Variable, symbol: Symbol) -> Result { Ok(Descend(!is_builtin_number_alias(symbol))) } @@ -1041,8 +1038,7 @@ impl DerivableVisitor for DeriveDecoding { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { - (is_builtin_number_alias(symbol) && !is_builtin_nat_alias(symbol)) - || is_builtin_bool_alias(symbol) + is_builtin_number_alias(symbol) || is_builtin_bool_alias(symbol) } #[inline(always)] @@ -1075,9 +1071,9 @@ impl DerivableVisitor for DeriveDecoding { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } @@ -1120,7 +1116,7 @@ impl DerivableVisitor for DeriveDecoding { } #[inline(always)] - fn visit_alias(var: Variable, symbol: Symbol) -> Result { + fn visit_alias(_var: Variable, symbol: Symbol) -> Result { Ok(Descend(!is_builtin_number_alias(symbol))) } @@ -1179,9 +1175,9 @@ impl DerivableVisitor for DeriveHash { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } @@ -1255,7 +1251,6 @@ impl DerivableVisitor for DeriveEq { #[inline(always)] fn is_derivable_builtin_opaque(symbol: Symbol) -> bool { is_builtin_fixed_int_alias(symbol) - || is_builtin_nat_alias(symbol) || is_builtin_dec_alias(symbol) || is_builtin_bool_alias(symbol) } @@ -1294,9 +1289,9 @@ impl DerivableVisitor for DeriveEq { if subs[field].is_optional() { return Err(NotDerivable { var, - context: NotDerivableContext::Decode(NotDerivableDecode::OptionalRecordField( + context: NotDerivableContext::DecodeOptionalRecordField( subs[field_name].clone(), - )), + ), }); } } diff --git a/crates/compiler/types/src/subs.rs b/crates/compiler/types/src/subs.rs index 12077c606a3..b5b2de55ad9 100644 --- a/crates/compiler/types/src/subs.rs +++ b/crates/compiler/types/src/subs.rs @@ -1277,8 +1277,6 @@ define_const_var! { :pub UNSIGNED64, :pub UNSIGNED128, - :pub NATURAL, - // Integer Signed8 := Signed8 INTEGER_SIGNED8, INTEGER_SIGNED16, @@ -1292,8 +1290,6 @@ define_const_var! { INTEGER_UNSIGNED64, INTEGER_UNSIGNED128, - INTEGER_NATURAL, - // Num (Integer Signed8) := Integer Signed8 NUM_INTEGER_SIGNED8, NUM_INTEGER_SIGNED16, @@ -1307,8 +1303,6 @@ define_const_var! { NUM_INTEGER_UNSIGNED64, NUM_INTEGER_UNSIGNED128, - NUM_INTEGER_NATURAL, - // I8 : Num (Integer Signed8) :pub I8, :pub I16, @@ -1322,8 +1316,6 @@ define_const_var! { :pub U64, :pub U128, - :pub NAT, - // Binary32 : [] BINARY32, BINARY64, @@ -1382,8 +1374,6 @@ impl Variable { Symbol::NUM_U16 => Some(Variable::U16), Symbol::NUM_U8 => Some(Variable::U8), - Symbol::NUM_NAT => Some(Variable::NAT), - Symbol::BOOL_BOOL => Some(Variable::BOOL), Symbol::NUM_F64 => Some(Variable::F64), @@ -1589,15 +1579,6 @@ fn define_integer_types(subs: &mut Subs) { Variable::NUM_INTEGER_UNSIGNED8, Variable::U8, ); - - integer_type( - subs, - Symbol::NUM_NAT, - Variable::NATURAL, - Variable::INTEGER_NATURAL, - Variable::NUM_INTEGER_NATURAL, - Variable::NAT, - ); } #[allow(clippy::too_many_arguments)] diff --git a/crates/reporting/src/error/type.rs b/crates/reporting/src/error/type.rs index a074fe9cda3..e5a39fc134e 100644 --- a/crates/reporting/src/error/type.rs +++ b/crates/reporting/src/error/type.rs @@ -15,8 +15,7 @@ use roc_module::symbol::Symbol; use roc_problem::Severity; use roc_region::all::{LineInfo, Region}; use roc_solve_problem::{ - NotDerivableContext, NotDerivableDecode, NotDerivableEncode, NotDerivableEq, TypeError, - UnderivableReason, Unfulfilled, + NotDerivableContext, NotDerivableEq, TypeError, UnderivableReason, Unfulfilled, }; use roc_std::RocDec; use roc_types::pretty_print::{Parens, WILDCARD}; From 418731cb71918502fdc93d5c569ba6c6b675703c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 26 Jan 2024 16:25:32 -0500 Subject: [PATCH 47/80] Update mono tests --- ...e_in_polymorphic_expression_issue_4717.txt | 12 +- .../test_mono/generated/binary_tree_fbip.txt | 4 +- .../generated/capture_void_layout_task.txt | 8 +- ...ose_correct_recursion_var_under_record.txt | 4 +- .../generated/choose_i128_layout.txt | 4 +- .../generated/choose_u128_layout.txt | 4 +- .../test_mono/generated/choose_u64_layout.txt | 4 +- ...lambda_set_productive_nullable_wrapped.txt | 12 +- .../test_mono/generated/dbg_in_expect.txt | 78 +- .../generated/dbg_str_followed_by_number.txt | 78 +- crates/compiler/test_mono/generated/dict.txt | 42 +- .../generated/empty_list_of_function_type.txt | 4 +- .../encode_derived_nested_record_string.txt | 129 +- ...encode_derived_record_one_field_string.txt | 93 +- ...ncode_derived_record_two_field_strings.txt | 93 +- .../generated/encode_derived_string.txt | 85 +- .../encode_derived_tag_one_field_string.txt | 97 +- ...encode_derived_tag_two_payloads_string.txt | 123 +- .../test_mono/generated/factorial.txt | 8 +- ...zation_information_in_lambda_set_thunk.txt | 4 +- ...n_in_lambda_set_thunk_independent_defs.txt | 4 +- ...e_return_joinpoints_in_bool_lambda_set.txt | 4 +- ...e_return_joinpoints_in_enum_lambda_set.txt | 4 +- ..._return_joinpoints_in_union_lambda_set.txt | 4 +- .../generated/inspect_derived_dict.txt | 1740 ++++++++--------- .../generated/inspect_derived_list.txt | 196 +- .../inspect_derived_nested_record_string.txt | 300 +-- .../generated/inspect_derived_record.txt | 236 +-- ...nspect_derived_record_one_field_string.txt | 194 +- ...spect_derived_record_two_field_strings.txt | 196 +- .../generated/inspect_derived_string.txt | 78 +- .../inspect_derived_tag_one_field_string.txt | 208 +- ...nspect_derived_tag_two_payloads_string.txt | 206 +- .../test_mono/generated/ir_int_add.txt | 4 +- .../compiler/test_mono/generated/ir_plus.txt | 4 +- .../compiler/test_mono/generated/ir_round.txt | 4 +- .../test_mono/generated/ir_two_defs.txt | 4 +- .../test_mono/generated/ir_when_idiv.txt | 28 +- .../test_mono/generated/ir_when_just.txt | 4 +- ...cialize_errors_behind_unified_branches.txt | 40 +- .../test_mono/generated/issue_4749.txt | 81 +- .../test_mono/generated/issue_4770.txt | 12 +- ..._4772_weakened_monomorphic_destructure.txt | 123 +- .../test_mono/generated/issue_6196.txt | 4 +- .../lambda_capture_niche_u8_vs_u64.txt | 8 +- ...set_with_imported_toplevels_issue_4733.txt | 8 +- ...ure_with_multiple_recursive_structures.txt | 8 +- .../generated/linked_list_filter.txt | 12 +- .../test_mono/generated/linked_list_map.txt | 4 +- .../generated/list_cannot_update_inplace.txt | 8 +- .../compiler/test_mono/generated/list_get.txt | 4 +- .../compiler/test_mono/generated/list_len.txt | 4 +- .../generated/list_map_closure_borrows.txt | 12 +- .../generated/list_map_closure_owns.txt | 8 +- ...ist_map_take_capturing_or_noncapturing.txt | 4 +- .../generated/list_pass_to_function.txt | 4 +- .../test_mono/generated/list_sort_asc.txt | 4 +- .../generated/multiline_record_pattern.txt | 4 +- .../nested_optional_field_with_binary_op.txt | 4 +- .../generated/nested_pattern_match.txt | 4 +- .../num_width_gt_u8_layout_as_float.txt | 4 +- .../optional_field_with_binary_op.txt | 4 +- .../test_mono/generated/optional_when.txt | 4 +- .../polymorphic_expression_unification.txt | 4 +- .../test_mono/generated/quicksort_help.txt | 12 +- .../test_mono/generated/quicksort_swap.txt | 4 +- .../test_mono/generated/rb_tree_fbip.txt | 8 +- ...optional_field_function_no_use_default.txt | 4 +- ...rd_optional_field_function_use_default.txt | 4 +- ...cord_optional_field_let_no_use_default.txt | 4 +- .../record_optional_field_let_use_default.txt | 4 +- .../test_mono/generated/record_update.txt | 4 +- .../recursive_call_capturing_function.txt | 4 +- ..._set_resolved_only_upon_specialization.txt | 8 +- .../generated/recursively_build_effect.txt | 8 +- .../compiler/test_mono/generated/rigids.txt | 4 +- .../generated/specialize_after_match.txt | 8 +- .../generated/specialize_closures.txt | 8 +- .../generated/specialize_lowlevel.txt | 8 +- .../generated/tail_call_elimination.txt | 8 +- ...not_duplicate_identical_concrete_types.txt | 46 +- ...types_without_unification_of_unifiable.txt | 24 +- .../weakening_avoids_overspecialization.txt | 12 +- ...s_in_compiled_decision_tree_issue_5176.txt | 4 +- .../test_mono/generated/when_nested_maybe.txt | 4 +- .../test_mono/generated/when_on_record.txt | 4 +- .../generated/when_on_two_values.txt | 4 +- .../specialize/inspect/opaque_automatic.txt | 74 +- .../inspect/opaque_automatic_late.txt | 64 +- ...ralization_among_large_recursive_group.txt | 14 +- crates/compiler/uitest/tests/solve/to_int.txt | 2 +- 91 files changed, 2485 insertions(+), 2547 deletions(-) diff --git a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt index ed2b90def13..552c31ab2ae 100644 --- a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt +++ b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt @@ -78,16 +78,16 @@ procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. jump List.591 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.51 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.259; procedure Num.77 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.258; procedure Test.1 (Test.2): let Test.13 : U64 = 0i64; diff --git a/crates/compiler/test_mono/generated/binary_tree_fbip.txt b/crates/compiler/test_mono/generated/binary_tree_fbip.txt index 31634da379d..090fcd842bc 100644 --- a/crates/compiler/test_mono/generated/binary_tree_fbip.txt +++ b/crates/compiler/test_mono/generated/binary_tree_fbip.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.4 (Test.27): let Test.39 : [C [, C *self *self] *self, ] = TagId(0) ; diff --git a/crates/compiler/test_mono/generated/capture_void_layout_task.txt b/crates/compiler/test_mono/generated/capture_void_layout_task.txt index f37eb13c23f..bd09788256e 100644 --- a/crates/compiler/test_mono/generated/capture_void_layout_task.txt +++ b/crates/compiler/test_mono/generated/capture_void_layout_task.txt @@ -28,12 +28,12 @@ procedure List.90 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen. jump List.574 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Test.10 (Test.69, #Attr.12): let Test.72 : {} = UnionAtIndex (Id 0) (Index 0) #Attr.12; diff --git a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt index 13016a7456a..76fb95bcbf0 100644 --- a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt +++ b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt @@ -47,8 +47,8 @@ procedure List.9 (List.333): ret List.573; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Result.5 (Result.12, Result.13): let Result.39 : U8 = 1i64; diff --git a/crates/compiler/test_mono/generated/choose_i128_layout.txt b/crates/compiler/test_mono/generated/choose_i128_layout.txt index 39f25921da9..a8df0f6aeb4 100644 --- a/crates/compiler/test_mono/generated/choose_i128_layout.txt +++ b/crates/compiler/test_mono/generated/choose_i128_layout.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : I128 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I128 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Test.0 (): let Test.6 : I128 = 18446744073709551616i64; diff --git a/crates/compiler/test_mono/generated/choose_u128_layout.txt b/crates/compiler/test_mono/generated/choose_u128_layout.txt index 47b5f28dd82..cbed3ede38e 100644 --- a/crates/compiler/test_mono/generated/choose_u128_layout.txt +++ b/crates/compiler/test_mono/generated/choose_u128_layout.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U128 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U128 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.2 : U128 = 170141183460469231731687303715884105728u128; diff --git a/crates/compiler/test_mono/generated/choose_u64_layout.txt b/crates/compiler/test_mono/generated/choose_u64_layout.txt index 840ad966031..8f967decc8f 100644 --- a/crates/compiler/test_mono/generated/choose_u64_layout.txt +++ b/crates/compiler/test_mono/generated/choose_u64_layout.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.2 : U64 = 9999999999999999999i64; 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 545da506d9d..9b42fe8f6dc 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 @@ -32,16 +32,16 @@ procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; procedure Test.1 (Test.5): ret Test.5; diff --git a/crates/compiler/test_mono/generated/dbg_in_expect.txt b/crates/compiler/test_mono/generated/dbg_in_expect.txt index b4825a08963..a4e869f195c 100644 --- a/crates/compiler/test_mono/generated/dbg_in_expect.txt +++ b/crates/compiler/test_mono/generated/dbg_in_expect.txt @@ -2,52 +2,52 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.327 : Str = "\""; - let Inspect.326 : Str = CallByName Inspect.61 Inspect.252 Inspect.327; - let Inspect.322 : Str = CallByName Inspect.61 Inspect.326 Inspect.250; - let Inspect.323 : Str = "\""; - let Inspect.321 : Str = CallByName Inspect.61 Inspect.322 Inspect.323; - ret Inspect.321; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.44 (Inspect.250): - let Inspect.317 : Str = CallByName Inspect.30 Inspect.250; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.319 : Str = "\""; + let Inspect.318 : Str = CallByName Inspect.59 Inspect.247 Inspect.319; + let Inspect.314 : Str = CallByName Inspect.59 Inspect.318 Inspect.245; + let Inspect.315 : Str = "\""; + let Inspect.313 : Str = CallByName Inspect.59 Inspect.314 Inspect.315; + ret Inspect.313; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.43 (Inspect.245): + let Inspect.309 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.309; + +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName Inspect.43 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Inspect.246 Inspect.304 Inspect.308; + ret Inspect.303; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.317 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; ret Inspect.317; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName Inspect.44 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Inspect.251 Inspect.312 Inspect.316; - ret Inspect.311; - -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.325 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.325; - -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.1 (): let Test.4 : Str = ""; - let Test.0 : Str = CallByName Inspect.34 Test.4; + let Test.0 : Str = CallByName Inspect.33 Test.4; dbg Test.0; dec Test.0; let Test.3 : Int1 = CallByName Bool.2; 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 ec5f37b7071..1836a44aeea 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 @@ -1,49 +1,49 @@ -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.327 : Str = "\""; - let Inspect.326 : Str = CallByName Inspect.61 Inspect.252 Inspect.327; - let Inspect.322 : Str = CallByName Inspect.61 Inspect.326 Inspect.250; - let Inspect.323 : Str = "\""; - let Inspect.321 : Str = CallByName Inspect.61 Inspect.322 Inspect.323; - ret Inspect.321; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.44 (Inspect.250): - let Inspect.317 : Str = CallByName Inspect.30 Inspect.250; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.319 : Str = "\""; + let Inspect.318 : Str = CallByName Inspect.59 Inspect.247 Inspect.319; + let Inspect.314 : Str = CallByName Inspect.59 Inspect.318 Inspect.245; + let Inspect.315 : Str = "\""; + let Inspect.313 : Str = CallByName Inspect.59 Inspect.314 Inspect.315; + ret Inspect.313; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.43 (Inspect.245): + let Inspect.309 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.309; + +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName Inspect.43 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Inspect.246 Inspect.304 Inspect.308; + ret Inspect.303; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.317 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; ret Inspect.317; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName Inspect.44 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Inspect.251 Inspect.312 Inspect.316; - ret Inspect.311; - -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.325 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.325; - -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.3 : Str = ""; - let Test.1 : Str = CallByName Inspect.34 Test.3; + let Test.1 : Str = CallByName Inspect.33 Test.3; dbg Test.1; dec Test.1; let Test.2 : I64 = 42i64; diff --git a/crates/compiler/test_mono/generated/dict.txt b/crates/compiler/test_mono/generated/dict.txt index 4d5eb9d5e8a..168d2f15e16 100644 --- a/crates/compiler/test_mono/generated/dict.txt +++ b/crates/compiler/test_mono/generated/dict.txt @@ -1,37 +1,37 @@ -procedure Dict.1 (Dict.726): - let Dict.735 : List {U32, U32} = Array []; - let Dict.736 : List {[], []} = Array []; - let Dict.737 : U64 = 0i64; +procedure Dict.1 (Dict.723): + let Dict.732 : List {U32, U32} = Array []; + let Dict.733 : List {[], []} = Array []; + let Dict.734 : U64 = 0i64; let Dict.44 : Float32 = CallByName Dict.44; let Dict.45 : U8 = CallByName Dict.45; - let Dict.734 : {List {U32, U32}, List {[], []}, U64, Float32, U8} = Struct {Dict.735, Dict.736, Dict.737, Dict.44, Dict.45}; - ret Dict.734; + let Dict.731 : {List {U32, U32}, List {[], []}, U64, Float32, U8} = Struct {Dict.732, Dict.733, Dict.734, Dict.44, Dict.45}; + ret Dict.731; -procedure Dict.4 (Dict.732): - let Dict.157 : List {[], []} = StructAtIndex 1 Dict.732; - let #Derived_gen.0 : List {U32, U32} = StructAtIndex 0 Dict.732; +procedure Dict.4 (Dict.729): + let Dict.156 : List {[], []} = StructAtIndex 1 Dict.729; + let #Derived_gen.0 : List {U32, U32} = StructAtIndex 0 Dict.729; dec #Derived_gen.0; - let Dict.733 : U64 = CallByName List.6 Dict.157; - dec Dict.157; - ret Dict.733; + let Dict.730 : U64 = CallByName List.6 Dict.156; + dec Dict.156; + ret Dict.730; procedure Dict.44 (): - let Dict.741 : Float32 = 0.8f64; - ret Dict.741; + let Dict.738 : Float32 = 0.8f64; + ret Dict.738; procedure Dict.45 (): - let Dict.739 : U8 = 64i64; - let Dict.740 : U8 = 3i64; - let Dict.738 : U8 = CallByName Num.20 Dict.739 Dict.740; - ret Dict.738; + let Dict.736 : U8 = 64i64; + let Dict.737 : U8 = 3i64; + let Dict.735 : U8 = CallByName Num.75 Dict.736 Dict.737; + ret Dict.735; procedure List.6 (#Attr.2): let List.571 : U64 = lowlevel ListLen #Attr.2; ret List.571; -procedure Num.20 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.297; +procedure Num.75 (#Attr.2, #Attr.3): + let Num.257 : U8 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.3 : {} = Struct {}; diff --git a/crates/compiler/test_mono/generated/empty_list_of_function_type.txt b/crates/compiler/test_mono/generated/empty_list_of_function_type.txt index f4112fae23b..519f8173409 100644 --- a/crates/compiler/test_mono/generated/empty_list_of_function_type.txt +++ b/crates/compiler/test_mono/generated/empty_list_of_function_type.txt @@ -25,8 +25,8 @@ procedure List.66 (#Attr.2, #Attr.3): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Test.2 (Test.5): dec Test.5; 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 878b6ae4ee8..0d2b5216f4a 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 @@ -176,7 +176,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.658 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.658; -procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): +procedure List.80 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): joinpoint List.685 List.489 List.490 List.491 List.492 List.493: let List.687 : Int1 = CallByName Num.22 List.492 List.493; if List.687 then @@ -200,25 +200,9 @@ procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_g let List.686 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.686; in - jump List.685 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + jump List.685 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; -procedure List.90 (#Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37, #Derived_gen.38): - joinpoint List.629 List.161 List.162 List.163 List.164 List.165: - let List.631 : Int1 = CallByName Num.22 List.164 List.165; - if List.631 then - let List.635 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.635; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.635; - let List.634 : U64 = 1i64; - let List.633 : U64 = CallByName Num.51 List.164 List.634; - jump List.629 List.161 List.166 List.163 List.633 List.165; - else - dec List.161; - ret List.162; - in - jump List.629 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38; - -procedure List.90 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43): +procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): joinpoint List.641 List.161 List.162 List.163 List.164 List.165: let List.643 : Int1 = CallByName Num.22 List.164 List.165; if List.643 then @@ -231,9 +215,9 @@ procedure List.90 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_g dec List.161; ret List.162; in - jump List.641 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43; + jump List.641 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; -procedure List.90 (#Derived_gen.47, #Derived_gen.48, #Derived_gen.49, #Derived_gen.50, #Derived_gen.51): +procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -247,74 +231,85 @@ procedure List.90 (#Derived_gen.47, #Derived_gen.48, #Derived_gen.49, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51; + jump List.595 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; + +procedure List.90 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49): + joinpoint List.629 List.161 List.162 List.163 List.164 List.165: + let List.631 : Int1 = CallByName Num.22 List.164 List.165; + if List.631 then + let List.635 : {Str, Str} = CallByName List.66 List.161 List.164; + inc List.635; + let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.635; + let List.634 : U64 = 1i64; + let List.633 : U64 = CallByName Num.51 List.164 List.634; + jump List.629 List.161 List.166 List.163 List.633 List.165; + else + dec List.161; + ret List.162; + in + jump List.629 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49; procedure Num.127 (#Attr.2): - let Num.313 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.313; + let Num.272 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.272; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.277 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.277; procedure Num.19 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.317; + let Num.276 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.276; procedure Num.20 (#Attr.2, #Attr.3): - let Num.314 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.314; + let Num.273 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.273; procedure Num.21 (#Attr.2, #Attr.3): - let Num.319 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.319; + let Num.278 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.278; procedure Num.22 (#Attr.2, #Attr.3): - let Num.325 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.325; + let Num.284 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.284; procedure Num.24 (#Attr.2, #Attr.3): - let Num.327 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.327; + let Num.286 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.286; procedure Num.51 (#Attr.2, #Attr.3): - let Num.322 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.322; + let Num.281 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.281; procedure Num.75 (#Attr.2, #Attr.3): - let Num.326 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.326; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.318 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.318; + let Num.285 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.285; procedure Str.12 (#Attr.2): - let Str.263 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.263; + let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.261; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.55 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.55 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.55; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1043, TotallyNotJson.149): let TotallyNotJson.1046 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -521,7 +516,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1088 : U64 = 120i64; let TotallyNotJson.1085 : U64 = CallByName Num.21 TotallyNotJson.1087 TotallyNotJson.1088; let TotallyNotJson.1086 : U64 = 100i64; - let TotallyNotJson.1084 : U64 = CallByName Num.94 TotallyNotJson.1085 TotallyNotJson.1086; + let TotallyNotJson.1084 : U64 = CallByName Num.137 TotallyNotJson.1085 TotallyNotJson.1086; let TotallyNotJson.1081 : List U8 = CallByName List.68 TotallyNotJson.1084; let TotallyNotJson.1083 : U8 = 34i64; let TotallyNotJson.1082 : List U8 = Array [TotallyNotJson.1083]; 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 61f5a941b93..f490436920c 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 @@ -135,7 +135,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.624; -procedure List.80 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25): +procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): joinpoint List.651 List.489 List.490 List.491 List.492 List.493: let List.653 : Int1 = CallByName Num.22 List.492 List.493; if List.653 then @@ -159,7 +159,7 @@ procedure List.80 (#Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_g let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.652; in - jump List.651 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25; + jump List.651 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): joinpoint List.607 List.161 List.162 List.163 List.164 List.165: @@ -176,7 +176,7 @@ procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_g in jump List.607 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; -procedure List.90 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33): +procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -190,74 +190,69 @@ procedure List.90 (#Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33; + jump List.595 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; procedure Num.127 (#Attr.2): - let Num.303 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.303; + let Num.262 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.262; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.267 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.267; procedure Num.19 (#Attr.2, #Attr.3): - let Num.307 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.307; + let Num.266 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.266; procedure Num.20 (#Attr.2, #Attr.3): - let Num.304 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.304; + let Num.263 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.263; procedure Num.21 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.309; + let Num.268 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.268; procedure Num.22 (#Attr.2, #Attr.3): - let Num.315 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.315; + let Num.274 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.274; procedure Num.24 (#Attr.2, #Attr.3): - let Num.317 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.317; + let Num.276 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.276; procedure Num.51 (#Attr.2, #Attr.3): - let Num.312 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.312; + let Num.271 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.271; procedure Num.75 (#Attr.2, #Attr.3): - let Num.316 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.316; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.308; + let Num.275 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.275; procedure Str.12 (#Attr.2): - let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.262; + let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.260; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.34 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.34 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.34; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -416,7 +411,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1054 : U64 = 120i64; let TotallyNotJson.1051 : U64 = CallByName Num.21 TotallyNotJson.1053 TotallyNotJson.1054; let TotallyNotJson.1052 : U64 = 100i64; - let TotallyNotJson.1050 : U64 = CallByName Num.94 TotallyNotJson.1051 TotallyNotJson.1052; + let TotallyNotJson.1050 : U64 = CallByName Num.137 TotallyNotJson.1051 TotallyNotJson.1052; let TotallyNotJson.1047 : List U8 = CallByName List.68 TotallyNotJson.1050; let TotallyNotJson.1049 : U8 = 34i64; let TotallyNotJson.1048 : List U8 = Array [TotallyNotJson.1049]; 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 5e796e4e049..71b92261985 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 @@ -142,7 +142,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.624; -procedure List.80 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29): +procedure List.80 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): joinpoint List.651 List.489 List.490 List.491 List.492 List.493: let List.653 : Int1 = CallByName Num.22 List.492 List.493; if List.653 then @@ -166,7 +166,7 @@ procedure List.80 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_g let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.652; in - jump List.651 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29; + jump List.651 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): joinpoint List.607 List.161 List.162 List.163 List.164 List.165: @@ -183,7 +183,7 @@ procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_g in jump List.607 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; -procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37): +procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): joinpoint List.595 List.161 List.162 List.163 List.164 List.165: let List.597 : Int1 = CallByName Num.22 List.164 List.165; if List.597 then @@ -197,74 +197,69 @@ procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_g dec List.161; ret List.162; in - jump List.595 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37; + jump List.595 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; procedure Num.127 (#Attr.2): - let Num.303 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.303; + let Num.262 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.262; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.267 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.267; procedure Num.19 (#Attr.2, #Attr.3): - let Num.307 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.307; + let Num.266 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.266; procedure Num.20 (#Attr.2, #Attr.3): - let Num.304 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.304; + let Num.263 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.263; procedure Num.21 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.309; + let Num.268 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.268; procedure Num.22 (#Attr.2, #Attr.3): - let Num.315 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.315; + let Num.274 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.274; procedure Num.24 (#Attr.2, #Attr.3): - let Num.317 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.317; + let Num.276 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.276; procedure Num.51 (#Attr.2, #Attr.3): - let Num.312 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.312; + let Num.271 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.271; procedure Num.75 (#Attr.2, #Attr.3): - let Num.316 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.316; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.308; + let Num.275 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.275; procedure Str.12 (#Attr.2): - let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.262; + let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.260; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.38 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.38 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.38; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -423,7 +418,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1054 : U64 = 120i64; let TotallyNotJson.1051 : U64 = CallByName Num.21 TotallyNotJson.1053 TotallyNotJson.1054; let TotallyNotJson.1052 : U64 = 100i64; - let TotallyNotJson.1050 : U64 = CallByName Num.94 TotallyNotJson.1051 TotallyNotJson.1052; + let TotallyNotJson.1050 : U64 = CallByName Num.137 TotallyNotJson.1051 TotallyNotJson.1052; let TotallyNotJson.1047 : List U8 = CallByName List.68 TotallyNotJson.1050; let TotallyNotJson.1049 : U8 = 34i64; let TotallyNotJson.1048 : List U8 = Array [TotallyNotJson.1049]; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index 10d85738259..5ef83dc113d 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -80,7 +80,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.579 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.579; -procedure List.80 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): +procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): joinpoint List.616 List.489 List.490 List.491 List.492 List.493: let List.618 : Int1 = CallByName Num.22 List.492 List.493; if List.618 then @@ -104,9 +104,9 @@ procedure List.80 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen let List.617 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.617; in - jump List.616 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; + jump List.616 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; -procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): +procedure List.90 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): joinpoint List.587 List.161 List.162 List.163 List.164 List.165: let List.589 : Int1 = CallByName Num.22 List.164 List.165; if List.589 then @@ -119,66 +119,61 @@ procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. dec List.161; ret List.162; in - jump List.587 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.587 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.259 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.259; procedure Num.19 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.299; + let Num.258 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Num.21 (#Attr.2, #Attr.3): - let Num.301 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.301; + let Num.260 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.260; procedure Num.22 (#Attr.2, #Attr.3): - let Num.305 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.305; + let Num.264 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.264; procedure Num.24 (#Attr.2, #Attr.3): - let Num.307 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.307; + let Num.266 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.266; procedure Num.51 (#Attr.2, #Attr.3): - let Num.303 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.303; + let Num.262 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.262; procedure Num.75 (#Attr.2, #Attr.3): - let Num.306 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.306; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.300 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.300; + let Num.265 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.265; procedure Str.12 (#Attr.2): - let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.261; - -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + let Str.259 : List U8 = lowlevel StrToUtf8 #Attr.2; ret Str.259; -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; +procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.13 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.13 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.13; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.973, TotallyNotJson.149): let TotallyNotJson.976 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -289,7 +284,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1018 : U64 = 120i64; let TotallyNotJson.1015 : U64 = CallByName Num.21 TotallyNotJson.1017 TotallyNotJson.1018; let TotallyNotJson.1016 : U64 = 100i64; - let TotallyNotJson.1014 : U64 = CallByName Num.94 TotallyNotJson.1015 TotallyNotJson.1016; + let TotallyNotJson.1014 : U64 = CallByName Num.137 TotallyNotJson.1015 TotallyNotJson.1016; let TotallyNotJson.1011 : List U8 = CallByName List.68 TotallyNotJson.1014; let TotallyNotJson.1013 : U8 = 34i64; let TotallyNotJson.1012 : List U8 = Array [TotallyNotJson.1013]; 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 cf16a9ff1bd..e919eb7eb37 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 @@ -137,7 +137,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.633; -procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): +procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): joinpoint List.657 List.489 List.490 List.491 List.492 List.493: let List.659 : Int1 = CallByName Num.22 List.492 List.493; if List.659 then @@ -161,9 +161,9 @@ procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_g let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.658; in - jump List.657 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.657 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; -procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): +procedure List.90 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): joinpoint List.613 List.161 List.162 List.163 List.164 List.165: let List.615 : Int1 = CallByName Num.22 List.164 List.165; if List.615 then @@ -176,9 +176,9 @@ procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_g dec List.161; ret List.162; in - jump List.613 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + jump List.613 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; -procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): +procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): joinpoint List.601 List.161 List.162 List.163 List.164 List.165: let List.603 : Int1 = CallByName Num.22 List.164 List.165; if List.603 then @@ -192,74 +192,69 @@ procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_g dec List.161; ret List.162; in - jump List.601 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + jump List.601 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure Num.127 (#Attr.2): - let Num.305 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.305; + let Num.264 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.264; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.269 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.269; procedure Num.19 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.309; + let Num.268 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.268; procedure Num.20 (#Attr.2, #Attr.3): - let Num.306 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.306; + let Num.265 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.265; procedure Num.21 (#Attr.2, #Attr.3): - let Num.311 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.311; + let Num.270 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.270; procedure Num.22 (#Attr.2, #Attr.3): - let Num.317 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.317; + let Num.276 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.276; procedure Num.24 (#Attr.2, #Attr.3): - let Num.319 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.319; + let Num.278 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.278; procedure Num.51 (#Attr.2, #Attr.3): - let Num.314 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.314; + let Num.273 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.273; procedure Num.75 (#Attr.2, #Attr.3): - let Num.318 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.318; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.310 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.310; + let Num.277 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.277; procedure Str.12 (#Attr.2): - let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.262; + let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.260; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.34 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.34 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.34; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -424,7 +419,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1059 : U64 = 120i64; let TotallyNotJson.1056 : U64 = CallByName Num.21 TotallyNotJson.1058 TotallyNotJson.1059; let TotallyNotJson.1057 : U64 = 100i64; - let TotallyNotJson.1055 : U64 = CallByName Num.94 TotallyNotJson.1056 TotallyNotJson.1057; + let TotallyNotJson.1055 : U64 = CallByName Num.137 TotallyNotJson.1056 TotallyNotJson.1057; let TotallyNotJson.1052 : List U8 = CallByName List.68 TotallyNotJson.1055; let TotallyNotJson.1054 : U8 = 34i64; let TotallyNotJson.1053 : List U8 = Array [TotallyNotJson.1054]; 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 586c1e022de..5a0b2933969 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 @@ -140,7 +140,7 @@ procedure List.8 (#Attr.2, #Attr.3): let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; ret List.633; -procedure List.80 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): +procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): joinpoint List.657 List.489 List.490 List.491 List.492 List.493: let List.659 : Int1 = CallByName Num.22 List.492 List.493; if List.659 then @@ -164,24 +164,9 @@ procedure List.80 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_g let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; ret List.658; in - jump List.657 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; + jump List.657 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; -procedure List.90 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint List.613 List.161 List.162 List.163 List.164 List.165: - let List.615 : Int1 = CallByName Num.22 List.164 List.165; - if List.615 then - let List.619 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; - let List.618 : U64 = 1i64; - let List.617 : U64 = CallByName Num.51 List.164 List.618; - jump List.613 List.161 List.166 List.163 List.617 List.165; - else - dec List.161; - ret List.162; - in - jump List.613 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; - -procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): +procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): joinpoint List.601 List.161 List.162 List.163 List.164 List.165: let List.603 : Int1 = CallByName Num.22 List.164 List.165; if List.603 then @@ -195,74 +180,84 @@ procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_g dec List.161; ret List.162; in - jump List.601 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; + jump List.601 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; + +procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): + joinpoint List.613 List.161 List.162 List.163 List.164 List.165: + let List.615 : Int1 = CallByName Num.22 List.164 List.165; + if List.615 then + let List.619 : U8 = CallByName List.66 List.161 List.164; + let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; + let List.618 : U64 = 1i64; + let List.617 : U64 = CallByName Num.51 List.164 List.618; + jump List.613 List.161 List.166 List.163 List.617 List.165; + else + dec List.161; + ret List.162; + in + jump List.613 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.127 (#Attr.2): - let Num.305 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.305; + let Num.264 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.264; -procedure Num.133 (#Attr.2): - let Num.297 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.297; +procedure Num.137 (#Attr.2, #Attr.3): + let Num.269 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.269; procedure Num.19 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.309; + let Num.268 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.268; procedure Num.20 (#Attr.2, #Attr.3): - let Num.306 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.306; + let Num.265 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.265; procedure Num.21 (#Attr.2, #Attr.3): - let Num.311 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.311; + let Num.270 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.270; procedure Num.22 (#Attr.2, #Attr.3): - let Num.317 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.317; + let Num.276 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.276; procedure Num.24 (#Attr.2, #Attr.3): - let Num.319 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.319; + let Num.278 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.278; procedure Num.51 (#Attr.2, #Attr.3): - let Num.314 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.314; + let Num.273 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.273; procedure Num.75 (#Attr.2, #Attr.3): - let Num.318 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.318; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.310 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.310; + let Num.277 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.277; procedure Str.12 (#Attr.2): - let Str.262 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.262; + let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.260; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.35 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.35 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.35; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; @@ -427,7 +422,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1059 : U64 = 120i64; let TotallyNotJson.1056 : U64 = CallByName Num.21 TotallyNotJson.1058 TotallyNotJson.1059; let TotallyNotJson.1057 : U64 = 100i64; - let TotallyNotJson.1055 : U64 = CallByName Num.94 TotallyNotJson.1056 TotallyNotJson.1057; + let TotallyNotJson.1055 : U64 = CallByName Num.137 TotallyNotJson.1056 TotallyNotJson.1057; let TotallyNotJson.1052 : List U8 = CallByName List.68 TotallyNotJson.1055; let TotallyNotJson.1054 : U8 = 34i64; let TotallyNotJson.1053 : List U8 = Array [TotallyNotJson.1054]; diff --git a/crates/compiler/test_mono/generated/factorial.txt b/crates/compiler/test_mono/generated/factorial.txt index 0f73193b25b..4aacc53e8b4 100644 --- a/crates/compiler/test_mono/generated/factorial.txt +++ b/crates/compiler/test_mono/generated/factorial.txt @@ -1,10 +1,10 @@ procedure Num.20 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.258; procedure Num.21 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.7 Test.2 Test.3: diff --git a/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk.txt b/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk.txt index 48f1304f3fe..4289aceb743 100644 --- a/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk.txt +++ b/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.8): let Test.3 : I64 = 10i64; diff --git a/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk_independent_defs.txt b/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk_independent_defs.txt index b2dae41b31c..6a7cd92a079 100644 --- a/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk_independent_defs.txt +++ b/crates/compiler/test_mono/generated/function_specialization_information_in_lambda_set_thunk_independent_defs.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Test.1 (Test.9): let Test.4 : U8 = 10i64; diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt index 9ac4b4d4bbb..0a0cce908b8 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_bool_lambda_set.txt @@ -3,8 +3,8 @@ procedure Bool.1 (): ret Bool.23; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.3 (Test.4): ret Test.4; diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt index 63edb1562b4..61e5f6afbb4 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_enum_lambda_set.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.299 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.259; procedure Test.2 (Test.3): switch Test.3: diff --git a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt index df9435ae648..035cef5b52d 100644 --- a/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt +++ b/crates/compiler/test_mono/generated/inline_return_joinpoints_in_union_lambda_set.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Test.2 (Test.3, Test.1): let Test.18 : Int1 = false; diff --git a/crates/compiler/test_mono/generated/inspect_derived_dict.txt b/crates/compiler/test_mono/generated/inspect_derived_dict.txt index 90443778cba..3505537b300 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_dict.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_dict.txt @@ -34,861 +34,851 @@ procedure Bool.7 (Bool.19, Bool.20): let Bool.27 : Int1 = CallByName Bool.12 Bool.19 Bool.20; ret Bool.27; -procedure Dict.1 (Dict.726): - let Dict.896 : List {U32, U32} = Array []; - let Dict.897 : List {Str, I64} = Array []; - let Dict.898 : U64 = 0i64; +procedure Dict.1 (Dict.723): + let Dict.885 : List {U32, U32} = Array []; + let Dict.886 : List {Str, I64} = Array []; + let Dict.887 : U64 = 0i64; let Dict.44 : Float32 = CallByName Dict.44; let Dict.45 : U8 = CallByName Dict.45; - let Dict.895 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.896, Dict.897, Dict.898, Dict.44, Dict.45}; - ret Dict.895; + let Dict.884 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.885, Dict.886, Dict.887, Dict.44, Dict.45}; + ret Dict.884; -procedure Dict.10 (Dict.727, Dict.180, Dict.181): - let Dict.179 : List {Str, I64} = StructAtIndex 1 Dict.727; - let #Derived_gen.68 : List {U32, U32} = StructAtIndex 0 Dict.727; - dec #Derived_gen.68; - let Dict.1113 : {Str, Int1} = CallByName List.18 Dict.179 Dict.180 Dict.181; - ret Dict.1113; +procedure Dict.10 (Dict.724, Dict.179, Dict.180): + let Dict.178 : List {Str, I64} = StructAtIndex 1 Dict.724; + let #Derived_gen.71 : List {U32, U32} = StructAtIndex 0 Dict.724; + dec #Derived_gen.71; + let Dict.1101 : {Str, Int1} = CallByName List.18 Dict.178 Dict.179 Dict.180; + ret Dict.1101; -procedure Dict.12 (Dict.152): - let Dict.894 : {} = Struct {}; - let Dict.734 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.1 Dict.894; - let Dict.735 : {} = Struct {}; - let Dict.733 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.18 Dict.152 Dict.734 Dict.735; - ret Dict.733; +procedure Dict.12 (Dict.151): + let Dict.883 : {} = Struct {}; + let Dict.731 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.1 Dict.883; + let Dict.732 : {} = Struct {}; + let Dict.730 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.18 Dict.151 Dict.731 Dict.732; + ret Dict.730; procedure Dict.120 (Dict.121, Dict.119): - let Dict.1110 : {} = Struct {}; - let Dict.1111 : {} = Struct {}; - let Dict.1112 : {} = Struct {}; - let Dict.1109 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = CallByName Inspect.39 Dict.119 Dict.1110 Dict.1111 Dict.1112; - let Dict.1108 : Str = CallByName Inspect.31 Dict.1109 Dict.121; - ret Dict.1108; - -procedure Dict.153 (Dict.154, Dict.736): - let Dict.155 : Str = StructAtIndex 0 Dict.736; - let Dict.156 : I64 = StructAtIndex 1 Dict.736; - let Dict.737 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.8 Dict.154 Dict.155 Dict.156; - ret Dict.737; - -procedure Dict.182 (Dict.183, Dict.1115, Dict.181): - let Dict.184 : Str = StructAtIndex 0 Dict.1115; - let Dict.185 : I64 = StructAtIndex 1 Dict.1115; - let Dict.1117 : {Str, Int1} = CallByName Inspect.192 Dict.183 Dict.184 Dict.185 Dict.181; - ret Dict.1117; - -procedure Dict.20 (Dict.723): - let Dict.149 : U64 = StructAtIndex 2 Dict.723; - let #Derived_gen.70 : List {U32, U32} = StructAtIndex 0 Dict.723; - dec #Derived_gen.70; - let #Derived_gen.69 : List {Str, I64} = StructAtIndex 1 Dict.723; + let Dict.1098 : {} = Struct {}; + let Dict.1099 : {} = Struct {}; + let Dict.1100 : {} = Struct {}; + let Dict.1097 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = CallByName Inspect.38 Dict.119 Dict.1098 Dict.1099 Dict.1100; + let Dict.1096 : Str = CallByName Inspect.31 Dict.1097 Dict.121; + ret Dict.1096; + +procedure Dict.152 (Dict.153, Dict.733): + let Dict.154 : Str = StructAtIndex 0 Dict.733; + let Dict.155 : I64 = StructAtIndex 1 Dict.733; + let Dict.734 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.8 Dict.153 Dict.154 Dict.155; + ret Dict.734; + +procedure Dict.181 (Dict.182, Dict.1103, Dict.180): + let Dict.183 : Str = StructAtIndex 0 Dict.1103; + let Dict.184 : I64 = StructAtIndex 1 Dict.1103; + let Dict.1105 : {Str, Int1} = CallByName Inspect.187 Dict.182 Dict.183 Dict.184 Dict.180; + ret Dict.1105; + +procedure Dict.20 (Dict.720): + let Dict.148 : U64 = StructAtIndex 2 Dict.720; + let #Derived_gen.69 : List {U32, U32} = StructAtIndex 0 Dict.720; dec #Derived_gen.69; - let Dict.892 : U64 = CallByName Num.137 Dict.149; - ret Dict.892; + let #Derived_gen.68 : List {Str, I64} = StructAtIndex 1 Dict.720; + dec #Derived_gen.68; + ret Dict.148; procedure Dict.22 (#Attr.2, #Attr.3): - let Dict.771 : {U32, U32} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret Dict.771; + let Dict.765 : {U32, U32} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret Dict.765; procedure Dict.22 (#Attr.2, #Attr.3): - let Dict.787 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret Dict.787; + let Dict.781 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret Dict.781; procedure Dict.22 (#Attr.2, #Attr.3): - let Dict.956 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret Dict.956; + let Dict.944 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret Dict.944; procedure Dict.23 (#Attr.2): - let Dict.825 : U64 = lowlevel DictPseudoSeed #Attr.2; - ret Dict.825; + let Dict.817 : U64 = lowlevel DictPseudoSeed #Attr.2; + ret Dict.817; procedure Dict.36 (Dict.119): - let Dict.1105 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Inspect.30 Dict.119; - ret Dict.1105; - -procedure Dict.38 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8): - joinpoint Dict.739 Dict.222 Dict.223 Dict.224 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229 Dict.230: - let Dict.790 : U64 = CallByName Num.137 Dict.224; - let Dict.231 : {U32, U32} = CallByName Dict.22 Dict.222 Dict.790; - let Dict.789 : U32 = StructAtIndex 1 Dict.231; - let Dict.777 : Int1 = CallByName Bool.11 Dict.225 Dict.789; - if Dict.777 then - let Dict.788 : U32 = StructAtIndex 0 Dict.231; - let Dict.786 : U64 = CallByName Num.137 Dict.788; - let Dict.785 : {Str, I64} = CallByName Dict.22 Dict.223 Dict.786; - let Dict.232 : Str = StructAtIndex 0 Dict.785; - let Dict.780 : Int1 = CallByName Bool.11 Dict.232 Dict.226; - if Dict.780 then - let Dict.784 : U32 = StructAtIndex 0 Dict.231; - let Dict.782 : U64 = CallByName Num.137 Dict.784; - let Dict.783 : {Str, I64} = Struct {Dict.226, Dict.227}; - let Dict.233 : List {Str, I64} = CallByName List.3 Dict.223 Dict.782 Dict.783; - let Dict.781 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.222, Dict.233, Dict.228, Dict.229, Dict.230}; - ret Dict.781; + let Dict.1093 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Inspect.30 Dict.119; + ret Dict.1093; + +procedure Dict.38 (#Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10): + joinpoint Dict.736 Dict.221 Dict.222 Dict.223 Dict.224 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229: + let Dict.230 : {U32, U32} = CallByName Dict.22 Dict.221 Dict.223; + let Dict.783 : U32 = StructAtIndex 1 Dict.230; + let Dict.771 : Int1 = CallByName Bool.11 Dict.224 Dict.783; + if Dict.771 then + let Dict.782 : U32 = StructAtIndex 0 Dict.230; + let Dict.780 : U64 = CallByName Num.133 Dict.782; + let Dict.779 : {Str, I64} = CallByName Dict.22 Dict.222 Dict.780; + let Dict.231 : Str = StructAtIndex 0 Dict.779; + let Dict.774 : Int1 = CallByName Bool.11 Dict.231 Dict.225; + if Dict.774 then + let Dict.778 : U32 = StructAtIndex 0 Dict.230; + let Dict.776 : U64 = CallByName Num.133 Dict.778; + let Dict.777 : {Str, I64} = Struct {Dict.225, Dict.226}; + let Dict.232 : List {Str, I64} = CallByName List.3 Dict.222 Dict.776 Dict.777; + let Dict.775 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.221, Dict.232, Dict.227, Dict.228, Dict.229}; + ret Dict.775; else - let Dict.779 : U64 = CallByName List.6 Dict.222; - let Dict.234 : U64 = CallByName Dict.68 Dict.224 Dict.779; - let Dict.235 : U32 = CallByName Dict.48 Dict.225; - jump Dict.739 Dict.222 Dict.223 Dict.234 Dict.235 Dict.226 Dict.227 Dict.228 Dict.229 Dict.230; + let Dict.773 : U64 = CallByName List.6 Dict.221; + let Dict.233 : U64 = CallByName Dict.68 Dict.223 Dict.773; + let Dict.234 : U32 = CallByName Dict.48 Dict.224; + jump Dict.736 Dict.221 Dict.222 Dict.233 Dict.234 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229; else - let Dict.776 : U32 = StructAtIndex 1 Dict.231; - let Dict.753 : Int1 = CallByName Num.24 Dict.225 Dict.776; - if Dict.753 then - let Dict.775 : {Str, I64} = Struct {Dict.226, Dict.227}; - let Dict.236 : List {Str, I64} = CallByName List.4 Dict.223 Dict.775; - let Dict.773 : U64 = CallByName List.6 Dict.236; - let Dict.774 : U64 = 1i64; - let Dict.237 : U64 = CallByName Num.20 Dict.773 Dict.774; - let Dict.772 : U32 = CallByName Num.131 Dict.237; - let Dict.755 : {U32, U32} = Struct {Dict.772, Dict.225}; - let Dict.238 : List {U32, U32} = CallByName Dict.67 Dict.222 Dict.755 Dict.224; - let Dict.754 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.238, Dict.236, Dict.228, Dict.229, Dict.230}; - ret Dict.754; + let Dict.770 : U32 = StructAtIndex 1 Dict.230; + let Dict.750 : Int1 = CallByName Num.24 Dict.224 Dict.770; + if Dict.750 then + let Dict.769 : {Str, I64} = Struct {Dict.225, Dict.226}; + let Dict.235 : List {Str, I64} = CallByName List.4 Dict.222 Dict.769; + let Dict.767 : U64 = CallByName List.6 Dict.235; + let Dict.768 : U64 = 1i64; + let Dict.236 : U64 = CallByName Num.75 Dict.767 Dict.768; + let Dict.766 : U32 = CallByName Num.131 Dict.236; + let Dict.752 : {U32, U32} = Struct {Dict.766, Dict.224}; + let Dict.237 : List {U32, U32} = CallByName Dict.67 Dict.221 Dict.752 Dict.223; + let Dict.751 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.237, Dict.235, Dict.227, Dict.228, Dict.229}; + ret Dict.751; else - let Dict.746 : U64 = CallByName List.6 Dict.222; - let Dict.239 : U64 = CallByName Dict.68 Dict.224 Dict.746; - let Dict.240 : U32 = CallByName Dict.48 Dict.225; - jump Dict.739 Dict.222 Dict.223 Dict.239 Dict.240 Dict.226 Dict.227 Dict.228 Dict.229 Dict.230; + let Dict.743 : U64 = CallByName List.6 Dict.221; + let Dict.238 : U64 = CallByName Dict.68 Dict.223 Dict.743; + let Dict.239 : U32 = CallByName Dict.48 Dict.224; + jump Dict.736 Dict.221 Dict.222 Dict.238 Dict.239 Dict.225 Dict.226 Dict.227 Dict.228 Dict.229; in - jump Dict.739 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8; - -procedure Dict.399 (Dict.400, Dict.848, Dict.402, Dict.398): - let Dict.401 : Str = StructAtIndex 0 Dict.848; - inc Dict.400; - let Dict.853 : {U64, U32} = CallByName Dict.65 Dict.400 Dict.401 Dict.398; - let Dict.403 : U64 = StructAtIndex 0 Dict.853; - let Dict.404 : U32 = StructAtIndex 1 Dict.853; - let Dict.852 : U32 = CallByName Num.131 Dict.402; - let Dict.851 : {U32, U32} = Struct {Dict.852, Dict.404}; - let Dict.850 : List {U32, U32} = CallByName Dict.67 Dict.400 Dict.851 Dict.403; - ret Dict.850; - -procedure Dict.4 (Dict.732): - let Dict.157 : List {Str, I64} = StructAtIndex 1 Dict.732; - let #Derived_gen.66 : List {U32, U32} = StructAtIndex 0 Dict.732; + jump Dict.736 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10; + +procedure Dict.398 (Dict.399, Dict.840, Dict.401, Dict.397): + let Dict.400 : Str = StructAtIndex 0 Dict.840; + inc Dict.399; + let Dict.845 : {U64, U32} = CallByName Dict.65 Dict.399 Dict.400 Dict.397; + let Dict.402 : U64 = StructAtIndex 0 Dict.845; + let Dict.403 : U32 = StructAtIndex 1 Dict.845; + let Dict.844 : U32 = CallByName Num.131 Dict.401; + let Dict.843 : {U32, U32} = Struct {Dict.844, Dict.403}; + let Dict.842 : List {U32, U32} = CallByName Dict.67 Dict.399 Dict.843 Dict.402; + ret Dict.842; + +procedure Dict.4 (Dict.729): + let Dict.156 : List {Str, I64} = StructAtIndex 1 Dict.729; + let #Derived_gen.66 : List {U32, U32} = StructAtIndex 0 Dict.729; dec #Derived_gen.66; - let Dict.893 : U64 = CallByName List.6 Dict.157; - dec Dict.157; - ret Dict.893; + let Dict.882 : U64 = CallByName List.6 Dict.156; + dec Dict.156; + ret Dict.882; procedure Dict.41 (): - let Dict.870 : U32 = 0i64; - let Dict.871 : U32 = 0i64; - let Dict.869 : {U32, U32} = Struct {Dict.870, Dict.871}; - ret Dict.869; + let Dict.860 : U32 = 0i64; + let Dict.861 : U32 = 0i64; + let Dict.859 : {U32, U32} = Struct {Dict.860, Dict.861}; + ret Dict.859; procedure Dict.42 (): - let Dict.744 : U32 = 1i64; - let Dict.745 : U8 = 8i64; - let Dict.743 : U32 = CallByName Num.72 Dict.744 Dict.745; - ret Dict.743; + let Dict.741 : U32 = 1i64; + let Dict.742 : U8 = 8i64; + let Dict.740 : U32 = CallByName Num.72 Dict.741 Dict.742; + ret Dict.740; procedure Dict.43 (): - let Dict.799 : U32 = CallByName Dict.42; - let Dict.800 : U32 = 1i64; - let Dict.798 : U32 = CallByName Num.75 Dict.799 Dict.800; - ret Dict.798; + let Dict.791 : U32 = CallByName Dict.42; + let Dict.792 : U32 = 1i64; + let Dict.790 : U32 = CallByName Num.75 Dict.791 Dict.792; + ret Dict.790; procedure Dict.44 (): - let Dict.902 : Float32 = 0.8f64; - ret Dict.902; + let Dict.891 : Float32 = 0.8f64; + ret Dict.891; procedure Dict.45 (): - let Dict.900 : U8 = 64i64; - let Dict.901 : U8 = 3i64; - let Dict.899 : U8 = CallByName Num.20 Dict.900 Dict.901; - ret Dict.899; + let Dict.889 : U8 = 64i64; + let Dict.890 : U8 = 3i64; + let Dict.888 : U8 = CallByName Num.75 Dict.889 Dict.890; + ret Dict.888; procedure Dict.46 (): - let Dict.842 : U64 = 1i64; - let Dict.843 : U8 = 32i64; - let Dict.841 : U64 = CallByName Num.72 Dict.842 Dict.843; - ret Dict.841; + let Dict.834 : U64 = 1i64; + let Dict.835 : U8 = 32i64; + let Dict.833 : U64 = CallByName Num.72 Dict.834 Dict.835; + ret Dict.833; procedure Dict.47 (): - let Dict.840 : U64 = CallByName Dict.46; - ret Dict.840; - -procedure Dict.48 (Dict.307): - let Dict.742 : U32 = CallByName Dict.42; - let Dict.741 : U32 = CallByName Num.19 Dict.307 Dict.742; - ret Dict.741; - -procedure Dict.59 (Dict.722): - let Dict.377 : List {Str, I64} = StructAtIndex 1 Dict.722; - let Dict.378 : U64 = StructAtIndex 2 Dict.722; - let Dict.379 : Float32 = StructAtIndex 3 Dict.722; - let Dict.380 : U8 = StructAtIndex 4 Dict.722; - let #Derived_gen.67 : List {U32, U32} = StructAtIndex 0 Dict.722; + let Dict.832 : U64 = CallByName Dict.46; + ret Dict.832; + +procedure Dict.48 (Dict.306): + let Dict.739 : U32 = CallByName Dict.42; + let Dict.738 : U32 = CallByName Num.51 Dict.306 Dict.739; + ret Dict.738; + +procedure Dict.59 (Dict.719): + let Dict.376 : List {Str, I64} = StructAtIndex 1 Dict.719; + let Dict.377 : U64 = StructAtIndex 2 Dict.719; + let Dict.378 : Float32 = StructAtIndex 3 Dict.719; + let Dict.379 : U8 = StructAtIndex 4 Dict.719; + let #Derived_gen.67 : List {U32, U32} = StructAtIndex 0 Dict.719; dec #Derived_gen.67; - let Dict.888 : U64 = CallByName Dict.47; - let Dict.844 : Int1 = CallByName Bool.7 Dict.378 Dict.888; - if Dict.844 then - inc Dict.377; - let Dict.887 : U8 = 1i64; - let Dict.381 : U8 = CallByName Num.20 Dict.380 Dict.887; - let Dict.864 : {List {U32, U32}, U64} = CallByName Dict.60 Dict.381 Dict.379; - let Dict.382 : List {U32, U32} = StructAtIndex 0 Dict.864; - let Dict.383 : U64 = StructAtIndex 1 Dict.864; - let Dict.384 : List {U32, U32} = CallByName Dict.64 Dict.382 Dict.377 Dict.381; - let Dict.845 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.384, Dict.377, Dict.383, Dict.379, Dict.381}; - ret Dict.845; - else - dec Dict.377; - let Dict.835 : Str = "Dict hit limit of "; - let Dict.839 : U64 = CallByName Dict.47; - let Dict.837 : Str = CallByName Num.96 Dict.839; - let Dict.838 : Str = " elements. Unable to grow more."; - let Dict.836 : Str = CallByName Str.3 Dict.837 Dict.838; - dec Dict.838; - let Dict.834 : Str = CallByName Str.3 Dict.835 Dict.836; - dec Dict.836; - Crash Dict.834 - -procedure Dict.60 (Dict.385, Dict.386): - let Dict.387 : U64 = CallByName Dict.63 Dict.385; - let Dict.880 : U64 = CallByName Dict.47; - let Dict.874 : Int1 = CallByName Bool.11 Dict.387 Dict.880; - if Dict.874 then - let Dict.877 : {U32, U32} = CallByName Dict.41; - let Dict.879 : U64 = CallByName Dict.47; - let Dict.878 : U64 = CallByName Num.137 Dict.879; - let Dict.876 : List {U32, U32} = CallByName List.11 Dict.877 Dict.878; - let Dict.47 : U64 = CallByName Dict.47; - let Dict.875 : {List {U32, U32}, U64} = Struct {Dict.876, Dict.47}; - ret Dict.875; + let Dict.877 : U64 = CallByName Dict.47; + let Dict.836 : Int1 = CallByName Bool.7 Dict.377 Dict.877; + if Dict.836 then + inc Dict.376; + let Dict.876 : U8 = 1i64; + let Dict.380 : U8 = CallByName Num.75 Dict.379 Dict.876; + let Dict.855 : {List {U32, U32}, U64} = CallByName Dict.60 Dict.380 Dict.378; + let Dict.381 : List {U32, U32} = StructAtIndex 0 Dict.855; + let Dict.382 : U64 = StructAtIndex 1 Dict.855; + let Dict.383 : List {U32, U32} = CallByName Dict.64 Dict.381 Dict.376 Dict.380; + let Dict.837 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = Struct {Dict.383, Dict.376, Dict.382, Dict.378, Dict.380}; + ret Dict.837; else - let Dict.873 : Float32 = CallByName Num.139 Dict.387; - let Dict.872 : Float32 = CallByName Num.21 Dict.873 Dict.386; - let Dict.388 : U64 = CallByName Num.50 Dict.872; + dec Dict.376; + let Dict.827 : Str = "Dict hit limit of "; + let Dict.831 : U64 = CallByName Dict.47; + let Dict.829 : Str = CallByName Num.96 Dict.831; + let Dict.830 : Str = " elements. Unable to grow more."; + let Dict.828 : Str = CallByName Str.3 Dict.829 Dict.830; + dec Dict.830; + let Dict.826 : Str = CallByName Str.3 Dict.827 Dict.828; + dec Dict.828; + Crash Dict.826 + +procedure Dict.60 (Dict.384, Dict.385): + let Dict.386 : U64 = CallByName Dict.63 Dict.384; + let Dict.869 : U64 = CallByName Dict.47; + let Dict.864 : Int1 = CallByName Bool.11 Dict.386 Dict.869; + if Dict.864 then let Dict.867 : {U32, U32} = CallByName Dict.41; - let Dict.868 : U64 = CallByName Num.137 Dict.387; + let Dict.868 : U64 = CallByName Dict.47; let Dict.866 : List {U32, U32} = CallByName List.11 Dict.867 Dict.868; - let Dict.865 : {List {U32, U32}, U64} = Struct {Dict.866, Dict.388}; + let Dict.47 : U64 = CallByName Dict.47; + let Dict.865 : {List {U32, U32}, U64} = Struct {Dict.866, Dict.47}; ret Dict.865; - -procedure Dict.63 (Dict.395): - let Dict.884 : U64 = 1i64; - let Dict.886 : U8 = 64i64; - let Dict.885 : U8 = CallByName Num.20 Dict.886 Dict.395; - let Dict.882 : U64 = CallByName Num.72 Dict.884 Dict.885; - let Dict.883 : U64 = CallByName Dict.47; - let Dict.881 : U64 = CallByName Num.159 Dict.882 Dict.883; - ret Dict.881; - -procedure Dict.64 (Dict.396, Dict.397, Dict.398): - let Dict.846 : List {U32, U32} = CallByName List.83 Dict.397 Dict.396 Dict.398; + else + let Dict.863 : Float32 = CallByName Num.139 Dict.386; + let Dict.862 : Float32 = CallByName Num.21 Dict.863 Dict.385; + let Dict.387 : U64 = CallByName Num.50 Dict.862; + let Dict.858 : {U32, U32} = CallByName Dict.41; + let Dict.857 : List {U32, U32} = CallByName List.11 Dict.858 Dict.386; + let Dict.856 : {List {U32, U32}, U64} = Struct {Dict.857, Dict.387}; + ret Dict.856; + +procedure Dict.63 (Dict.394): + let Dict.873 : U64 = 1i64; + let Dict.875 : U8 = 64i64; + let Dict.874 : U8 = CallByName Num.75 Dict.875 Dict.394; + let Dict.871 : U64 = CallByName Num.72 Dict.873 Dict.874; + let Dict.872 : U64 = CallByName Dict.47; + let Dict.870 : U64 = CallByName Num.148 Dict.871 Dict.872; + ret Dict.870; + +procedure Dict.64 (Dict.395, Dict.396, Dict.397): + let Dict.838 : List {U32, U32} = CallByName List.83 Dict.396 Dict.395 Dict.397; + ret Dict.838; + +procedure Dict.65 (Dict.404, Dict.405, Dict.406): + let Dict.407 : U64 = CallByName Dict.69 Dict.405; + let Dict.408 : U32 = CallByName Dict.70 Dict.407; + let Dict.409 : U64 = CallByName Dict.71 Dict.407 Dict.406; + let Dict.846 : {U64, U32} = CallByName Dict.66 Dict.404 Dict.409 Dict.408; ret Dict.846; -procedure Dict.65 (Dict.405, Dict.406, Dict.407): - let Dict.408 : U64 = CallByName Dict.69 Dict.406; - let Dict.409 : U32 = CallByName Dict.70 Dict.408; - let Dict.410 : U64 = CallByName Dict.71 Dict.408 Dict.407; - let Dict.854 : {U64, U32} = CallByName Dict.66 Dict.405 Dict.410 Dict.409; - ret Dict.854; - -procedure Dict.66 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39): - joinpoint Dict.855 Dict.411 Dict.412 Dict.413: - let Dict.863 : U64 = CallByName Num.137 Dict.412; - let Dict.414 : {U32, U32} = CallByName Dict.22 Dict.411 Dict.863; - let Dict.862 : U32 = StructAtIndex 1 Dict.414; - let Dict.857 : Int1 = CallByName Num.22 Dict.413 Dict.862; - if Dict.857 then - let Dict.861 : U64 = CallByName List.6 Dict.411; - let Dict.859 : U64 = CallByName Dict.68 Dict.412 Dict.861; - let Dict.860 : U32 = CallByName Dict.48 Dict.413; - jump Dict.855 Dict.411 Dict.859 Dict.860; +procedure Dict.66 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13): + joinpoint Dict.847 Dict.410 Dict.411 Dict.412: + let Dict.413 : {U32, U32} = CallByName Dict.22 Dict.410 Dict.411; + let Dict.854 : U32 = StructAtIndex 1 Dict.413; + let Dict.849 : Int1 = CallByName Num.22 Dict.412 Dict.854; + if Dict.849 then + let Dict.853 : U64 = CallByName List.6 Dict.410; + let Dict.851 : U64 = CallByName Dict.68 Dict.411 Dict.853; + let Dict.852 : U32 = CallByName Dict.48 Dict.412; + jump Dict.847 Dict.410 Dict.851 Dict.852; else - dec Dict.411; - let Dict.856 : {U64, U32} = Struct {Dict.412, Dict.413}; - ret Dict.856; + dec Dict.410; + let Dict.848 : {U64, U32} = Struct {Dict.411, Dict.412}; + ret Dict.848; in - jump Dict.855 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39; - -procedure Dict.67 (#Derived_gen.48, #Derived_gen.49, #Derived_gen.50): - joinpoint Dict.756 Dict.415 Dict.416 Dict.417: - let Dict.770 : U64 = CallByName Num.137 Dict.417; - let Dict.418 : {U32, U32} = CallByName Dict.22 Dict.415 Dict.770; - let Dict.768 : U32 = StructAtIndex 1 Dict.418; - let Dict.769 : U32 = 0i64; - let Dict.759 : Int1 = CallByName Bool.7 Dict.768 Dict.769; - if Dict.759 then - let Dict.767 : U64 = CallByName Num.137 Dict.417; - let Dict.419 : List {U32, U32} = CallByName List.3 Dict.415 Dict.767 Dict.416; - let Dict.764 : U32 = StructAtIndex 0 Dict.418; - let Dict.765 : U32 = StructAtIndex 1 Dict.418; - let Dict.766 : U32 = CallByName Dict.48 Dict.765; - let Dict.761 : {U32, U32} = Struct {Dict.764, Dict.766}; - let Dict.763 : U64 = CallByName List.6 Dict.419; - let Dict.762 : U64 = CallByName Dict.68 Dict.417 Dict.763; - jump Dict.756 Dict.419 Dict.761 Dict.762; + jump Dict.847 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13; + +procedure Dict.67 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32): + joinpoint Dict.753 Dict.414 Dict.415 Dict.416: + let Dict.417 : {U32, U32} = CallByName Dict.22 Dict.414 Dict.416; + let Dict.763 : U32 = StructAtIndex 1 Dict.417; + let Dict.764 : U32 = 0i64; + let Dict.755 : Int1 = CallByName Bool.7 Dict.763 Dict.764; + if Dict.755 then + let Dict.418 : List {U32, U32} = CallByName List.3 Dict.414 Dict.416 Dict.415; + let Dict.760 : U32 = StructAtIndex 0 Dict.417; + let Dict.761 : U32 = StructAtIndex 1 Dict.417; + let Dict.762 : U32 = CallByName Dict.48 Dict.761; + let Dict.757 : {U32, U32} = Struct {Dict.760, Dict.762}; + let Dict.759 : U64 = CallByName List.6 Dict.418; + let Dict.758 : U64 = CallByName Dict.68 Dict.416 Dict.759; + jump Dict.753 Dict.418 Dict.757 Dict.758; else - let Dict.758 : U64 = CallByName Num.137 Dict.417; - let Dict.757 : List {U32, U32} = CallByName List.3 Dict.415 Dict.758 Dict.416; - ret Dict.757; + let Dict.754 : List {U32, U32} = CallByName List.3 Dict.414 Dict.416 Dict.415; + ret Dict.754; in - jump Dict.756 #Derived_gen.48 #Derived_gen.49 #Derived_gen.50; - -procedure Dict.68 (Dict.420, Dict.421): - let Dict.752 : U64 = 1i64; - let Dict.751 : U64 = CallByName Num.51 Dict.420 Dict.752; - let Dict.748 : Int1 = CallByName Bool.7 Dict.751 Dict.421; - if Dict.748 then - let Dict.750 : U64 = 1i64; - let Dict.749 : U64 = CallByName Num.51 Dict.420 Dict.750; - ret Dict.749; + jump Dict.753 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32; + +procedure Dict.68 (Dict.419, Dict.420): + let Dict.749 : U64 = 1i64; + let Dict.748 : U64 = CallByName Num.51 Dict.419 Dict.749; + let Dict.745 : Int1 = CallByName Bool.7 Dict.748 Dict.420; + if Dict.745 then + let Dict.747 : U64 = 1i64; + let Dict.746 : U64 = CallByName Num.51 Dict.419 Dict.747; + ret Dict.746; else - let Dict.747 : U64 = 0i64; - ret Dict.747; - -procedure Dict.69 (Dict.422): - let Dict.805 : [C , C U64] = TagId(0) ; - let Dict.804 : {U64, U64} = CallByName Dict.73 Dict.805; - let Dict.802 : {U64, U64} = CallByName Hash.19 Dict.804 Dict.422; - let Dict.801 : U64 = CallByName Dict.76 Dict.802; - ret Dict.801; - -procedure Dict.70 (Dict.424): - let Dict.796 : U32 = CallByName Num.131 Dict.424; - let Dict.797 : U32 = CallByName Dict.43; - let Dict.794 : U32 = CallByName Num.69 Dict.796 Dict.797; - let Dict.795 : U32 = CallByName Dict.42; - let Dict.793 : U32 = CallByName Num.71 Dict.794 Dict.795; + let Dict.744 : U64 = 0i64; + ret Dict.744; + +procedure Dict.69 (Dict.421): + let Dict.797 : [C , C U64] = TagId(0) ; + let Dict.796 : {U64, U64} = CallByName Dict.73 Dict.797; + let Dict.794 : {U64, U64} = CallByName Hash.19 Dict.796 Dict.421; + let Dict.793 : U64 = CallByName Dict.76 Dict.794; ret Dict.793; -procedure Dict.71 (Dict.425, Dict.426): - let Dict.792 : U64 = CallByName Num.74 Dict.425 Dict.426; - let Dict.791 : U64 = CallByName Num.137 Dict.792; - ret Dict.791; - -procedure Dict.73 (Dict.428): - joinpoint Dict.822 Dict.429: - let Dict.807 : U64 = CallByName Dict.75 Dict.429; - let Dict.806 : {U64, U64} = Struct {Dict.807, Dict.429}; - ret Dict.806; +procedure Dict.70 (Dict.423): + let Dict.788 : U32 = CallByName Num.131 Dict.423; + let Dict.789 : U32 = CallByName Dict.43; + let Dict.786 : U32 = CallByName Num.69 Dict.788 Dict.789; + let Dict.787 : U32 = CallByName Dict.42; + let Dict.785 : U32 = CallByName Num.71 Dict.786 Dict.787; + ret Dict.785; + +procedure Dict.71 (Dict.424, Dict.425): + let Dict.784 : U64 = CallByName Num.74 Dict.424 Dict.425; + ret Dict.784; + +procedure Dict.73 (Dict.427): + joinpoint Dict.814 Dict.428: + let Dict.799 : U64 = CallByName Dict.75 Dict.428; + let Dict.798 : {U64, U64} = Struct {Dict.799, Dict.428}; + ret Dict.798; in - let Dict.827 : U8 = 0i64; - let Dict.828 : U8 = GetTagId Dict.428; - let Dict.829 : Int1 = lowlevel Eq Dict.827 Dict.828; - if Dict.829 then - let Dict.824 : {} = Struct {}; - let Dict.823 : U64 = CallByName Dict.23 Dict.824; - jump Dict.822 Dict.823; + let Dict.819 : U8 = 0i64; + let Dict.820 : U8 = GetTagId Dict.427; + let Dict.821 : Int1 = lowlevel Eq Dict.819 Dict.820; + if Dict.821 then + let Dict.816 : {} = Struct {}; + let Dict.815 : U64 = CallByName Dict.23 Dict.816; + jump Dict.814 Dict.815; else - let Dict.430 : U64 = UnionAtIndex (Id 1) (Index 0) Dict.428; - jump Dict.822 Dict.430; - -procedure Dict.74 (Dict.711, Dict.712): - let Dict.433 : U64 = StructAtIndex 0 Dict.712; - let Dict.434 : U64 = StructAtIndex 1 Dict.712; - let Dict.436 : U64 = StructAtIndex 2 Dict.712; - let Dict.435 : U64 = StructAtIndex 3 Dict.712; - let Dict.431 : U64 = StructAtIndex 0 Dict.711; - let Dict.432 : U64 = StructAtIndex 1 Dict.711; - let Dict.924 : U64 = CallByName Dict.86; - let Dict.922 : U64 = CallByName Num.70 Dict.433 Dict.924; - let Dict.923 : U64 = CallByName Num.70 Dict.434 Dict.435; - let Dict.437 : {U64, U64} = CallByName Dict.90 Dict.922 Dict.923; - let Dict.919 : U64 = StructAtIndex 0 Dict.437; - let Dict.920 : U64 = CallByName Dict.85; - let Dict.918 : U64 = CallByName Num.70 Dict.919 Dict.920; - let Dict.438 : U64 = CallByName Num.70 Dict.918 Dict.436; - let Dict.915 : U64 = StructAtIndex 1 Dict.437; - let Dict.916 : U64 = CallByName Dict.86; - let Dict.439 : U64 = CallByName Num.70 Dict.915 Dict.916; - let Dict.440 : U64 = CallByName Dict.89 Dict.438 Dict.439; - let Dict.907 : U64 = CallByName Dict.89 Dict.432 Dict.440; - let Dict.906 : {U64, U64} = Struct {Dict.431, Dict.907}; - ret Dict.906; + let Dict.429 : U64 = UnionAtIndex (Id 1) (Index 0) Dict.427; + jump Dict.814 Dict.429; + +procedure Dict.74 (Dict.708, Dict.709): + let Dict.432 : U64 = StructAtIndex 0 Dict.709; + let Dict.433 : U64 = StructAtIndex 1 Dict.709; + let Dict.435 : U64 = StructAtIndex 2 Dict.709; + let Dict.434 : U64 = StructAtIndex 3 Dict.709; + let Dict.430 : U64 = StructAtIndex 0 Dict.708; + let Dict.431 : U64 = StructAtIndex 1 Dict.708; + let Dict.913 : U64 = CallByName Dict.86; + let Dict.911 : U64 = CallByName Num.70 Dict.432 Dict.913; + let Dict.912 : U64 = CallByName Num.70 Dict.433 Dict.434; + let Dict.436 : {U64, U64} = CallByName Dict.90 Dict.911 Dict.912; + let Dict.908 : U64 = StructAtIndex 0 Dict.436; + let Dict.909 : U64 = CallByName Dict.85; + let Dict.907 : U64 = CallByName Num.70 Dict.908 Dict.909; + let Dict.437 : U64 = CallByName Num.70 Dict.907 Dict.435; + let Dict.904 : U64 = StructAtIndex 1 Dict.436; + let Dict.905 : U64 = CallByName Dict.86; + let Dict.438 : U64 = CallByName Num.70 Dict.904 Dict.905; + let Dict.439 : U64 = CallByName Dict.89 Dict.437 Dict.438; + let Dict.896 : U64 = CallByName Dict.89 Dict.431 Dict.439; + let Dict.895 : {U64, U64} = Struct {Dict.430, Dict.896}; + ret Dict.895; -procedure Dict.75 (Dict.441): - let Dict.820 : U64 = CallByName Dict.85; - let Dict.810 : U64 = CallByName Num.70 Dict.441 Dict.820; - let Dict.811 : U64 = CallByName Dict.86; - let Dict.809 : U64 = CallByName Dict.89 Dict.810 Dict.811; - let Dict.808 : U64 = CallByName Num.70 Dict.809 Dict.441; - ret Dict.808; - -procedure Dict.76 (Dict.730): - let Dict.442 : U64 = StructAtIndex 1 Dict.730; - ret Dict.442; - -procedure Dict.8 (Dict.211, Dict.212, Dict.213): - joinpoint Dict.832 Dict.830: - let Dict.214 : List {U32, U32} = StructAtIndex 0 Dict.830; - let Dict.215 : List {Str, I64} = StructAtIndex 1 Dict.830; - let Dict.216 : U64 = StructAtIndex 2 Dict.830; - let Dict.217 : Float32 = StructAtIndex 3 Dict.830; - let Dict.218 : U8 = StructAtIndex 4 Dict.830; - inc Dict.212; - let Dict.219 : U64 = CallByName Dict.69 Dict.212; - let Dict.220 : U32 = CallByName Dict.70 Dict.219; - let Dict.221 : U64 = CallByName Dict.71 Dict.219 Dict.218; - let Dict.738 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.38 Dict.214 Dict.215 Dict.221 Dict.220 Dict.212 Dict.213 Dict.216 Dict.217 Dict.218; - ret Dict.738; +procedure Dict.75 (Dict.440): + let Dict.812 : U64 = CallByName Dict.85; + let Dict.802 : U64 = CallByName Num.70 Dict.440 Dict.812; + let Dict.803 : U64 = CallByName Dict.86; + let Dict.801 : U64 = CallByName Dict.89 Dict.802 Dict.803; + let Dict.800 : U64 = CallByName Num.70 Dict.801 Dict.440; + ret Dict.800; + +procedure Dict.76 (Dict.727): + let Dict.441 : U64 = StructAtIndex 1 Dict.727; + ret Dict.441; + +procedure Dict.8 (Dict.210, Dict.211, Dict.212): + joinpoint Dict.824 Dict.822: + let Dict.213 : List {U32, U32} = StructAtIndex 0 Dict.822; + let Dict.214 : List {Str, I64} = StructAtIndex 1 Dict.822; + let Dict.215 : U64 = StructAtIndex 2 Dict.822; + let Dict.216 : Float32 = StructAtIndex 3 Dict.822; + let Dict.217 : U8 = StructAtIndex 4 Dict.822; + inc Dict.211; + let Dict.218 : U64 = CallByName Dict.69 Dict.211; + let Dict.219 : U32 = CallByName Dict.70 Dict.218; + let Dict.220 : U64 = CallByName Dict.71 Dict.218 Dict.217; + let Dict.735 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.38 Dict.213 Dict.214 Dict.220 Dict.219 Dict.211 Dict.212 Dict.215 Dict.216 Dict.217; + ret Dict.735; in - inc 2 Dict.211; - let Dict.890 : U64 = CallByName Dict.4 Dict.211; - let Dict.891 : U64 = CallByName Dict.20 Dict.211; - let Dict.889 : Int1 = CallByName Num.22 Dict.890 Dict.891; - if Dict.889 then - jump Dict.832 Dict.211; + inc 2 Dict.210; + let Dict.879 : U64 = CallByName Dict.4 Dict.210; + let Dict.880 : U64 = CallByName Dict.20 Dict.210; + let Dict.878 : Int1 = CallByName Num.22 Dict.879 Dict.880; + if Dict.878 then + jump Dict.824 Dict.210; else - let Dict.831 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.59 Dict.211; - jump Dict.832 Dict.831; - -procedure Dict.82 (Dict.705, Dict.481): - let Dict.479 : U64 = StructAtIndex 0 Dict.705; - let Dict.480 : U64 = StructAtIndex 1 Dict.705; - let Dict.482 : U64 = CallByName List.6 Dict.481; - joinpoint Dict.930 Dict.483: - let Dict.904 : {U64, U64} = Struct {Dict.479, Dict.480}; - let Dict.925 : U64 = StructAtIndex 0 Dict.483; - let Dict.926 : U64 = StructAtIndex 1 Dict.483; - let Dict.927 : U64 = CallByName Num.133 Dict.482; - let Dict.928 : U64 = StructAtIndex 2 Dict.483; - let Dict.905 : {U64, U64, U64, U64} = Struct {Dict.925, Dict.926, Dict.927, Dict.928}; - let Dict.903 : {U64, U64} = CallByName Dict.74 Dict.904 Dict.905; - ret Dict.903; + let Dict.823 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.59 Dict.210; + jump Dict.824 Dict.823; + +procedure Dict.82 (Dict.702, Dict.480): + let Dict.478 : U64 = StructAtIndex 0 Dict.702; + let Dict.479 : U64 = StructAtIndex 1 Dict.702; + let Dict.481 : U64 = CallByName List.6 Dict.480; + joinpoint Dict.918 Dict.482: + let Dict.893 : {U64, U64} = Struct {Dict.478, Dict.479}; + let Dict.914 : U64 = StructAtIndex 0 Dict.482; + let Dict.915 : U64 = StructAtIndex 1 Dict.482; + let Dict.916 : U64 = StructAtIndex 2 Dict.482; + let Dict.894 : {U64, U64, U64, U64} = Struct {Dict.914, Dict.915, Dict.481, Dict.916}; + let Dict.892 : {U64, U64} = CallByName Dict.74 Dict.893 Dict.894; + ret Dict.892; in - let Dict.1104 : U64 = 16i64; - let Dict.1044 : Int1 = CallByName Num.23 Dict.482 Dict.1104; - if Dict.1044 then - joinpoint Dict.1046 Dict.929: - jump Dict.930 Dict.929; + let Dict.1092 : U64 = 16i64; + let Dict.1032 : Int1 = CallByName Num.23 Dict.481 Dict.1092; + if Dict.1032 then + joinpoint Dict.1034 Dict.917: + jump Dict.918 Dict.917; in - let Dict.1103 : U64 = 4i64; - let Dict.1068 : Int1 = CallByName Num.25 Dict.482 Dict.1103; - if Dict.1068 then - let Dict.1102 : U8 = 3i64; - let Dict.1100 : U64 = CallByName Num.74 Dict.482 Dict.1102; - let Dict.1101 : U8 = 2i64; - let Dict.484 : U64 = CallByName Num.72 Dict.1100 Dict.1101; - let Dict.1099 : U64 = 0i64; - inc 3 Dict.481; - let Dict.1097 : U64 = CallByName Dict.92 Dict.481 Dict.1099; - let Dict.1098 : U8 = 32i64; - let Dict.1095 : U64 = CallByName Num.72 Dict.1097 Dict.1098; - let Dict.1096 : U64 = CallByName Dict.92 Dict.481 Dict.484; - let Dict.485 : U64 = CallByName Num.71 Dict.1095 Dict.1096; - let Dict.1094 : U64 = 4i64; - let Dict.1093 : U64 = CallByName Num.75 Dict.482 Dict.1094; - let Dict.1091 : U64 = CallByName Dict.92 Dict.481 Dict.1093; - let Dict.1092 : U8 = 32i64; - let Dict.1069 : U64 = CallByName Num.72 Dict.1091 Dict.1092; - let Dict.1090 : U64 = 4i64; - let Dict.1089 : U64 = CallByName Num.75 Dict.482 Dict.1090; - let Dict.1071 : U64 = CallByName Num.75 Dict.1089 Dict.484; - let Dict.1070 : U64 = CallByName Dict.92 Dict.481 Dict.1071; - let Dict.486 : U64 = CallByName Num.71 Dict.1069 Dict.1070; - let Dict.1045 : {U64, U64, U64} = Struct {Dict.485, Dict.486, Dict.479}; - jump Dict.1046 Dict.1045; + let Dict.1091 : U64 = 4i64; + let Dict.1056 : Int1 = CallByName Num.25 Dict.481 Dict.1091; + if Dict.1056 then + let Dict.1090 : U8 = 3i64; + let Dict.1088 : U64 = CallByName Num.74 Dict.481 Dict.1090; + let Dict.1089 : U8 = 2i64; + let Dict.483 : U64 = CallByName Num.72 Dict.1088 Dict.1089; + let Dict.1087 : U64 = 0i64; + inc 3 Dict.480; + let Dict.1085 : U64 = CallByName Dict.92 Dict.480 Dict.1087; + let Dict.1086 : U8 = 32i64; + let Dict.1083 : U64 = CallByName Num.72 Dict.1085 Dict.1086; + let Dict.1084 : U64 = CallByName Dict.92 Dict.480 Dict.483; + let Dict.484 : U64 = CallByName Num.71 Dict.1083 Dict.1084; + let Dict.1082 : U64 = 4i64; + let Dict.1081 : U64 = CallByName Num.75 Dict.481 Dict.1082; + let Dict.1079 : U64 = CallByName Dict.92 Dict.480 Dict.1081; + let Dict.1080 : U8 = 32i64; + let Dict.1057 : U64 = CallByName Num.72 Dict.1079 Dict.1080; + let Dict.1078 : U64 = 4i64; + let Dict.1077 : U64 = CallByName Num.75 Dict.481 Dict.1078; + let Dict.1059 : U64 = CallByName Num.75 Dict.1077 Dict.483; + let Dict.1058 : U64 = CallByName Dict.92 Dict.480 Dict.1059; + let Dict.485 : U64 = CallByName Num.71 Dict.1057 Dict.1058; + let Dict.1033 : {U64, U64, U64} = Struct {Dict.484, Dict.485, Dict.478}; + jump Dict.1034 Dict.1033; else - let Dict.1067 : U64 = 0i64; - let Dict.1049 : Int1 = CallByName Num.24 Dict.482 Dict.1067; - if Dict.1049 then - let Dict.1052 : U64 = 0i64; - let Dict.1050 : U64 = CallByName Dict.93 Dict.481 Dict.1052 Dict.482; - let Dict.1051 : U64 = 0i64; - let Dict.1045 : {U64, U64, U64} = Struct {Dict.1050, Dict.1051, Dict.479}; - jump Dict.1046 Dict.1045; + let Dict.1055 : U64 = 0i64; + let Dict.1037 : Int1 = CallByName Num.24 Dict.481 Dict.1055; + if Dict.1037 then + let Dict.1040 : U64 = 0i64; + let Dict.1038 : U64 = CallByName Dict.93 Dict.480 Dict.1040 Dict.481; + let Dict.1039 : U64 = 0i64; + let Dict.1033 : {U64, U64, U64} = Struct {Dict.1038, Dict.1039, Dict.478}; + jump Dict.1034 Dict.1033; else - dec Dict.481; - let Dict.1047 : U64 = 0i64; - let Dict.1048 : U64 = 0i64; - let Dict.1045 : {U64, U64, U64} = Struct {Dict.1047, Dict.1048, Dict.479}; - jump Dict.1046 Dict.1045; + dec Dict.480; + let Dict.1035 : U64 = 0i64; + let Dict.1036 : U64 = 0i64; + let Dict.1033 : {U64, U64, U64} = Struct {Dict.1035, Dict.1036, Dict.478}; + jump Dict.1034 Dict.1033; else - let Dict.1043 : U64 = 48i64; - let Dict.1041 : Int1 = CallByName Num.23 Dict.482 Dict.1043; - if Dict.1041 then - let Dict.1042 : U64 = 0i64; - let Dict.929 : {U64, U64, U64} = CallByName Dict.84 Dict.479 Dict.481 Dict.1042 Dict.482; - jump Dict.930 Dict.929; + let Dict.1031 : U64 = 48i64; + let Dict.1029 : Int1 = CallByName Num.23 Dict.481 Dict.1031; + if Dict.1029 then + let Dict.1030 : U64 = 0i64; + let Dict.917 : {U64, U64, U64} = CallByName Dict.84 Dict.478 Dict.480 Dict.1030 Dict.481; + jump Dict.918 Dict.917; else - let Dict.931 : U64 = 0i64; - let Dict.929 : {U64, U64, U64} = CallByName Dict.83 Dict.479 Dict.479 Dict.479 Dict.481 Dict.931 Dict.482; - jump Dict.930 Dict.929; - -procedure Dict.83 (#Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36): - joinpoint Dict.932 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491 Dict.492: - inc 6 Dict.490; - let Dict.1039 : U64 = CallByName Dict.91 Dict.490 Dict.491; - let Dict.1040 : U64 = CallByName Dict.86; - let Dict.1034 : U64 = CallByName Num.70 Dict.1039 Dict.1040; - let Dict.1038 : U64 = 8i64; - let Dict.1037 : U64 = CallByName Num.51 Dict.491 Dict.1038; - let Dict.1036 : U64 = CallByName Dict.91 Dict.490 Dict.1037; - let Dict.1035 : U64 = CallByName Num.70 Dict.1036 Dict.487; - let Dict.493 : U64 = CallByName Dict.89 Dict.1034 Dict.1035; - let Dict.1033 : U64 = 16i64; - let Dict.1032 : U64 = CallByName Num.51 Dict.491 Dict.1033; - let Dict.1029 : U64 = CallByName Dict.91 Dict.490 Dict.1032; - let Dict.1030 : U64 = CallByName Dict.87; - let Dict.1024 : U64 = CallByName Num.70 Dict.1029 Dict.1030; - let Dict.1028 : U64 = 24i64; - let Dict.1027 : U64 = CallByName Num.51 Dict.491 Dict.1028; - let Dict.1026 : U64 = CallByName Dict.91 Dict.490 Dict.1027; - let Dict.1025 : U64 = CallByName Num.70 Dict.1026 Dict.488; - let Dict.494 : U64 = CallByName Dict.89 Dict.1024 Dict.1025; - let Dict.1023 : U64 = 32i64; - let Dict.1022 : U64 = CallByName Num.51 Dict.491 Dict.1023; - let Dict.1019 : U64 = CallByName Dict.91 Dict.490 Dict.1022; - let Dict.1020 : U64 = CallByName Dict.88; - let Dict.1014 : U64 = CallByName Num.70 Dict.1019 Dict.1020; - let Dict.1018 : U64 = 40i64; - let Dict.1017 : U64 = CallByName Num.51 Dict.491 Dict.1018; - let Dict.1016 : U64 = CallByName Dict.91 Dict.490 Dict.1017; - let Dict.1015 : U64 = CallByName Num.70 Dict.1016 Dict.489; - let Dict.495 : U64 = CallByName Dict.89 Dict.1014 Dict.1015; - let Dict.1013 : U64 = 48i64; - let Dict.496 : U64 = CallByName Num.75 Dict.492 Dict.1013; - let Dict.1012 : U64 = 48i64; - let Dict.497 : U64 = CallByName Num.51 Dict.491 Dict.1012; - let Dict.1011 : U64 = 48i64; - let Dict.1009 : Int1 = CallByName Num.24 Dict.496 Dict.1011; - if Dict.1009 then - jump Dict.932 Dict.493 Dict.494 Dict.495 Dict.490 Dict.497 Dict.496; + let Dict.919 : U64 = 0i64; + let Dict.917 : {U64, U64, U64} = CallByName Dict.83 Dict.478 Dict.478 Dict.478 Dict.480 Dict.919 Dict.481; + jump Dict.918 Dict.917; + +procedure Dict.83 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60, #Derived_gen.61, #Derived_gen.62, #Derived_gen.63): + joinpoint Dict.920 Dict.486 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491: + inc 6 Dict.489; + let Dict.1027 : U64 = CallByName Dict.91 Dict.489 Dict.490; + let Dict.1028 : U64 = CallByName Dict.86; + let Dict.1022 : U64 = CallByName Num.70 Dict.1027 Dict.1028; + let Dict.1026 : U64 = 8i64; + let Dict.1025 : U64 = CallByName Num.51 Dict.490 Dict.1026; + let Dict.1024 : U64 = CallByName Dict.91 Dict.489 Dict.1025; + let Dict.1023 : U64 = CallByName Num.70 Dict.1024 Dict.486; + let Dict.492 : U64 = CallByName Dict.89 Dict.1022 Dict.1023; + let Dict.1021 : U64 = 16i64; + let Dict.1020 : U64 = CallByName Num.51 Dict.490 Dict.1021; + let Dict.1017 : U64 = CallByName Dict.91 Dict.489 Dict.1020; + let Dict.1018 : U64 = CallByName Dict.87; + let Dict.1012 : U64 = CallByName Num.70 Dict.1017 Dict.1018; + let Dict.1016 : U64 = 24i64; + let Dict.1015 : U64 = CallByName Num.51 Dict.490 Dict.1016; + let Dict.1014 : U64 = CallByName Dict.91 Dict.489 Dict.1015; + let Dict.1013 : U64 = CallByName Num.70 Dict.1014 Dict.487; + let Dict.493 : U64 = CallByName Dict.89 Dict.1012 Dict.1013; + let Dict.1011 : U64 = 32i64; + let Dict.1010 : U64 = CallByName Num.51 Dict.490 Dict.1011; + let Dict.1007 : U64 = CallByName Dict.91 Dict.489 Dict.1010; + let Dict.1008 : U64 = CallByName Dict.88; + let Dict.1002 : U64 = CallByName Num.70 Dict.1007 Dict.1008; + let Dict.1006 : U64 = 40i64; + let Dict.1005 : U64 = CallByName Num.51 Dict.490 Dict.1006; + let Dict.1004 : U64 = CallByName Dict.91 Dict.489 Dict.1005; + let Dict.1003 : U64 = CallByName Num.70 Dict.1004 Dict.488; + let Dict.494 : U64 = CallByName Dict.89 Dict.1002 Dict.1003; + let Dict.1001 : U64 = 48i64; + let Dict.495 : U64 = CallByName Num.75 Dict.491 Dict.1001; + let Dict.1000 : U64 = 48i64; + let Dict.496 : U64 = CallByName Num.51 Dict.490 Dict.1000; + let Dict.999 : U64 = 48i64; + let Dict.997 : Int1 = CallByName Num.24 Dict.495 Dict.999; + if Dict.997 then + jump Dict.920 Dict.492 Dict.493 Dict.494 Dict.489 Dict.496 Dict.495; else - let Dict.1008 : U64 = 16i64; - let Dict.983 : Int1 = CallByName Num.24 Dict.496 Dict.1008; - if Dict.983 then - let Dict.1007 : U64 = CallByName Num.70 Dict.494 Dict.493; - let Dict.498 : U64 = CallByName Num.70 Dict.495 Dict.1007; - let Dict.984 : {U64, U64, U64} = CallByName Dict.84 Dict.498 Dict.490 Dict.497 Dict.496; - ret Dict.984; + let Dict.996 : U64 = 16i64; + let Dict.971 : Int1 = CallByName Num.24 Dict.495 Dict.996; + if Dict.971 then + let Dict.995 : U64 = CallByName Num.70 Dict.493 Dict.492; + let Dict.497 : U64 = CallByName Num.70 Dict.494 Dict.995; + let Dict.972 : {U64, U64, U64} = CallByName Dict.84 Dict.497 Dict.489 Dict.496 Dict.495; + ret Dict.972; else - inc Dict.490; - let Dict.982 : U64 = CallByName Num.70 Dict.494 Dict.493; - let Dict.499 : U64 = CallByName Num.70 Dict.495 Dict.982; - let Dict.981 : U64 = 16i64; - let Dict.980 : U64 = CallByName Num.75 Dict.496 Dict.981; - let Dict.979 : U64 = CallByName Num.51 Dict.980 Dict.497; - let Dict.934 : U64 = CallByName Dict.91 Dict.490 Dict.979; - let Dict.978 : U64 = 8i64; - let Dict.977 : U64 = CallByName Num.75 Dict.496 Dict.978; - let Dict.936 : U64 = CallByName Num.51 Dict.977 Dict.497; - let Dict.935 : U64 = CallByName Dict.91 Dict.490 Dict.936; - let Dict.933 : {U64, U64, U64} = Struct {Dict.934, Dict.935, Dict.499}; - ret Dict.933; + inc Dict.489; + let Dict.970 : U64 = CallByName Num.70 Dict.493 Dict.492; + let Dict.498 : U64 = CallByName Num.70 Dict.494 Dict.970; + let Dict.969 : U64 = 16i64; + let Dict.968 : U64 = CallByName Num.75 Dict.495 Dict.969; + let Dict.967 : U64 = CallByName Num.51 Dict.968 Dict.496; + let Dict.922 : U64 = CallByName Dict.91 Dict.489 Dict.967; + let Dict.966 : U64 = 8i64; + let Dict.965 : U64 = CallByName Num.75 Dict.495 Dict.966; + let Dict.924 : U64 = CallByName Num.51 Dict.965 Dict.496; + let Dict.923 : U64 = CallByName Dict.91 Dict.489 Dict.924; + let Dict.921 : {U64, U64, U64} = Struct {Dict.922, Dict.923, Dict.498}; + ret Dict.921; in - jump Dict.932 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36; - -procedure Dict.84 (#Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): - joinpoint Dict.985 Dict.500 Dict.501 Dict.502 Dict.503: - inc 2 Dict.501; - let Dict.1005 : U64 = CallByName Dict.91 Dict.501 Dict.502; - let Dict.1006 : U64 = CallByName Dict.86; - let Dict.1000 : U64 = CallByName Num.70 Dict.1005 Dict.1006; - let Dict.1004 : U64 = 8i64; - let Dict.1003 : U64 = CallByName Num.51 Dict.502 Dict.1004; - let Dict.1002 : U64 = CallByName Dict.91 Dict.501 Dict.1003; - let Dict.1001 : U64 = CallByName Num.70 Dict.1002 Dict.500; - let Dict.504 : U64 = CallByName Dict.89 Dict.1000 Dict.1001; - let Dict.999 : U64 = 16i64; - let Dict.505 : U64 = CallByName Num.75 Dict.503 Dict.999; - let Dict.998 : U64 = 16i64; - let Dict.506 : U64 = CallByName Num.51 Dict.502 Dict.998; - let Dict.997 : U64 = 16i64; - let Dict.987 : Int1 = CallByName Num.23 Dict.505 Dict.997; - if Dict.987 then - inc Dict.501; - let Dict.996 : U64 = 16i64; - let Dict.995 : U64 = CallByName Num.75 Dict.505 Dict.996; - let Dict.994 : U64 = CallByName Num.51 Dict.995 Dict.506; - let Dict.989 : U64 = CallByName Dict.91 Dict.501 Dict.994; - let Dict.993 : U64 = 8i64; - let Dict.992 : U64 = CallByName Num.75 Dict.505 Dict.993; - let Dict.991 : U64 = CallByName Num.51 Dict.992 Dict.506; - let Dict.990 : U64 = CallByName Dict.91 Dict.501 Dict.991; - let Dict.988 : {U64, U64, U64} = Struct {Dict.989, Dict.990, Dict.504}; - ret Dict.988; + jump Dict.920 #Derived_gen.58 #Derived_gen.59 #Derived_gen.60 #Derived_gen.61 #Derived_gen.62 #Derived_gen.63; + +procedure Dict.84 (#Derived_gen.49, #Derived_gen.50, #Derived_gen.51, #Derived_gen.52): + joinpoint Dict.973 Dict.499 Dict.500 Dict.501 Dict.502: + inc 2 Dict.500; + let Dict.993 : U64 = CallByName Dict.91 Dict.500 Dict.501; + let Dict.994 : U64 = CallByName Dict.86; + let Dict.988 : U64 = CallByName Num.70 Dict.993 Dict.994; + let Dict.992 : U64 = 8i64; + let Dict.991 : U64 = CallByName Num.51 Dict.501 Dict.992; + let Dict.990 : U64 = CallByName Dict.91 Dict.500 Dict.991; + let Dict.989 : U64 = CallByName Num.70 Dict.990 Dict.499; + let Dict.503 : U64 = CallByName Dict.89 Dict.988 Dict.989; + let Dict.987 : U64 = 16i64; + let Dict.504 : U64 = CallByName Num.75 Dict.502 Dict.987; + let Dict.986 : U64 = 16i64; + let Dict.505 : U64 = CallByName Num.51 Dict.501 Dict.986; + let Dict.985 : U64 = 16i64; + let Dict.975 : Int1 = CallByName Num.23 Dict.504 Dict.985; + if Dict.975 then + inc Dict.500; + let Dict.984 : U64 = 16i64; + let Dict.983 : U64 = CallByName Num.75 Dict.504 Dict.984; + let Dict.982 : U64 = CallByName Num.51 Dict.983 Dict.505; + let Dict.977 : U64 = CallByName Dict.91 Dict.500 Dict.982; + let Dict.981 : U64 = 8i64; + let Dict.980 : U64 = CallByName Num.75 Dict.504 Dict.981; + let Dict.979 : U64 = CallByName Num.51 Dict.980 Dict.505; + let Dict.978 : U64 = CallByName Dict.91 Dict.500 Dict.979; + let Dict.976 : {U64, U64, U64} = Struct {Dict.977, Dict.978, Dict.503}; + ret Dict.976; else - jump Dict.985 Dict.504 Dict.501 Dict.506 Dict.505; + jump Dict.973 Dict.503 Dict.500 Dict.505 Dict.504; in - jump Dict.985 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; + jump Dict.973 #Derived_gen.49 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52; procedure Dict.85 (): - let Dict.921 : U64 = 11562461410679940143i64; - ret Dict.921; + let Dict.910 : U64 = 11562461410679940143i64; + ret Dict.910; procedure Dict.86 (): - let Dict.917 : U64 = 16646288086500911323i64; - ret Dict.917; + let Dict.906 : U64 = 16646288086500911323i64; + ret Dict.906; procedure Dict.87 (): - let Dict.1031 : U64 = 10285213230658275043i64; - ret Dict.1031; + let Dict.1019 : U64 = 10285213230658275043i64; + ret Dict.1019; procedure Dict.88 (): - let Dict.1021 : U64 = 6384245875588680899i64; - ret Dict.1021; - -procedure Dict.89 (Dict.507, Dict.508): - let Dict.909 : {U64, U64} = CallByName Dict.90 Dict.507 Dict.508; - let Dict.509 : U64 = StructAtIndex 0 Dict.909; - let Dict.510 : U64 = StructAtIndex 1 Dict.909; - let Dict.908 : U64 = CallByName Num.70 Dict.509 Dict.510; - ret Dict.908; - -procedure Dict.90 (Dict.511, Dict.512): - let Dict.913 : U128 = CallByName Num.135 Dict.511; - let Dict.914 : U128 = CallByName Num.135 Dict.512; - let Dict.513 : U128 = CallByName Num.21 Dict.913 Dict.914; - let Dict.514 : U64 = CallByName Num.133 Dict.513; - let Dict.912 : U8 = 64i64; - let Dict.911 : U128 = CallByName Num.74 Dict.513 Dict.912; - let Dict.515 : U64 = CallByName Num.133 Dict.911; - let Dict.910 : {U64, U64} = Struct {Dict.514, Dict.515}; - ret Dict.910; + let Dict.1009 : U64 = 6384245875588680899i64; + ret Dict.1009; + +procedure Dict.89 (Dict.506, Dict.507): + let Dict.898 : {U64, U64} = CallByName Dict.90 Dict.506 Dict.507; + let Dict.508 : U64 = StructAtIndex 0 Dict.898; + let Dict.509 : U64 = StructAtIndex 1 Dict.898; + let Dict.897 : U64 = CallByName Num.70 Dict.508 Dict.509; + ret Dict.897; + +procedure Dict.90 (Dict.510, Dict.511): + let Dict.902 : U128 = CallByName Num.135 Dict.510; + let Dict.903 : U128 = CallByName Num.135 Dict.511; + let Dict.512 : U128 = CallByName Num.21 Dict.902 Dict.903; + let Dict.513 : U64 = CallByName Num.133 Dict.512; + let Dict.901 : U8 = 64i64; + let Dict.900 : U128 = CallByName Num.74 Dict.512 Dict.901; + let Dict.514 : U64 = CallByName Num.133 Dict.900; + let Dict.899 : {U64, U64} = Struct {Dict.513, Dict.514}; + ret Dict.899; -procedure Dict.91 (Dict.516, Dict.517): - let Dict.976 : U8 = CallByName Dict.22 Dict.516 Dict.517; - let Dict.518 : U64 = CallByName Num.133 Dict.976; - let Dict.975 : U64 = 1i64; - let Dict.974 : U64 = CallByName Num.51 Dict.517 Dict.975; - let Dict.973 : U8 = CallByName Dict.22 Dict.516 Dict.974; - let Dict.519 : U64 = CallByName Num.133 Dict.973; - let Dict.972 : U64 = 2i64; - let Dict.971 : U64 = CallByName Num.51 Dict.517 Dict.972; - let Dict.970 : U8 = CallByName Dict.22 Dict.516 Dict.971; - let Dict.520 : U64 = CallByName Num.133 Dict.970; - let Dict.969 : U64 = 3i64; - let Dict.968 : U64 = CallByName Num.51 Dict.517 Dict.969; - let Dict.967 : U8 = CallByName Dict.22 Dict.516 Dict.968; - let Dict.521 : U64 = CallByName Num.133 Dict.967; - let Dict.966 : U64 = 4i64; - let Dict.965 : U64 = CallByName Num.51 Dict.517 Dict.966; - let Dict.964 : U8 = CallByName Dict.22 Dict.516 Dict.965; - let Dict.522 : U64 = CallByName Num.133 Dict.964; - let Dict.963 : U64 = 5i64; - let Dict.962 : U64 = CallByName Num.51 Dict.517 Dict.963; - let Dict.961 : U8 = CallByName Dict.22 Dict.516 Dict.962; - let Dict.523 : U64 = CallByName Num.133 Dict.961; - let Dict.960 : U64 = 6i64; - let Dict.959 : U64 = CallByName Num.51 Dict.517 Dict.960; - let Dict.958 : U8 = CallByName Dict.22 Dict.516 Dict.959; - let Dict.524 : U64 = CallByName Num.133 Dict.958; - let Dict.957 : U64 = 7i64; - let Dict.955 : U64 = CallByName Num.51 Dict.517 Dict.957; - let Dict.954 : U8 = CallByName Dict.22 Dict.516 Dict.955; - dec Dict.516; - let Dict.525 : U64 = CallByName Num.133 Dict.954; - let Dict.953 : U8 = 8i64; - let Dict.952 : U64 = CallByName Num.72 Dict.519 Dict.953; - let Dict.526 : U64 = CallByName Num.71 Dict.518 Dict.952; - let Dict.951 : U8 = 16i64; - let Dict.948 : U64 = CallByName Num.72 Dict.520 Dict.951; - let Dict.950 : U8 = 24i64; - let Dict.949 : U64 = CallByName Num.72 Dict.521 Dict.950; - let Dict.527 : U64 = CallByName Num.71 Dict.948 Dict.949; - let Dict.947 : U8 = 32i64; - let Dict.944 : U64 = CallByName Num.72 Dict.522 Dict.947; - let Dict.946 : U8 = 40i64; - let Dict.945 : U64 = CallByName Num.72 Dict.523 Dict.946; - let Dict.528 : U64 = CallByName Num.71 Dict.944 Dict.945; - let Dict.943 : U8 = 48i64; - let Dict.940 : U64 = CallByName Num.72 Dict.524 Dict.943; - let Dict.942 : U8 = 56i64; - let Dict.941 : U64 = CallByName Num.72 Dict.525 Dict.942; - let Dict.529 : U64 = CallByName Num.71 Dict.940 Dict.941; - let Dict.938 : U64 = CallByName Num.71 Dict.526 Dict.527; - let Dict.939 : U64 = CallByName Num.71 Dict.528 Dict.529; - let Dict.937 : U64 = CallByName Num.71 Dict.938 Dict.939; - ret Dict.937; - -procedure Dict.92 (Dict.530, Dict.531): - let Dict.1088 : U8 = CallByName Dict.22 Dict.530 Dict.531; - let Dict.532 : U64 = CallByName Num.133 Dict.1088; - let Dict.1087 : U64 = 1i64; - let Dict.1086 : U64 = CallByName Num.51 Dict.531 Dict.1087; - let Dict.1085 : U8 = CallByName Dict.22 Dict.530 Dict.1086; - let Dict.533 : U64 = CallByName Num.133 Dict.1085; - let Dict.1084 : U64 = 2i64; - let Dict.1083 : U64 = CallByName Num.51 Dict.531 Dict.1084; - let Dict.1082 : U8 = CallByName Dict.22 Dict.530 Dict.1083; - let Dict.534 : U64 = CallByName Num.133 Dict.1082; - let Dict.1081 : U64 = 3i64; - let Dict.1080 : U64 = CallByName Num.51 Dict.531 Dict.1081; - let Dict.1079 : U8 = CallByName Dict.22 Dict.530 Dict.1080; - dec Dict.530; - let Dict.535 : U64 = CallByName Num.133 Dict.1079; - let Dict.1078 : U8 = 8i64; - let Dict.1077 : U64 = CallByName Num.72 Dict.533 Dict.1078; - let Dict.536 : U64 = CallByName Num.71 Dict.532 Dict.1077; - let Dict.1076 : U8 = 16i64; - let Dict.1073 : U64 = CallByName Num.72 Dict.534 Dict.1076; - let Dict.1075 : U8 = 24i64; - let Dict.1074 : U64 = CallByName Num.72 Dict.535 Dict.1075; - let Dict.537 : U64 = CallByName Num.71 Dict.1073 Dict.1074; - let Dict.1072 : U64 = CallByName Num.71 Dict.536 Dict.537; - ret Dict.1072; - -procedure Dict.93 (Dict.538, Dict.539, Dict.540): - let Dict.1066 : U8 = CallByName Dict.22 Dict.538 Dict.539; - let Dict.541 : U64 = CallByName Num.133 Dict.1066; - let Dict.1065 : U8 = 1i64; - let Dict.1064 : U64 = CallByName Num.74 Dict.540 Dict.1065; - let Dict.1063 : U64 = CallByName Num.51 Dict.1064 Dict.539; - let Dict.1062 : U8 = CallByName Dict.22 Dict.538 Dict.1063; - let Dict.542 : U64 = CallByName Num.133 Dict.1062; - let Dict.1061 : U64 = 1i64; - let Dict.1060 : U64 = CallByName Num.75 Dict.540 Dict.1061; - let Dict.1059 : U64 = CallByName Num.51 Dict.1060 Dict.539; - let Dict.1058 : U8 = CallByName Dict.22 Dict.538 Dict.1059; - dec Dict.538; - let Dict.543 : U64 = CallByName Num.133 Dict.1058; - let Dict.1057 : U8 = 16i64; - let Dict.1054 : U64 = CallByName Num.72 Dict.541 Dict.1057; - let Dict.1056 : U8 = 8i64; - let Dict.1055 : U64 = CallByName Num.72 Dict.542 Dict.1056; - let Dict.544 : U64 = CallByName Num.71 Dict.1054 Dict.1055; - let Dict.1053 : U64 = CallByName Num.71 Dict.544 Dict.543; - ret Dict.1053; - -procedure Hash.19 (Hash.39, Hash.40): - let Hash.77 : List U8 = CallByName Str.12 Hash.40; - let Hash.76 : {U64, U64} = CallByName Dict.82 Hash.39 Hash.77; - ret Hash.76; - -procedure Inspect.188 (Inspect.189, #Attr.12): - let Inspect.187 : {} = StructAtIndex 3 #Attr.12; - let Inspect.186 : {} = StructAtIndex 2 #Attr.12; - let Inspect.185 : {} = StructAtIndex 1 #Attr.12; - let Inspect.184 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = StructAtIndex 0 #Attr.12; - let Inspect.359 : Str = "{"; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.189 Inspect.359; - let Inspect.333 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = Struct {Inspect.184, Inspect.185, Inspect.186, Inspect.187}; - let Inspect.328 : {Str, Int1} = CallByName Inspect.190 Inspect.332 Inspect.333; - let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.202 Inspect.328; - let Inspect.325 : Str = "}"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; +procedure Dict.91 (Dict.515, Dict.516): + let Dict.964 : U8 = CallByName Dict.22 Dict.515 Dict.516; + let Dict.517 : U64 = CallByName Num.133 Dict.964; + let Dict.963 : U64 = 1i64; + let Dict.962 : U64 = CallByName Num.51 Dict.516 Dict.963; + let Dict.961 : U8 = CallByName Dict.22 Dict.515 Dict.962; + let Dict.518 : U64 = CallByName Num.133 Dict.961; + let Dict.960 : U64 = 2i64; + let Dict.959 : U64 = CallByName Num.51 Dict.516 Dict.960; + let Dict.958 : U8 = CallByName Dict.22 Dict.515 Dict.959; + let Dict.519 : U64 = CallByName Num.133 Dict.958; + let Dict.957 : U64 = 3i64; + let Dict.956 : U64 = CallByName Num.51 Dict.516 Dict.957; + let Dict.955 : U8 = CallByName Dict.22 Dict.515 Dict.956; + let Dict.520 : U64 = CallByName Num.133 Dict.955; + let Dict.954 : U64 = 4i64; + let Dict.953 : U64 = CallByName Num.51 Dict.516 Dict.954; + let Dict.952 : U8 = CallByName Dict.22 Dict.515 Dict.953; + let Dict.521 : U64 = CallByName Num.133 Dict.952; + let Dict.951 : U64 = 5i64; + let Dict.950 : U64 = CallByName Num.51 Dict.516 Dict.951; + let Dict.949 : U8 = CallByName Dict.22 Dict.515 Dict.950; + let Dict.522 : U64 = CallByName Num.133 Dict.949; + let Dict.948 : U64 = 6i64; + let Dict.947 : U64 = CallByName Num.51 Dict.516 Dict.948; + let Dict.946 : U8 = CallByName Dict.22 Dict.515 Dict.947; + let Dict.523 : U64 = CallByName Num.133 Dict.946; + let Dict.945 : U64 = 7i64; + let Dict.943 : U64 = CallByName Num.51 Dict.516 Dict.945; + let Dict.942 : U8 = CallByName Dict.22 Dict.515 Dict.943; + dec Dict.515; + let Dict.524 : U64 = CallByName Num.133 Dict.942; + let Dict.941 : U8 = 8i64; + let Dict.940 : U64 = CallByName Num.72 Dict.518 Dict.941; + let Dict.525 : U64 = CallByName Num.71 Dict.517 Dict.940; + let Dict.939 : U8 = 16i64; + let Dict.936 : U64 = CallByName Num.72 Dict.519 Dict.939; + let Dict.938 : U8 = 24i64; + let Dict.937 : U64 = CallByName Num.72 Dict.520 Dict.938; + let Dict.526 : U64 = CallByName Num.71 Dict.936 Dict.937; + let Dict.935 : U8 = 32i64; + let Dict.932 : U64 = CallByName Num.72 Dict.521 Dict.935; + let Dict.934 : U8 = 40i64; + let Dict.933 : U64 = CallByName Num.72 Dict.522 Dict.934; + let Dict.527 : U64 = CallByName Num.71 Dict.932 Dict.933; + let Dict.931 : U8 = 48i64; + let Dict.928 : U64 = CallByName Num.72 Dict.523 Dict.931; + let Dict.930 : U8 = 56i64; + let Dict.929 : U64 = CallByName Num.72 Dict.524 Dict.930; + let Dict.528 : U64 = CallByName Num.71 Dict.928 Dict.929; + let Dict.926 : U64 = CallByName Num.71 Dict.525 Dict.526; + let Dict.927 : U64 = CallByName Num.71 Dict.527 Dict.528; + let Dict.925 : U64 = CallByName Num.71 Dict.926 Dict.927; + ret Dict.925; + +procedure Dict.92 (Dict.529, Dict.530): + let Dict.1076 : U8 = CallByName Dict.22 Dict.529 Dict.530; + let Dict.531 : U64 = CallByName Num.133 Dict.1076; + let Dict.1075 : U64 = 1i64; + let Dict.1074 : U64 = CallByName Num.51 Dict.530 Dict.1075; + let Dict.1073 : U8 = CallByName Dict.22 Dict.529 Dict.1074; + let Dict.532 : U64 = CallByName Num.133 Dict.1073; + let Dict.1072 : U64 = 2i64; + let Dict.1071 : U64 = CallByName Num.51 Dict.530 Dict.1072; + let Dict.1070 : U8 = CallByName Dict.22 Dict.529 Dict.1071; + let Dict.533 : U64 = CallByName Num.133 Dict.1070; + let Dict.1069 : U64 = 3i64; + let Dict.1068 : U64 = CallByName Num.51 Dict.530 Dict.1069; + let Dict.1067 : U8 = CallByName Dict.22 Dict.529 Dict.1068; + dec Dict.529; + let Dict.534 : U64 = CallByName Num.133 Dict.1067; + let Dict.1066 : U8 = 8i64; + let Dict.1065 : U64 = CallByName Num.72 Dict.532 Dict.1066; + let Dict.535 : U64 = CallByName Num.71 Dict.531 Dict.1065; + let Dict.1064 : U8 = 16i64; + let Dict.1061 : U64 = CallByName Num.72 Dict.533 Dict.1064; + let Dict.1063 : U8 = 24i64; + let Dict.1062 : U64 = CallByName Num.72 Dict.534 Dict.1063; + let Dict.536 : U64 = CallByName Num.71 Dict.1061 Dict.1062; + let Dict.1060 : U64 = CallByName Num.71 Dict.535 Dict.536; + ret Dict.1060; + +procedure Dict.93 (Dict.537, Dict.538, Dict.539): + let Dict.1054 : U8 = CallByName Dict.22 Dict.537 Dict.538; + let Dict.540 : U64 = CallByName Num.133 Dict.1054; + let Dict.1053 : U8 = 1i64; + let Dict.1052 : U64 = CallByName Num.74 Dict.539 Dict.1053; + let Dict.1051 : U64 = CallByName Num.51 Dict.1052 Dict.538; + let Dict.1050 : U8 = CallByName Dict.22 Dict.537 Dict.1051; + let Dict.541 : U64 = CallByName Num.133 Dict.1050; + let Dict.1049 : U64 = 1i64; + let Dict.1048 : U64 = CallByName Num.75 Dict.539 Dict.1049; + let Dict.1047 : U64 = CallByName Num.51 Dict.1048 Dict.538; + let Dict.1046 : U8 = CallByName Dict.22 Dict.537 Dict.1047; + dec Dict.537; + let Dict.542 : U64 = CallByName Num.133 Dict.1046; + let Dict.1045 : U8 = 16i64; + let Dict.1042 : U64 = CallByName Num.72 Dict.540 Dict.1045; + let Dict.1044 : U8 = 8i64; + let Dict.1043 : U64 = CallByName Num.72 Dict.541 Dict.1044; + let Dict.543 : U64 = CallByName Num.71 Dict.1042 Dict.1043; + let Dict.1041 : U64 = CallByName Num.71 Dict.543 Dict.542; + ret Dict.1041; + +procedure Hash.19 (Hash.38, Hash.39): + let Hash.71 : List U8 = CallByName Str.12 Hash.39; + let Hash.70 : {U64, U64} = CallByName Dict.82 Hash.38 Hash.71; + ret Hash.70; + +procedure Inspect.183 (Inspect.184, #Attr.12): + let Inspect.182 : {} = StructAtIndex 3 #Attr.12; + let Inspect.181 : {} = StructAtIndex 2 #Attr.12; + let Inspect.180 : {} = StructAtIndex 1 #Attr.12; + let Inspect.179 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = StructAtIndex 0 #Attr.12; + let Inspect.351 : Str = "{"; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.184 Inspect.351; + let Inspect.325 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = Struct {Inspect.179, Inspect.180, Inspect.181, Inspect.182}; + let Inspect.320 : {Str, Int1} = CallByName Inspect.185 Inspect.324 Inspect.325; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.197 Inspect.320; + let Inspect.317 : Str = "}"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; -procedure Inspect.190 (Inspect.191, #Attr.12): - let Inspect.187 : {} = StructAtIndex 3 #Attr.12; - let Inspect.186 : {} = StructAtIndex 2 #Attr.12; - let Inspect.185 : {} = StructAtIndex 1 #Attr.12; - let Inspect.184 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = StructAtIndex 0 #Attr.12; - let Inspect.358 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.191, Inspect.358}; - let Inspect.337 : {{}, {}} = Struct {Inspect.186, Inspect.187}; - let Inspect.335 : {Str, Int1} = CallByName Dict.10 Inspect.184 Inspect.336 Inspect.337; - ret Inspect.335; +procedure Inspect.185 (Inspect.186, #Attr.12): + let Inspect.182 : {} = StructAtIndex 3 #Attr.12; + let Inspect.181 : {} = StructAtIndex 2 #Attr.12; + let Inspect.180 : {} = StructAtIndex 1 #Attr.12; + let Inspect.179 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = StructAtIndex 0 #Attr.12; + let Inspect.350 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.186, Inspect.350}; + let Inspect.329 : {{}, {}} = Struct {Inspect.181, Inspect.182}; + let Inspect.327 : {Str, Int1} = CallByName Dict.10 Inspect.179 Inspect.328 Inspect.329; + ret Inspect.327; -procedure Inspect.192 (Inspect.338, Inspect.195, Inspect.196, #Attr.12): - let Inspect.187 : {} = StructAtIndex 1 #Attr.12; - let Inspect.186 : {} = StructAtIndex 0 #Attr.12; - let Inspect.193 : Str = StructAtIndex 0 Inspect.338; - let Inspect.194 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.356 Inspect.197: - let Inspect.353 : Str = CallByName Inspect.44 Inspect.195; - let Inspect.351 : Str = CallByName Inspect.31 Inspect.353 Inspect.197; - let Inspect.352 : Str = ": "; - let Inspect.345 : Str = CallByName Inspect.61 Inspect.351 Inspect.352; - let Inspect.346 : {I64, {}} = Struct {Inspect.196, Inspect.187}; - let Inspect.341 : Str = CallByName Inspect.198 Inspect.345 Inspect.346; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.200 Inspect.341; - ret Inspect.340; +procedure Inspect.187 (Inspect.330, Inspect.190, Inspect.191, #Attr.12): + let Inspect.182 : {} = StructAtIndex 1 #Attr.12; + let Inspect.181 : {} = StructAtIndex 0 #Attr.12; + let Inspect.188 : Str = StructAtIndex 0 Inspect.330; + let Inspect.189 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.348 Inspect.192: + let Inspect.345 : Str = CallByName Inspect.43 Inspect.190; + let Inspect.343 : Str = CallByName Inspect.31 Inspect.345 Inspect.192; + let Inspect.344 : Str = ": "; + let Inspect.337 : Str = CallByName Inspect.59 Inspect.343 Inspect.344; + let Inspect.338 : {I64, {}} = Struct {Inspect.191, Inspect.182}; + let Inspect.333 : Str = CallByName Inspect.193 Inspect.337 Inspect.338; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.195 Inspect.333; + ret Inspect.332; in - if Inspect.194 then - let Inspect.357 : Str = ", "; - let Inspect.355 : Str = CallByName Inspect.61 Inspect.193 Inspect.357; - jump Inspect.356 Inspect.355; + if Inspect.189 then + let Inspect.349 : Str = ", "; + let Inspect.347 : Str = CallByName Inspect.59 Inspect.188 Inspect.349; + jump Inspect.348 Inspect.347; else - jump Inspect.356 Inspect.193; - -procedure Inspect.198 (Inspect.199, #Attr.12): - let Inspect.187 : {} = StructAtIndex 1 #Attr.12; - let Inspect.196 : I64 = StructAtIndex 0 #Attr.12; - let Inspect.349 : I64 = CallByName Inspect.54 Inspect.196; - let Inspect.348 : Str = CallByName Inspect.31 Inspect.349 Inspect.199; - ret Inspect.348; - -procedure Inspect.200 (Inspect.201): - let Inspect.344 : Int1 = CallByName Bool.2; - let Inspect.343 : {Str, Int1} = Struct {Inspect.201, Inspect.344}; - ret Inspect.343; - -procedure Inspect.202 (Inspect.330): - let Inspect.331 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.331; - -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.374 : Str = "\""; - let Inspect.373 : Str = CallByName Inspect.61 Inspect.252 Inspect.374; - let Inspect.371 : Str = CallByName Inspect.61 Inspect.373 Inspect.250; - let Inspect.372 : Str = "\""; - let Inspect.370 : Str = CallByName Inspect.61 Inspect.371 Inspect.372; - ret Inspect.370; - -procedure Inspect.279 (Inspect.280, Inspect.278): - let Inspect.365 : Str = CallByName Num.96 Inspect.278; - let Inspect.364 : Str = CallByName Inspect.61 Inspect.280 Inspect.365; - ret Inspect.364; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.188 Inspect.150 Inspect.307; - ret Inspect.318; - -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.350 : Str = CallByName Inspect.279 Inspect.150 Inspect.307; - ret Inspect.350; - -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.354 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.354; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; + jump Inspect.348 Inspect.188; + +procedure Inspect.193 (Inspect.194, #Attr.12): + let Inspect.182 : {} = StructAtIndex 1 #Attr.12; + let Inspect.191 : I64 = StructAtIndex 0 #Attr.12; + let Inspect.341 : I64 = CallByName Inspect.53 Inspect.191; + let Inspect.340 : Str = CallByName Inspect.31 Inspect.341 Inspect.194; + ret Inspect.340; + +procedure Inspect.195 (Inspect.196): + let Inspect.336 : Int1 = CallByName Bool.2; + let Inspect.335 : {Str, Int1} = Struct {Inspect.196, Inspect.336}; + ret Inspect.335; -procedure Inspect.39 (Inspect.184, Inspect.185, Inspect.186, Inspect.187): - let Inspect.320 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = Struct {Inspect.184, Inspect.185, Inspect.186, Inspect.187}; - let Inspect.319 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = CallByName Inspect.30 Inspect.320; - ret Inspect.319; +procedure Inspect.197 (Inspect.322): + let Inspect.323 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.323; + +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.366 : Str = "\""; + let Inspect.365 : Str = CallByName Inspect.59 Inspect.247 Inspect.366; + let Inspect.363 : Str = CallByName Inspect.59 Inspect.365 Inspect.245; + let Inspect.364 : Str = "\""; + let Inspect.362 : Str = CallByName Inspect.59 Inspect.363 Inspect.364; + ret Inspect.362; + +procedure Inspect.274 (Inspect.275, Inspect.273): + let Inspect.357 : Str = CallByName Num.96 Inspect.273; + let Inspect.356 : Str = CallByName Inspect.59 Inspect.275 Inspect.357; + ret Inspect.356; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.44 (Inspect.250): - let Inspect.366 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.366; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.36 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Dict.120 Inspect.312 Inspect.316; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.183 Inspect.145 Inspect.299; + ret Inspect.310; + +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.342 : Str = CallByName Inspect.274 Inspect.145 Inspect.299; + ret Inspect.342; + +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.346 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.346; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.38 (Inspect.179, Inspect.180, Inspect.181, Inspect.182): + let Inspect.312 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = Struct {Inspect.179, Inspect.180, Inspect.181, Inspect.182}; + let Inspect.311 : {{List {U32, U32}, List {Str, I64}, U64, Float32, U8}, {}, {}, {}} = CallByName Inspect.30 Inspect.312; ret Inspect.311; -procedure Inspect.54 (Inspect.278): - let Inspect.360 : I64 = CallByName Inspect.30 Inspect.278; - ret Inspect.360; +procedure Inspect.43 (Inspect.245): + let Inspect.358 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.358; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.327 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.327; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.36 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Dict.120 Inspect.304 Inspect.308; + ret Inspect.303; + +procedure Inspect.53 (Inspect.273): + let Inspect.352 : I64 = CallByName Inspect.30 Inspect.273; + ret Inspect.352; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.319 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.319; + +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.11 (List.136, List.137): let List.633 : List {U32, U32} = CallByName List.68 List.137; @@ -915,8 +905,8 @@ procedure List.3 (List.114, List.115, List.116): procedure List.3 (List.114, List.115, List.116): let List.599 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.114 List.115 List.116; let List.598 : List {Str, I64} = StructAtIndex 0 List.599; - let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.599; - dec #Derived_gen.71; + let #Derived_gen.70 : {Str, I64} = StructAtIndex 1 List.599; + dec #Derived_gen.70; ret List.598; procedure List.4 (List.122, List.123): @@ -991,7 +981,7 @@ procedure List.83 (List.167, List.168, List.169): let List.610 : List {U32, U32} = CallByName List.91 List.167 List.168 List.169 List.611 List.612; ret List.610; -procedure List.88 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60): +procedure List.88 (#Derived_gen.53, #Derived_gen.54, #Derived_gen.55): joinpoint List.622 List.138 List.139 List.140: let List.630 : U64 = 0i64; let List.624 : Int1 = CallByName Num.24 List.139 List.630; @@ -1003,31 +993,15 @@ procedure List.88 (#Derived_gen.58, #Derived_gen.59, #Derived_gen.60): else ret List.140; in - jump List.622 #Derived_gen.58 #Derived_gen.59 #Derived_gen.60; + jump List.622 #Derived_gen.53 #Derived_gen.54 #Derived_gen.55; -procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): - joinpoint List.638 List.161 List.162 List.163 List.164 List.165: - let List.640 : Int1 = CallByName Num.22 List.164 List.165; - if List.640 then - let List.644 : {Str, I64} = CallByName List.66 List.161 List.164; - inc List.644; - let List.166 : {Str, Int1} = CallByName Dict.182 List.162 List.644 List.163; - let List.643 : U64 = 1i64; - let List.642 : U64 = CallByName Num.51 List.164 List.643; - jump List.638 List.161 List.166 List.163 List.642 List.165; - else - dec List.161; - ret List.162; - in - jump List.638 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; - -procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): +procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): joinpoint List.574 List.161 List.162 List.163 List.164 List.165: let List.576 : Int1 = CallByName Num.22 List.164 List.165; if List.576 then let List.580 : {Str, I64} = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.153 List.162 List.580; + let List.166 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.152 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -1035,15 +1009,31 @@ procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_g dec List.161; ret List.162; in - jump List.574 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + jump List.574 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + +procedure List.90 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37): + joinpoint List.638 List.161 List.162 List.163 List.164 List.165: + let List.640 : Int1 = CallByName Num.22 List.164 List.165; + if List.640 then + let List.644 : {Str, I64} = CallByName List.66 List.161 List.164; + inc List.644; + let List.166 : {Str, Int1} = CallByName Dict.181 List.162 List.644 List.163; + let List.643 : U64 = 1i64; + let List.642 : U64 = CallByName Num.51 List.164 List.643; + jump List.638 List.161 List.166 List.163 List.642 List.165; + else + dec List.161; + ret List.162; + in + jump List.638 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37; -procedure List.91 (#Derived_gen.61, #Derived_gen.62, #Derived_gen.63, #Derived_gen.64, #Derived_gen.65): +procedure List.91 (#Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48): joinpoint List.613 List.170 List.171 List.172 List.173 List.174: let List.615 : Int1 = CallByName Num.22 List.173 List.174; if List.615 then let List.619 : {Str, I64} = CallByName List.66 List.170 List.173; inc List.619; - let List.175 : List {U32, U32} = CallByName Dict.399 List.171 List.619 List.173 List.172; + let List.175 : List {U32, U32} = CallByName Dict.398 List.171 List.619 List.173 List.172; let List.618 : U64 = 1i64; let List.617 : U64 = CallByName Num.51 List.173 List.618; jump List.613 List.170 List.175 List.172 List.617 List.174; @@ -1051,154 +1041,142 @@ procedure List.91 (#Derived_gen.61, #Derived_gen.62, #Derived_gen.63, #Derived_g dec List.170; ret List.171; in - jump List.613 #Derived_gen.61 #Derived_gen.62 #Derived_gen.63 #Derived_gen.64 #Derived_gen.65; + jump List.613 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48; procedure Num.131 (#Attr.2): - let Num.316 : U32 = lowlevel NumIntCast #Attr.2; - ret Num.316; + let Num.265 : U32 = lowlevel NumIntCast #Attr.2; + ret Num.265; procedure Num.133 (#Attr.2): - let Num.371 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.371; + let Num.273 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.273; procedure Num.133 (#Attr.2): - let Num.372 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.372; + let Num.322 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.322; procedure Num.133 (#Attr.2): - let Num.387 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.387; + let Num.337 : U64 = lowlevel NumIntCast #Attr.2; + ret Num.337; procedure Num.135 (#Attr.2): - let Num.393 : U128 = lowlevel NumIntCast #Attr.2; - ret Num.393; - -procedure Num.137 (#Attr.2): - let Num.307 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.307; - -procedure Num.137 (#Attr.2): - let Num.313 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.313; + let Num.343 : U128 = lowlevel NumIntCast #Attr.2; + ret Num.343; procedure Num.139 (#Attr.2): - let Num.340 : Float32 = lowlevel NumToFloatCast #Attr.2; - ret Num.340; + let Num.291 : Float32 = lowlevel NumToFloatCast #Attr.2; + ret Num.291; -procedure Num.159 (Num.245, Num.246): - let Num.342 : Int1 = CallByName Num.22 Num.245 Num.246; - if Num.342 then - ret Num.245; +procedure Num.148 (Num.205, Num.206): + let Num.293 : Int1 = CallByName Num.22 Num.205 Num.206; + if Num.293 then + ret Num.205; else - ret Num.246; - -procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U32 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; - -procedure Num.20 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.317; - -procedure Num.20 (#Attr.2, #Attr.3): - let Num.320 : U8 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.320; + ret Num.206; procedure Num.21 (#Attr.2, #Attr.3): - let Num.333 : Float32 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.333; + let Num.284 : Float32 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.284; procedure Num.21 (#Attr.2, #Attr.3): - let Num.391 : U128 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.391; + let Num.341 : U128 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.341; procedure Num.22 (#Attr.2, #Attr.3): - let Num.337 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.337; + let Num.288 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.288; procedure Num.22 (#Attr.2, #Attr.3): - let Num.466 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.466; + let Num.416 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.416; procedure Num.23 (#Attr.2, #Attr.3): - let Num.459 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; - ret Num.459; + let Num.409 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; + ret Num.409; procedure Num.24 (#Attr.2, #Attr.3): - let Num.321 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.321; + let Num.271 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.271; procedure Num.24 (#Attr.2, #Attr.3): - let Num.462 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.462; + let Num.412 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.412; procedure Num.25 (#Attr.2, #Attr.3): - let Num.463 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; - ret Num.463; + let Num.413 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; + ret Num.413; procedure Num.50 (#Attr.2): - let Num.339 : U64 = lowlevel NumFloor #Attr.2; - ret Num.339; + let Num.290 : U64 = lowlevel NumFloor #Attr.2; + ret Num.290; + +procedure Num.51 (#Attr.2, #Attr.3): + let Num.257 : U32 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Num.51 (#Attr.2, #Attr.3): - let Num.465 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.465; + let Num.415 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.415; procedure Num.69 (#Attr.2, #Attr.3): - let Num.325 : U32 = lowlevel NumBitwiseAnd #Attr.2 #Attr.3; - ret Num.325; + let Num.279 : U32 = lowlevel NumBitwiseAnd #Attr.2 #Attr.3; + ret Num.279; procedure Num.70 (#Attr.2, #Attr.3): - let Num.369 : U64 = lowlevel NumBitwiseXor #Attr.2 #Attr.3; - ret Num.369; + let Num.320 : U64 = lowlevel NumBitwiseXor #Attr.2 #Attr.3; + ret Num.320; procedure Num.71 (#Attr.2, #Attr.3): - let Num.324 : U32 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; - ret Num.324; + let Num.278 : U32 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; + ret Num.278; procedure Num.71 (#Attr.2, #Attr.3): - let Num.407 : U64 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; - ret Num.407; + let Num.357 : U64 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; + ret Num.357; procedure Num.72 (#Attr.2, #Attr.3): - let Num.298 : U32 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; - ret Num.298; + let Num.260 : U32 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; + ret Num.260; procedure Num.72 (#Attr.2, #Attr.3): - let Num.422 : U64 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; - ret Num.422; + let Num.372 : U64 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; + ret Num.372; procedure Num.74 (#Attr.2, #Attr.3): - let Num.388 : U128 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3; - ret Num.388; + let Num.338 : U128 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3; + ret Num.338; procedure Num.74 (#Attr.2, #Attr.3): - let Num.390 : U64 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3; - ret Num.390; + let Num.340 : U64 = lowlevel NumShiftRightZfBy #Attr.2 #Attr.3; + ret Num.340; + +procedure Num.75 (#Attr.2, #Attr.3): + let Num.267 : U32 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.267; procedure Num.75 (#Attr.2, #Attr.3): - let Num.326 : U32 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.326; + let Num.270 : U8 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.270; procedure Num.75 (#Attr.2, #Attr.3): - let Num.456 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.456; + let Num.406 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.406; procedure Num.96 (#Attr.2): - let Num.336 : Str = lowlevel NumToStr #Attr.2; - ret Num.336; + let Num.287 : Str = lowlevel NumToStr #Attr.2; + ret Num.287; procedure Num.96 (#Attr.2): - let Num.464 : Str = lowlevel NumToStr #Attr.2; - ret Num.464; + let Num.414 : Str = lowlevel NumToStr #Attr.2; + ret Num.414; procedure Str.12 (#Attr.2): - let Str.252 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.252; + let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.251; procedure Str.3 (#Attr.2, #Attr.3): - let Str.253 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.253; + let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.252; procedure Test.0 (): let Test.8 : Str = "a"; @@ -1209,5 +1187,5 @@ procedure Test.0 (): let Test.5 : {Str, I64} = Struct {Test.6, Test.7}; let Test.3 : List {Str, I64} = Array [Test.4, Test.5]; let Test.2 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.12 Test.3; - let Test.1 : Str = CallByName Inspect.34 Test.2; + let Test.1 : Str = CallByName Inspect.33 Test.2; ret Test.1; diff --git a/crates/compiler/test_mono/generated/inspect_derived_list.txt b/crates/compiler/test_mono/generated/inspect_derived_list.txt index e4a846b5c0f..8cd19364429 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_list.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_list.txt @@ -3,13 +3,13 @@ procedure #Derived.0 (#Derived.1): ret #Derived_gen.0; procedure #Derived.3 (#Derived.2): - let #Derived_gen.7 : I64 = CallByName Inspect.54 #Derived.2; + let #Derived_gen.7 : I64 = CallByName Inspect.53 #Derived.2; ret #Derived_gen.7; procedure #Derived.4 (#Derived.5, #Derived.1): let #Derived_gen.5 : {} = Struct {}; let #Derived_gen.6 : {} = Struct {}; - let #Derived_gen.4 : {List I64, {}, {}} = CallByName Inspect.37 #Derived.1 #Derived_gen.5 #Derived_gen.6; + let #Derived_gen.4 : {List I64, {}, {}} = CallByName Inspect.36 #Derived.1 #Derived_gen.5 #Derived_gen.6; let #Derived_gen.3 : Str = CallByName Inspect.31 #Derived_gen.4 #Derived.5; ret #Derived_gen.3; @@ -21,109 +21,109 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Inspect.157 (Inspect.158, #Attr.12): - let Inspect.156 : {} = StructAtIndex 2 #Attr.12; - let Inspect.155 : {} = StructAtIndex 1 #Attr.12; - let Inspect.154 : List I64 = StructAtIndex 0 #Attr.12; - let Inspect.351 : Str = "["; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.158 Inspect.351; - let Inspect.333 : {List I64, {}, {}} = Struct {Inspect.154, Inspect.155, Inspect.156}; - let Inspect.328 : {Str, Int1} = CallByName Inspect.159 Inspect.332 Inspect.333; - let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.168 Inspect.328; - let Inspect.325 : Str = "]"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; +procedure Inspect.152 (Inspect.153, #Attr.12): + let Inspect.151 : {} = StructAtIndex 2 #Attr.12; + let Inspect.150 : {} = StructAtIndex 1 #Attr.12; + let Inspect.149 : List I64 = StructAtIndex 0 #Attr.12; + let Inspect.343 : Str = "["; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.153 Inspect.343; + let Inspect.325 : {List I64, {}, {}} = Struct {Inspect.149, Inspect.150, Inspect.151}; + let Inspect.320 : {Str, Int1} = CallByName Inspect.154 Inspect.324 Inspect.325; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.163 Inspect.320; + let Inspect.317 : Str = "]"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; -procedure Inspect.159 (Inspect.160, #Attr.12): - let Inspect.156 : {} = StructAtIndex 2 #Attr.12; - let Inspect.155 : {} = StructAtIndex 1 #Attr.12; - let Inspect.154 : List I64 = StructAtIndex 0 #Attr.12; - let Inspect.350 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.160, Inspect.350}; - let Inspect.335 : {Str, Int1} = CallByName List.18 Inspect.154 Inspect.336 Inspect.156; - ret Inspect.335; +procedure Inspect.154 (Inspect.155, #Attr.12): + let Inspect.151 : {} = StructAtIndex 2 #Attr.12; + let Inspect.150 : {} = StructAtIndex 1 #Attr.12; + let Inspect.149 : List I64 = StructAtIndex 0 #Attr.12; + let Inspect.342 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.155, Inspect.342}; + let Inspect.327 : {Str, Int1} = CallByName List.18 Inspect.149 Inspect.328 Inspect.151; + ret Inspect.327; -procedure Inspect.161 (Inspect.338, Inspect.164, Inspect.156): - let Inspect.162 : Str = StructAtIndex 0 Inspect.338; - let Inspect.163 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.348 Inspect.165: - let Inspect.345 : I64 = CallByName #Derived.3 Inspect.164; - let Inspect.341 : Str = CallByName Inspect.31 Inspect.345 Inspect.165; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.166 Inspect.341; - ret Inspect.340; +procedure Inspect.156 (Inspect.330, Inspect.159, Inspect.151): + let Inspect.157 : Str = StructAtIndex 0 Inspect.330; + let Inspect.158 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.340 Inspect.160: + let Inspect.337 : I64 = CallByName #Derived.3 Inspect.159; + let Inspect.333 : Str = CallByName Inspect.31 Inspect.337 Inspect.160; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.161 Inspect.333; + ret Inspect.332; in - if Inspect.163 then - let Inspect.349 : Str = ", "; - let Inspect.347 : Str = CallByName Inspect.61 Inspect.162 Inspect.349; - jump Inspect.348 Inspect.347; + if Inspect.158 then + let Inspect.341 : Str = ", "; + let Inspect.339 : Str = CallByName Inspect.59 Inspect.157 Inspect.341; + jump Inspect.340 Inspect.339; else - jump Inspect.348 Inspect.162; - -procedure Inspect.166 (Inspect.167): - let Inspect.344 : Int1 = CallByName Bool.2; - let Inspect.343 : {Str, Int1} = Struct {Inspect.167, Inspect.344}; - ret Inspect.343; + jump Inspect.340 Inspect.157; -procedure Inspect.168 (Inspect.330): - let Inspect.331 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.331; +procedure Inspect.161 (Inspect.162): + let Inspect.336 : Int1 = CallByName Bool.2; + let Inspect.335 : {Str, Int1} = Struct {Inspect.162, Inspect.336}; + ret Inspect.335; -procedure Inspect.279 (Inspect.280, Inspect.278): - let Inspect.357 : Str = CallByName Num.96 Inspect.278; - let Inspect.356 : Str = CallByName Inspect.61 Inspect.280 Inspect.357; - ret Inspect.356; +procedure Inspect.163 (Inspect.322): + let Inspect.323 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.323; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.274 (Inspect.275, Inspect.273): + let Inspect.349 : Str = CallByName Num.96 Inspect.273; + let Inspect.348 : Str = CallByName Inspect.59 Inspect.275 Inspect.349; + ret Inspect.348; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.157 Inspect.150 Inspect.307; - ret Inspect.318; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.346 : Str = CallByName Inspect.279 Inspect.150 Inspect.307; - ret Inspect.346; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.152 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.338 : Str = CallByName Inspect.274 Inspect.145 Inspect.299; + ret Inspect.338; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.37 (Inspect.154, Inspect.155, Inspect.156): - let Inspect.320 : {List I64, {}, {}} = Struct {Inspect.154, Inspect.155, Inspect.156}; - let Inspect.319 : {List I64, {}, {}} = CallByName Inspect.30 Inspect.320; - ret Inspect.319; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : List I64 = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.4 Inspect.312 Inspect.316; +procedure Inspect.36 (Inspect.149, Inspect.150, Inspect.151): + let Inspect.312 : {List I64, {}, {}} = Struct {Inspect.149, Inspect.150, Inspect.151}; + let Inspect.311 : {List I64, {}, {}} = CallByName Inspect.30 Inspect.312; ret Inspect.311; -procedure Inspect.54 (Inspect.278): - let Inspect.352 : I64 = CallByName Inspect.30 Inspect.278; - ret Inspect.352; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : List I64 = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.4 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.327 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.327; +procedure Inspect.53 (Inspect.273): + let Inspect.344 : I64 = CallByName Inspect.30 Inspect.273; + ret Inspect.344; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.319 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.319; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.18 (List.158, List.159, List.160): let List.572 : U64 = 0i64; @@ -139,12 +139,12 @@ procedure List.66 (#Attr.2, #Attr.3): let List.581 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.581; -procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): +procedure List.90 (#Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16): joinpoint List.574 List.161 List.162 List.163 List.164 List.165: let List.576 : Int1 = CallByName Num.22 List.164 List.165; if List.576 then let List.580 : I64 = CallByName List.66 List.161 List.164; - let List.166 : {Str, Int1} = CallByName Inspect.161 List.162 List.580 List.163; + let List.166 : {Str, Int1} = CallByName Inspect.156 List.162 List.580 List.163; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -152,25 +152,25 @@ procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_g dec List.161; ret List.162; in - jump List.574 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + jump List.574 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16; procedure Num.22 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.259; procedure Num.51 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.258; procedure Num.96 (#Attr.2): - let Num.297 : Str = lowlevel NumToStr #Attr.2; - ret Num.297; + let Num.257 : Str = lowlevel NumToStr #Attr.2; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.2 : List I64 = Array [1i64, 2i64, 3i64]; - let Test.1 : Str = CallByName Inspect.34 Test.2; + let Test.1 : Str = CallByName Inspect.33 Test.2; ret Test.1; 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 243bebc8b76..38eaa2d7e81 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 @@ -7,7 +7,7 @@ procedure #Derived.2 (#Derived.3, #Derived.1): let #Derived_gen.8 : Str = CallByName #Derived.4 #Derived.1; let #Derived_gen.6 : {Str, Str} = Struct {#Derived_gen.7, #Derived_gen.8}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6]; - let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.42 #Derived_gen.5; + let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.41 #Derived_gen.5; let #Derived_gen.3 : Str = CallByName Inspect.31 #Derived_gen.4 #Derived.3; ret #Derived_gen.3; @@ -17,10 +17,10 @@ procedure #Derived.4 (#Derived.5): procedure #Derived.6 (#Derived.7, #Derived.5): let #Derived_gen.17 : Str = "b"; - let #Derived_gen.18 : Str = CallByName Inspect.44 #Derived.5; + let #Derived_gen.18 : Str = CallByName Inspect.43 #Derived.5; let #Derived_gen.16 : {Str, Str} = Struct {#Derived_gen.17, #Derived_gen.18}; let #Derived_gen.15 : List {Str, Str} = Array [#Derived_gen.16]; - let #Derived_gen.14 : List {Str, Str} = CallByName Inspect.42 #Derived_gen.15; + let #Derived_gen.14 : List {Str, Str} = CallByName Inspect.41 #Derived_gen.15; let #Derived_gen.13 : Str = CallByName Inspect.31 #Derived_gen.14 #Derived.7; ret #Derived_gen.13; @@ -32,173 +32,173 @@ procedure Bool.2 (): let Bool.25 : Int1 = true; ret Bool.25; -procedure Inspect.230 (Inspect.231, Inspect.229): - let Inspect.356 : Str = "{"; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.231 Inspect.356; - let Inspect.328 : {Str, Int1} = CallByName Inspect.232 Inspect.332 Inspect.229; +procedure Inspect.225 (Inspect.226, Inspect.224): + let Inspect.348 : Str = "{"; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.226 Inspect.348; + let Inspect.320 : {Str, Int1} = CallByName Inspect.227 Inspect.324 Inspect.224; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.239 Inspect.320; + let Inspect.317 : Str = "}"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; + +procedure Inspect.225 (Inspect.226, Inspect.224): + let Inspect.388 : Str = "{"; + let Inspect.364 : Str = CallByName Inspect.59 Inspect.226 Inspect.388; + let Inspect.360 : {Str, Int1} = CallByName Inspect.227 Inspect.364 Inspect.224; + let Inspect.361 : {} = Struct {}; + let Inspect.356 : Str = CallByName Inspect.239 Inspect.360; + let Inspect.357 : Str = "}"; + let Inspect.355 : Str = CallByName Inspect.59 Inspect.356 Inspect.357; + ret Inspect.355; + +procedure Inspect.227 (Inspect.228, Inspect.224): + let Inspect.347 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.228, Inspect.347}; let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.244 Inspect.328; - let Inspect.325 : Str = "}"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; - -procedure Inspect.230 (Inspect.231, Inspect.229): - let Inspect.396 : Str = "{"; - let Inspect.372 : Str = CallByName Inspect.61 Inspect.231 Inspect.396; - let Inspect.368 : {Str, Int1} = CallByName Inspect.232 Inspect.372 Inspect.229; - let Inspect.369 : {} = Struct {}; - let Inspect.364 : Str = CallByName Inspect.244 Inspect.368; - let Inspect.365 : Str = "}"; - let Inspect.363 : Str = CallByName Inspect.61 Inspect.364 Inspect.365; - ret Inspect.363; + let Inspect.327 : {Str, Int1} = CallByName List.18 Inspect.224 Inspect.328 Inspect.329; + ret Inspect.327; -procedure Inspect.232 (Inspect.233, Inspect.229): - let Inspect.355 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.233, Inspect.355}; - let Inspect.337 : {} = Struct {}; - let Inspect.335 : {Str, Int1} = CallByName List.18 Inspect.229 Inspect.336 Inspect.337; - ret Inspect.335; - -procedure Inspect.232 (Inspect.233, Inspect.229): - let Inspect.395 : Int1 = CallByName Bool.1; - let Inspect.376 : {Str, Int1} = Struct {Inspect.233, Inspect.395}; - let Inspect.377 : {} = Struct {}; - let Inspect.375 : {Str, Int1} = CallByName List.18 Inspect.229 Inspect.376 Inspect.377; - ret Inspect.375; +procedure Inspect.227 (Inspect.228, Inspect.224): + let Inspect.387 : Int1 = CallByName Bool.1; + let Inspect.368 : {Str, Int1} = Struct {Inspect.228, Inspect.387}; + let Inspect.369 : {} = Struct {}; + let Inspect.367 : {Str, Int1} = CallByName List.18 Inspect.224 Inspect.368 Inspect.369; + ret Inspect.367; -procedure Inspect.234 (Inspect.338, Inspect.339): - let Inspect.237 : Str = StructAtIndex 0 Inspect.339; - let Inspect.238 : Str = StructAtIndex 1 Inspect.339; - let Inspect.235 : Str = StructAtIndex 0 Inspect.338; - let Inspect.236 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.353 Inspect.239: - let Inspect.350 : Str = CallByName Inspect.61 Inspect.239 Inspect.237; - let Inspect.351 : Str = ": "; - let Inspect.345 : Str = CallByName Inspect.61 Inspect.350 Inspect.351; - let Inspect.341 : Str = CallByName Inspect.240 Inspect.345 Inspect.238; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.242 Inspect.341; - ret Inspect.340; +procedure Inspect.229 (Inspect.330, Inspect.331): + let Inspect.232 : Str = StructAtIndex 0 Inspect.331; + let Inspect.233 : Str = StructAtIndex 1 Inspect.331; + let Inspect.230 : Str = StructAtIndex 0 Inspect.330; + let Inspect.231 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.345 Inspect.234: + let Inspect.342 : Str = CallByName Inspect.59 Inspect.234 Inspect.232; + let Inspect.343 : Str = ": "; + let Inspect.337 : Str = CallByName Inspect.59 Inspect.342 Inspect.343; + let Inspect.333 : Str = CallByName Inspect.235 Inspect.337 Inspect.233; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.237 Inspect.333; + ret Inspect.332; in - if Inspect.236 then - let Inspect.354 : Str = ", "; - let Inspect.352 : Str = CallByName Inspect.61 Inspect.235 Inspect.354; - jump Inspect.353 Inspect.352; + if Inspect.231 then + let Inspect.346 : Str = ", "; + let Inspect.344 : Str = CallByName Inspect.59 Inspect.230 Inspect.346; + jump Inspect.345 Inspect.344; else - jump Inspect.353 Inspect.235; - -procedure Inspect.234 (Inspect.338, Inspect.339): - let Inspect.237 : Str = StructAtIndex 0 Inspect.339; - let Inspect.238 : Str = StructAtIndex 1 Inspect.339; - let Inspect.235 : Str = StructAtIndex 0 Inspect.338; - let Inspect.236 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.393 Inspect.239: - let Inspect.390 : Str = CallByName Inspect.61 Inspect.239 Inspect.237; - let Inspect.391 : Str = ": "; - let Inspect.385 : Str = CallByName Inspect.61 Inspect.390 Inspect.391; - let Inspect.381 : Str = CallByName Inspect.240 Inspect.385 Inspect.238; - let Inspect.382 : {} = Struct {}; - let Inspect.380 : {Str, Int1} = CallByName Inspect.242 Inspect.381; - ret Inspect.380; + jump Inspect.345 Inspect.230; + +procedure Inspect.229 (Inspect.330, Inspect.331): + let Inspect.232 : Str = StructAtIndex 0 Inspect.331; + let Inspect.233 : Str = StructAtIndex 1 Inspect.331; + let Inspect.230 : Str = StructAtIndex 0 Inspect.330; + let Inspect.231 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.385 Inspect.234: + let Inspect.382 : Str = CallByName Inspect.59 Inspect.234 Inspect.232; + let Inspect.383 : Str = ": "; + let Inspect.377 : Str = CallByName Inspect.59 Inspect.382 Inspect.383; + let Inspect.373 : Str = CallByName Inspect.235 Inspect.377 Inspect.233; + let Inspect.374 : {} = Struct {}; + let Inspect.372 : {Str, Int1} = CallByName Inspect.237 Inspect.373; + ret Inspect.372; in - if Inspect.236 then - let Inspect.394 : Str = ", "; - let Inspect.392 : Str = CallByName Inspect.61 Inspect.235 Inspect.394; - jump Inspect.393 Inspect.392; + if Inspect.231 then + let Inspect.386 : Str = ", "; + let Inspect.384 : Str = CallByName Inspect.59 Inspect.230 Inspect.386; + jump Inspect.385 Inspect.384; else - jump Inspect.393 Inspect.235; + jump Inspect.385 Inspect.230; -procedure Inspect.240 (Inspect.241, Inspect.238): - let Inspect.348 : Str = CallByName Inspect.31 Inspect.238 Inspect.241; - ret Inspect.348; +procedure Inspect.235 (Inspect.236, Inspect.233): + let Inspect.340 : Str = CallByName Inspect.31 Inspect.233 Inspect.236; + ret Inspect.340; -procedure Inspect.240 (Inspect.241, Inspect.238): - let Inspect.388 : Str = CallByName Inspect.31 Inspect.238 Inspect.241; - ret Inspect.388; +procedure Inspect.235 (Inspect.236, Inspect.233): + let Inspect.380 : Str = CallByName Inspect.31 Inspect.233 Inspect.236; + ret Inspect.380; -procedure Inspect.242 (Inspect.243): - let Inspect.384 : Int1 = CallByName Bool.2; - let Inspect.383 : {Str, Int1} = Struct {Inspect.243, Inspect.384}; - ret Inspect.383; +procedure Inspect.237 (Inspect.238): + let Inspect.376 : Int1 = CallByName Bool.2; + let Inspect.375 : {Str, Int1} = Struct {Inspect.238, Inspect.376}; + ret Inspect.375; -procedure Inspect.244 (Inspect.330): - let Inspect.371 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.371; +procedure Inspect.239 (Inspect.322): + let Inspect.363 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.363; -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.405 : Str = "\""; - let Inspect.404 : Str = CallByName Inspect.61 Inspect.252 Inspect.405; - let Inspect.402 : Str = CallByName Inspect.61 Inspect.404 Inspect.250; - let Inspect.403 : Str = "\""; - let Inspect.401 : Str = CallByName Inspect.61 Inspect.402 Inspect.403; - ret Inspect.401; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.397 : Str = "\""; + let Inspect.396 : Str = CallByName Inspect.59 Inspect.247 Inspect.397; + let Inspect.394 : Str = CallByName Inspect.59 Inspect.396 Inspect.245; + let Inspect.395 : Str = "\""; + let Inspect.393 : Str = CallByName Inspect.59 Inspect.394 Inspect.395; + ret Inspect.393; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.230 Inspect.150 Inspect.307; - ret Inspect.318; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.225 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.349 : Str = CallByName #Derived.6 Inspect.150 Inspect.307; - ret Inspect.349; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.341 : Str = CallByName #Derived.6 Inspect.145 Inspect.299; + ret Inspect.341; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.358 : Str = CallByName Inspect.230 Inspect.150 Inspect.307; - ret Inspect.358; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.350 : Str = CallByName Inspect.225 Inspect.145 Inspect.299; + ret Inspect.350; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.389 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.389; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.381 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.381; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.42 (Inspect.229): - let Inspect.319 : List {Str, Str} = CallByName Inspect.30 Inspect.229; - ret Inspect.319; +procedure Inspect.41 (Inspect.224): + let Inspect.311 : List {Str, Str} = CallByName Inspect.30 Inspect.224; + ret Inspect.311; -procedure Inspect.42 (Inspect.229): - let Inspect.359 : List {Str, Str} = CallByName Inspect.30 Inspect.229; - ret Inspect.359; +procedure Inspect.41 (Inspect.224): + let Inspect.351 : List {Str, Str} = CallByName Inspect.30 Inspect.224; + ret Inspect.351; -procedure Inspect.44 (Inspect.250): - let Inspect.397 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.397; +procedure Inspect.43 (Inspect.245): + let Inspect.389 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.389; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.2 Inspect.312 Inspect.316; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.2 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.367 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.367; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.359 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.359; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.18 (List.158, List.159, List.160): let List.572 : U64 = 0i64; @@ -234,7 +234,7 @@ procedure List.90 (#Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_g if List.588 then let List.592 : {Str, Str} = CallByName List.66 List.161 List.164; inc List.592; - let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.592; + let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.592; let List.591 : U64 = 1i64; let List.590 : U64 = CallByName Num.51 List.164 List.591; jump List.586 List.161 List.166 List.163 List.590 List.165; @@ -250,7 +250,7 @@ procedure List.90 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_g if List.576 then let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580; + let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -261,18 +261,18 @@ procedure List.90 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_g jump List.574 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41; procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.51 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.259; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.0 (): let Test.4 : Str = "bar"; - let Test.1 : Str = CallByName Inspect.34 Test.4; + let Test.1 : Str = CallByName Inspect.33 Test.4; ret Test.1; diff --git a/crates/compiler/test_mono/generated/inspect_derived_record.txt b/crates/compiler/test_mono/generated/inspect_derived_record.txt index 074192a8d65..2583c53a36c 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record.txt @@ -4,15 +4,15 @@ procedure #Derived.0 (#Derived.1): procedure #Derived.2 (#Derived.3, #Derived.1): let #Derived_gen.13 : I64 = StructAtIndex 1 #Derived.1; - let #Derived_gen.11 : [C I64, C Decimal] = CallByName Inspect.54 #Derived_gen.13; + let #Derived_gen.11 : [C I64, C Decimal] = CallByName Inspect.53 #Derived_gen.13; let #Derived_gen.12 : Str = "a"; let #Derived_gen.6 : {[C I64, C Decimal], Str} = Struct {#Derived_gen.11, #Derived_gen.12}; let #Derived_gen.10 : Decimal = StructAtIndex 0 #Derived.1; - let #Derived_gen.8 : [C I64, C Decimal] = CallByName Inspect.60 #Derived_gen.10; + let #Derived_gen.8 : [C I64, C Decimal] = CallByName Inspect.58 #Derived_gen.10; let #Derived_gen.9 : Str = "b"; let #Derived_gen.7 : {[C I64, C Decimal], Str} = Struct {#Derived_gen.8, #Derived_gen.9}; let #Derived_gen.5 : List {[C I64, C Decimal], Str} = Array [#Derived_gen.6, #Derived_gen.7]; - let #Derived_gen.4 : List {[C I64, C Decimal], Str} = CallByName Inspect.42 #Derived_gen.5; + let #Derived_gen.4 : List {[C I64, C Decimal], Str} = CallByName Inspect.41 #Derived_gen.5; let #Derived_gen.3 : Str = CallByName Inspect.31 #Derived_gen.4 #Derived.3; ret #Derived_gen.3; @@ -24,131 +24,131 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Inspect.230 (Inspect.231, Inspect.229): - let Inspect.357 : Str = "{"; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.231 Inspect.357; - let Inspect.328 : {Str, Int1} = CallByName Inspect.232 Inspect.332 Inspect.229; - let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.244 Inspect.328; - let Inspect.325 : Str = "}"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; +procedure Inspect.225 (Inspect.226, Inspect.224): + let Inspect.349 : Str = "{"; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.226 Inspect.349; + let Inspect.320 : {Str, Int1} = CallByName Inspect.227 Inspect.324 Inspect.224; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.239 Inspect.320; + let Inspect.317 : Str = "}"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; -procedure Inspect.232 (Inspect.233, Inspect.229): - let Inspect.356 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.233, Inspect.356}; - let Inspect.337 : {} = Struct {}; - let Inspect.335 : {Str, Int1} = CallByName List.18 Inspect.229 Inspect.336 Inspect.337; - ret Inspect.335; +procedure Inspect.227 (Inspect.228, Inspect.224): + let Inspect.348 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.228, Inspect.348}; + let Inspect.329 : {} = Struct {}; + let Inspect.327 : {Str, Int1} = CallByName List.18 Inspect.224 Inspect.328 Inspect.329; + ret Inspect.327; -procedure Inspect.234 (Inspect.338, Inspect.339): - let Inspect.238 : [C I64, C Decimal] = StructAtIndex 0 Inspect.339; - let Inspect.237 : Str = StructAtIndex 1 Inspect.339; - let Inspect.235 : Str = StructAtIndex 0 Inspect.338; - let Inspect.236 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.354 Inspect.239: - let Inspect.351 : Str = CallByName Inspect.61 Inspect.239 Inspect.237; - let Inspect.352 : Str = ": "; - let Inspect.345 : Str = CallByName Inspect.61 Inspect.351 Inspect.352; - let Inspect.341 : Str = CallByName Inspect.240 Inspect.345 Inspect.238; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.242 Inspect.341; - ret Inspect.340; +procedure Inspect.229 (Inspect.330, Inspect.331): + let Inspect.233 : [C I64, C Decimal] = StructAtIndex 0 Inspect.331; + let Inspect.232 : Str = StructAtIndex 1 Inspect.331; + let Inspect.230 : Str = StructAtIndex 0 Inspect.330; + let Inspect.231 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.346 Inspect.234: + let Inspect.343 : Str = CallByName Inspect.59 Inspect.234 Inspect.232; + let Inspect.344 : Str = ": "; + let Inspect.337 : Str = CallByName Inspect.59 Inspect.343 Inspect.344; + let Inspect.333 : Str = CallByName Inspect.235 Inspect.337 Inspect.233; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.237 Inspect.333; + ret Inspect.332; in - if Inspect.236 then - let Inspect.355 : Str = ", "; - let Inspect.353 : Str = CallByName Inspect.61 Inspect.235 Inspect.355; - jump Inspect.354 Inspect.353; + if Inspect.231 then + let Inspect.347 : Str = ", "; + let Inspect.345 : Str = CallByName Inspect.59 Inspect.230 Inspect.347; + jump Inspect.346 Inspect.345; else - jump Inspect.354 Inspect.235; + jump Inspect.346 Inspect.230; -procedure Inspect.240 (Inspect.241, Inspect.238): - let Inspect.348 : Str = CallByName Inspect.31 Inspect.238 Inspect.241; - ret Inspect.348; +procedure Inspect.235 (Inspect.236, Inspect.233): + let Inspect.340 : Str = CallByName Inspect.31 Inspect.233 Inspect.236; + ret Inspect.340; -procedure Inspect.242 (Inspect.243): - let Inspect.344 : Int1 = CallByName Bool.2; - let Inspect.343 : {Str, Int1} = Struct {Inspect.243, Inspect.344}; - ret Inspect.343; +procedure Inspect.237 (Inspect.238): + let Inspect.336 : Int1 = CallByName Bool.2; + let Inspect.335 : {Str, Int1} = Struct {Inspect.238, Inspect.336}; + ret Inspect.335; -procedure Inspect.244 (Inspect.330): - let Inspect.331 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.331; +procedure Inspect.239 (Inspect.322): + let Inspect.323 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.323; -procedure Inspect.279 (Inspect.280, #Attr.12): - let Inspect.370 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let Inspect.369 : Str = CallByName Num.96 Inspect.370; - let Inspect.368 : Str = CallByName Inspect.61 Inspect.280 Inspect.369; - ret Inspect.368; +procedure Inspect.274 (Inspect.275, #Attr.12): + let Inspect.362 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12; + let Inspect.361 : Str = CallByName Num.96 Inspect.362; + let Inspect.360 : Str = CallByName Inspect.59 Inspect.275 Inspect.361; + ret Inspect.360; -procedure Inspect.297 (Inspect.298, #Attr.12): - let Inspect.364 : Decimal = UnionAtIndex (Id 1) (Index 0) #Attr.12; - let Inspect.363 : Str = CallByName Num.96 Inspect.364; - let Inspect.362 : Str = CallByName Inspect.61 Inspect.298 Inspect.363; - ret Inspect.362; +procedure Inspect.289 (Inspect.290, #Attr.12): + let Inspect.356 : Decimal = UnionAtIndex (Id 1) (Index 0) #Attr.12; + let Inspect.355 : Str = CallByName Num.96 Inspect.356; + let Inspect.354 : Str = CallByName Inspect.59 Inspect.290 Inspect.355; + ret Inspect.354; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.230 Inspect.150 Inspect.307; - ret Inspect.318; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.225 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.350 : U8 = GetTagId Inspect.307; - switch Inspect.350: +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.342 : U8 = GetTagId Inspect.299; + switch Inspect.342: case 0: - let Inspect.349 : Str = CallByName Inspect.279 Inspect.150 Inspect.307; - ret Inspect.349; + let Inspect.341 : Str = CallByName Inspect.274 Inspect.145 Inspect.299; + ret Inspect.341; default: - let Inspect.349 : Str = CallByName Inspect.297 Inspect.150 Inspect.307; - ret Inspect.349; + let Inspect.341 : Str = CallByName Inspect.289 Inspect.145 Inspect.299; + ret Inspect.341; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.42 (Inspect.229): - let Inspect.319 : List {[C I64, C Decimal], Str} = CallByName Inspect.30 Inspect.229; - ret Inspect.319; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {Decimal, I64} = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.2 Inspect.312 Inspect.316; +procedure Inspect.41 (Inspect.224): + let Inspect.311 : List {[C I64, C Decimal], Str} = CallByName Inspect.30 Inspect.224; ret Inspect.311; -procedure Inspect.54 (Inspect.278): - let Inspect.366 : [C I64, C Decimal] = TagId(0) Inspect.278; - let Inspect.365 : [C I64, C Decimal] = CallByName Inspect.30 Inspect.366; - ret Inspect.365; - -procedure Inspect.60 (Inspect.296): - let Inspect.359 : [C I64, C Decimal] = TagId(1) Inspect.296; - let Inspect.358 : [C I64, C Decimal] = CallByName Inspect.30 Inspect.359; - ret Inspect.358; - -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.327 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.327; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {Decimal, I64} = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.2 Inspect.304 Inspect.308; + ret Inspect.303; + +procedure Inspect.53 (Inspect.273): + let Inspect.358 : [C I64, C Decimal] = TagId(0) Inspect.273; + let Inspect.357 : [C I64, C Decimal] = CallByName Inspect.30 Inspect.358; + ret Inspect.357; + +procedure Inspect.58 (Inspect.288): + let Inspect.351 : [C I64, C Decimal] = TagId(1) Inspect.288; + let Inspect.350 : [C I64, C Decimal] = CallByName Inspect.30 Inspect.351; + ret Inspect.350; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.319 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.319; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.18 (List.158, List.159, List.160): let List.572 : U64 = 0i64; @@ -164,13 +164,13 @@ procedure List.66 (#Attr.2, #Attr.3): let List.581 : {[C I64, C Decimal], Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.581; -procedure List.90 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): +procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): joinpoint List.574 List.161 List.162 List.163 List.164 List.165: let List.576 : Int1 = CallByName Num.22 List.164 List.165; if List.576 then let List.580 : {[C I64, C Decimal], Str} = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580; + let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -178,31 +178,31 @@ procedure List.90 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_g dec List.161; ret List.162; in - jump List.574 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; + jump List.574 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.51 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.259; procedure Num.96 (#Attr.2): - let Num.297 : Str = lowlevel NumToStr #Attr.2; - ret Num.297; + let Num.257 : Str = lowlevel NumToStr #Attr.2; + ret Num.257; procedure Num.96 (#Attr.2): - let Num.298 : Str = lowlevel NumToStr #Attr.2; - ret Num.298; + let Num.258 : Str = lowlevel NumToStr #Attr.2; + ret Num.258; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.3 : Decimal = 3dec; let Test.4 : I64 = 7i64; let Test.2 : {Decimal, I64} = Struct {Test.3, Test.4}; - let Test.1 : Str = CallByName Inspect.34 Test.2; + let Test.1 : Str = CallByName Inspect.33 Test.2; ret Test.1; 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 6e53681ac7b..0e04de78869 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 @@ -4,10 +4,10 @@ procedure #Derived.0 (#Derived.1): procedure #Derived.2 (#Derived.3, #Derived.1): let #Derived_gen.7 : Str = "a"; - let #Derived_gen.8 : Str = CallByName Inspect.44 #Derived.1; + let #Derived_gen.8 : Str = CallByName Inspect.43 #Derived.1; let #Derived_gen.6 : {Str, Str} = Struct {#Derived_gen.7, #Derived_gen.8}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6]; - let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.42 #Derived_gen.5; + let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.41 #Derived_gen.5; let #Derived_gen.3 : Str = CallByName Inspect.31 #Derived_gen.4 #Derived.3; ret #Derived_gen.3; @@ -19,113 +19,113 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Inspect.230 (Inspect.231, Inspect.229): - let Inspect.356 : Str = "{"; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.231 Inspect.356; - let Inspect.328 : {Str, Int1} = CallByName Inspect.232 Inspect.332 Inspect.229; - let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.244 Inspect.328; - let Inspect.325 : Str = "}"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; +procedure Inspect.225 (Inspect.226, Inspect.224): + let Inspect.348 : Str = "{"; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.226 Inspect.348; + let Inspect.320 : {Str, Int1} = CallByName Inspect.227 Inspect.324 Inspect.224; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.239 Inspect.320; + let Inspect.317 : Str = "}"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; -procedure Inspect.232 (Inspect.233, Inspect.229): - let Inspect.355 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.233, Inspect.355}; - let Inspect.337 : {} = Struct {}; - let Inspect.335 : {Str, Int1} = CallByName List.18 Inspect.229 Inspect.336 Inspect.337; - ret Inspect.335; +procedure Inspect.227 (Inspect.228, Inspect.224): + let Inspect.347 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.228, Inspect.347}; + let Inspect.329 : {} = Struct {}; + let Inspect.327 : {Str, Int1} = CallByName List.18 Inspect.224 Inspect.328 Inspect.329; + ret Inspect.327; -procedure Inspect.234 (Inspect.338, Inspect.339): - let Inspect.237 : Str = StructAtIndex 0 Inspect.339; - let Inspect.238 : Str = StructAtIndex 1 Inspect.339; - let Inspect.235 : Str = StructAtIndex 0 Inspect.338; - let Inspect.236 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.353 Inspect.239: - let Inspect.350 : Str = CallByName Inspect.61 Inspect.239 Inspect.237; - let Inspect.351 : Str = ": "; - let Inspect.345 : Str = CallByName Inspect.61 Inspect.350 Inspect.351; - let Inspect.341 : Str = CallByName Inspect.240 Inspect.345 Inspect.238; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.242 Inspect.341; - ret Inspect.340; +procedure Inspect.229 (Inspect.330, Inspect.331): + let Inspect.232 : Str = StructAtIndex 0 Inspect.331; + let Inspect.233 : Str = StructAtIndex 1 Inspect.331; + let Inspect.230 : Str = StructAtIndex 0 Inspect.330; + let Inspect.231 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.345 Inspect.234: + let Inspect.342 : Str = CallByName Inspect.59 Inspect.234 Inspect.232; + let Inspect.343 : Str = ": "; + let Inspect.337 : Str = CallByName Inspect.59 Inspect.342 Inspect.343; + let Inspect.333 : Str = CallByName Inspect.235 Inspect.337 Inspect.233; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.237 Inspect.333; + ret Inspect.332; in - if Inspect.236 then - let Inspect.354 : Str = ", "; - let Inspect.352 : Str = CallByName Inspect.61 Inspect.235 Inspect.354; - jump Inspect.353 Inspect.352; + if Inspect.231 then + let Inspect.346 : Str = ", "; + let Inspect.344 : Str = CallByName Inspect.59 Inspect.230 Inspect.346; + jump Inspect.345 Inspect.344; else - jump Inspect.353 Inspect.235; + jump Inspect.345 Inspect.230; -procedure Inspect.240 (Inspect.241, Inspect.238): - let Inspect.348 : Str = CallByName Inspect.31 Inspect.238 Inspect.241; - ret Inspect.348; +procedure Inspect.235 (Inspect.236, Inspect.233): + let Inspect.340 : Str = CallByName Inspect.31 Inspect.233 Inspect.236; + ret Inspect.340; -procedure Inspect.242 (Inspect.243): - let Inspect.344 : Int1 = CallByName Bool.2; - let Inspect.343 : {Str, Int1} = Struct {Inspect.243, Inspect.344}; - ret Inspect.343; +procedure Inspect.237 (Inspect.238): + let Inspect.336 : Int1 = CallByName Bool.2; + let Inspect.335 : {Str, Int1} = Struct {Inspect.238, Inspect.336}; + ret Inspect.335; -procedure Inspect.244 (Inspect.330): - let Inspect.331 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.331; +procedure Inspect.239 (Inspect.322): + let Inspect.323 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.323; -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.365 : Str = "\""; - let Inspect.364 : Str = CallByName Inspect.61 Inspect.252 Inspect.365; - let Inspect.362 : Str = CallByName Inspect.61 Inspect.364 Inspect.250; - let Inspect.363 : Str = "\""; - let Inspect.361 : Str = CallByName Inspect.61 Inspect.362 Inspect.363; - ret Inspect.361; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.357 : Str = "\""; + let Inspect.356 : Str = CallByName Inspect.59 Inspect.247 Inspect.357; + let Inspect.354 : Str = CallByName Inspect.59 Inspect.356 Inspect.245; + let Inspect.355 : Str = "\""; + let Inspect.353 : Str = CallByName Inspect.59 Inspect.354 Inspect.355; + ret Inspect.353; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.230 Inspect.150 Inspect.307; - ret Inspect.318; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.225 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.349 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.349; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.341 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.341; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.42 (Inspect.229): - let Inspect.319 : List {Str, Str} = CallByName Inspect.30 Inspect.229; - ret Inspect.319; +procedure Inspect.41 (Inspect.224): + let Inspect.311 : List {Str, Str} = CallByName Inspect.30 Inspect.224; + ret Inspect.311; -procedure Inspect.44 (Inspect.250): - let Inspect.357 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.357; +procedure Inspect.43 (Inspect.245): + let Inspect.349 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.349; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.2 Inspect.312 Inspect.316; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.2 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.327 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.327; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.319 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.319; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.18 (List.158, List.159, List.160): let List.572 : U64 = 0i64; @@ -147,7 +147,7 @@ procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_g if List.576 then let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580; + let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -158,18 +158,18 @@ procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_g jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.3 : Str = "foo"; - let Test.1 : Str = CallByName Inspect.34 Test.3; + let Test.1 : Str = CallByName Inspect.33 Test.3; ret Test.1; 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 42f558ab11e..07586c6304b 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 @@ -6,15 +6,15 @@ procedure #Derived.2 (#Derived.3, #Derived.1): let #Derived_gen.11 : Str = "a"; let #Derived_gen.13 : Str = StructAtIndex 0 #Derived.1; inc #Derived_gen.13; - let #Derived_gen.12 : Str = CallByName Inspect.44 #Derived_gen.13; + let #Derived_gen.12 : Str = CallByName Inspect.43 #Derived_gen.13; let #Derived_gen.6 : {Str, Str} = Struct {#Derived_gen.11, #Derived_gen.12}; let #Derived_gen.8 : Str = "b"; let #Derived_gen.10 : Str = StructAtIndex 1 #Derived.1; dec #Derived_gen.13; - let #Derived_gen.9 : Str = CallByName Inspect.44 #Derived_gen.10; + let #Derived_gen.9 : Str = CallByName Inspect.43 #Derived_gen.10; let #Derived_gen.7 : {Str, Str} = Struct {#Derived_gen.8, #Derived_gen.9}; let #Derived_gen.5 : List {Str, Str} = Array [#Derived_gen.6, #Derived_gen.7]; - let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.42 #Derived_gen.5; + let #Derived_gen.4 : List {Str, Str} = CallByName Inspect.41 #Derived_gen.5; let #Derived_gen.3 : Str = CallByName Inspect.31 #Derived_gen.4 #Derived.3; ret #Derived_gen.3; @@ -26,113 +26,113 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure Inspect.230 (Inspect.231, Inspect.229): - let Inspect.356 : Str = "{"; - let Inspect.332 : Str = CallByName Inspect.61 Inspect.231 Inspect.356; - let Inspect.328 : {Str, Int1} = CallByName Inspect.232 Inspect.332 Inspect.229; - let Inspect.329 : {} = Struct {}; - let Inspect.324 : Str = CallByName Inspect.244 Inspect.328; - let Inspect.325 : Str = "}"; - let Inspect.323 : Str = CallByName Inspect.61 Inspect.324 Inspect.325; - ret Inspect.323; +procedure Inspect.225 (Inspect.226, Inspect.224): + let Inspect.348 : Str = "{"; + let Inspect.324 : Str = CallByName Inspect.59 Inspect.226 Inspect.348; + let Inspect.320 : {Str, Int1} = CallByName Inspect.227 Inspect.324 Inspect.224; + let Inspect.321 : {} = Struct {}; + let Inspect.316 : Str = CallByName Inspect.239 Inspect.320; + let Inspect.317 : Str = "}"; + let Inspect.315 : Str = CallByName Inspect.59 Inspect.316 Inspect.317; + ret Inspect.315; -procedure Inspect.232 (Inspect.233, Inspect.229): - let Inspect.355 : Int1 = CallByName Bool.1; - let Inspect.336 : {Str, Int1} = Struct {Inspect.233, Inspect.355}; - let Inspect.337 : {} = Struct {}; - let Inspect.335 : {Str, Int1} = CallByName List.18 Inspect.229 Inspect.336 Inspect.337; - ret Inspect.335; +procedure Inspect.227 (Inspect.228, Inspect.224): + let Inspect.347 : Int1 = CallByName Bool.1; + let Inspect.328 : {Str, Int1} = Struct {Inspect.228, Inspect.347}; + let Inspect.329 : {} = Struct {}; + let Inspect.327 : {Str, Int1} = CallByName List.18 Inspect.224 Inspect.328 Inspect.329; + ret Inspect.327; -procedure Inspect.234 (Inspect.338, Inspect.339): - let Inspect.237 : Str = StructAtIndex 0 Inspect.339; - let Inspect.238 : Str = StructAtIndex 1 Inspect.339; - let Inspect.235 : Str = StructAtIndex 0 Inspect.338; - let Inspect.236 : Int1 = StructAtIndex 1 Inspect.338; - joinpoint Inspect.353 Inspect.239: - let Inspect.350 : Str = CallByName Inspect.61 Inspect.239 Inspect.237; - let Inspect.351 : Str = ": "; - let Inspect.345 : Str = CallByName Inspect.61 Inspect.350 Inspect.351; - let Inspect.341 : Str = CallByName Inspect.240 Inspect.345 Inspect.238; - let Inspect.342 : {} = Struct {}; - let Inspect.340 : {Str, Int1} = CallByName Inspect.242 Inspect.341; - ret Inspect.340; +procedure Inspect.229 (Inspect.330, Inspect.331): + let Inspect.232 : Str = StructAtIndex 0 Inspect.331; + let Inspect.233 : Str = StructAtIndex 1 Inspect.331; + let Inspect.230 : Str = StructAtIndex 0 Inspect.330; + let Inspect.231 : Int1 = StructAtIndex 1 Inspect.330; + joinpoint Inspect.345 Inspect.234: + let Inspect.342 : Str = CallByName Inspect.59 Inspect.234 Inspect.232; + let Inspect.343 : Str = ": "; + let Inspect.337 : Str = CallByName Inspect.59 Inspect.342 Inspect.343; + let Inspect.333 : Str = CallByName Inspect.235 Inspect.337 Inspect.233; + let Inspect.334 : {} = Struct {}; + let Inspect.332 : {Str, Int1} = CallByName Inspect.237 Inspect.333; + ret Inspect.332; in - if Inspect.236 then - let Inspect.354 : Str = ", "; - let Inspect.352 : Str = CallByName Inspect.61 Inspect.235 Inspect.354; - jump Inspect.353 Inspect.352; + if Inspect.231 then + let Inspect.346 : Str = ", "; + let Inspect.344 : Str = CallByName Inspect.59 Inspect.230 Inspect.346; + jump Inspect.345 Inspect.344; else - jump Inspect.353 Inspect.235; + jump Inspect.345 Inspect.230; -procedure Inspect.240 (Inspect.241, Inspect.238): - let Inspect.348 : Str = CallByName Inspect.31 Inspect.238 Inspect.241; - ret Inspect.348; +procedure Inspect.235 (Inspect.236, Inspect.233): + let Inspect.340 : Str = CallByName Inspect.31 Inspect.233 Inspect.236; + ret Inspect.340; -procedure Inspect.242 (Inspect.243): - let Inspect.344 : Int1 = CallByName Bool.2; - let Inspect.343 : {Str, Int1} = Struct {Inspect.243, Inspect.344}; - ret Inspect.343; +procedure Inspect.237 (Inspect.238): + let Inspect.336 : Int1 = CallByName Bool.2; + let Inspect.335 : {Str, Int1} = Struct {Inspect.238, Inspect.336}; + ret Inspect.335; -procedure Inspect.244 (Inspect.330): - let Inspect.331 : Str = StructAtIndex 0 Inspect.330; - ret Inspect.331; +procedure Inspect.239 (Inspect.322): + let Inspect.323 : Str = StructAtIndex 0 Inspect.322; + ret Inspect.323; -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.365 : Str = "\""; - let Inspect.364 : Str = CallByName Inspect.61 Inspect.252 Inspect.365; - let Inspect.362 : Str = CallByName Inspect.61 Inspect.364 Inspect.250; - let Inspect.363 : Str = "\""; - let Inspect.361 : Str = CallByName Inspect.61 Inspect.362 Inspect.363; - ret Inspect.361; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.357 : Str = "\""; + let Inspect.356 : Str = CallByName Inspect.59 Inspect.247 Inspect.357; + let Inspect.354 : Str = CallByName Inspect.59 Inspect.356 Inspect.245; + let Inspect.355 : Str = "\""; + let Inspect.353 : Str = CallByName Inspect.59 Inspect.354 Inspect.355; + ret Inspect.353; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.318 : Str = CallByName Inspect.230 Inspect.150 Inspect.307; - ret Inspect.318; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.310 : Str = CallByName Inspect.225 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.349 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.349; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.341 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.341; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.42 (Inspect.229): - let Inspect.319 : List {Str, Str} = CallByName Inspect.30 Inspect.229; - ret Inspect.319; +procedure Inspect.41 (Inspect.224): + let Inspect.311 : List {Str, Str} = CallByName Inspect.30 Inspect.224; + ret Inspect.311; -procedure Inspect.44 (Inspect.250): - let Inspect.366 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.366; +procedure Inspect.43 (Inspect.245): + let Inspect.358 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.358; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {Str, Str} = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.2 Inspect.312 Inspect.316; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {Str, Str} = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.2 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.327 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.327; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.319 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.319; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.18 (List.158, List.159, List.160): let List.572 : U64 = 0i64; @@ -154,7 +154,7 @@ procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_g if List.576 then let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.234 List.162 List.580; + let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -165,20 +165,20 @@ procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_g jump List.574 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.3 : Str = "foo"; let Test.4 : Str = "bar"; let Test.2 : {Str, Str} = Struct {Test.3, Test.4}; - let Test.1 : Str = CallByName Inspect.34 Test.2; + let Test.1 : Str = CallByName Inspect.33 Test.2; ret Test.1; diff --git a/crates/compiler/test_mono/generated/inspect_derived_string.txt b/crates/compiler/test_mono/generated/inspect_derived_string.txt index 09bdedf7bed..a6a9be5e04f 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_string.txt @@ -1,47 +1,47 @@ -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.327 : Str = "\""; - let Inspect.326 : Str = CallByName Inspect.61 Inspect.252 Inspect.327; - let Inspect.322 : Str = CallByName Inspect.61 Inspect.326 Inspect.250; - let Inspect.323 : Str = "\""; - let Inspect.321 : Str = CallByName Inspect.61 Inspect.322 Inspect.323; - ret Inspect.321; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.44 (Inspect.250): - let Inspect.317 : Str = CallByName Inspect.30 Inspect.250; +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.319 : Str = "\""; + let Inspect.318 : Str = CallByName Inspect.59 Inspect.247 Inspect.319; + let Inspect.314 : Str = CallByName Inspect.59 Inspect.318 Inspect.245; + let Inspect.315 : Str = "\""; + let Inspect.313 : Str = CallByName Inspect.59 Inspect.314 Inspect.315; + ret Inspect.313; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.43 (Inspect.245): + let Inspect.309 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.309; + +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName Inspect.43 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Inspect.246 Inspect.304 Inspect.308; + ret Inspect.303; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.317 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; ret Inspect.317; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName Inspect.44 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Inspect.251 Inspect.312 Inspect.316; - ret Inspect.311; - -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.325 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.325; - -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.2 : Str = "abc"; - let Test.1 : Str = CallByName Inspect.34 Test.2; + let Test.1 : Str = CallByName Inspect.33 Test.2; ret Test.1; 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 014e6c7d7ba..25476db8680 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 @@ -8,119 +8,119 @@ procedure #Derived.3 (#Derived.4, #Derived.1): ret #Derived_gen.3; in let #Derived_gen.7 : Str = "A"; - let #Derived_gen.9 : Str = CallByName Inspect.44 #Derived.1; + let #Derived_gen.9 : Str = CallByName Inspect.43 #Derived.1; let #Derived_gen.8 : List Str = Array [#Derived_gen.9]; - let #Derived_gen.6 : [C Str, C Str List Str] = CallByName Inspect.40 #Derived_gen.7 #Derived_gen.8; + let #Derived_gen.6 : [C Str, C Str List Str] = CallByName Inspect.39 #Derived_gen.7 #Derived_gen.8; jump #Derived_gen.5 #Derived_gen.6; procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure Inspect.205 (Inspect.206, #Attr.12): - let Inspect.350 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let Inspect.349 : Str = CallByName Inspect.61 Inspect.206 Inspect.350; - ret Inspect.349; - -procedure Inspect.207 (Inspect.208, #Attr.12): - let Inspect.344 : List Str = UnionAtIndex (Id 1) (Index 1) #Attr.12; - let Inspect.343 : Str = UnionAtIndex (Id 1) (Index 0) #Attr.12; - let Inspect.342 : Str = "("; - let Inspect.341 : Str = CallByName Inspect.61 Inspect.208 Inspect.342; - let Inspect.329 : Str = CallByName Inspect.61 Inspect.341 Inspect.343; - let Inspect.325 : Str = CallByName Inspect.209 Inspect.329 Inspect.344; - let Inspect.326 : Str = ")"; - let Inspect.324 : Str = CallByName Inspect.61 Inspect.325 Inspect.326; +procedure Inspect.200 (Inspect.201, #Attr.12): + let Inspect.342 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12; + let Inspect.341 : Str = CallByName Inspect.59 Inspect.201 Inspect.342; + ret Inspect.341; + +procedure Inspect.202 (Inspect.203, #Attr.12): + let Inspect.336 : List Str = UnionAtIndex (Id 1) (Index 1) #Attr.12; + let Inspect.335 : Str = UnionAtIndex (Id 1) (Index 0) #Attr.12; + let Inspect.334 : Str = "("; + let Inspect.333 : Str = CallByName Inspect.59 Inspect.203 Inspect.334; + let Inspect.321 : Str = CallByName Inspect.59 Inspect.333 Inspect.335; + let Inspect.317 : Str = CallByName Inspect.204 Inspect.321 Inspect.336; + let Inspect.318 : Str = ")"; + let Inspect.316 : Str = CallByName Inspect.59 Inspect.317 Inspect.318; + ret Inspect.316; + +procedure Inspect.204 (Inspect.205, Inspect.199): + let Inspect.325 : {} = Struct {}; + let Inspect.324 : Str = CallByName List.18 Inspect.199 Inspect.205 Inspect.325; ret Inspect.324; -procedure Inspect.209 (Inspect.210, Inspect.204): - let Inspect.333 : {} = Struct {}; - let Inspect.332 : Str = CallByName List.18 Inspect.204 Inspect.210 Inspect.333; - ret Inspect.332; - -procedure Inspect.211 (Inspect.212, Inspect.213): - let Inspect.340 : Str = " "; - let Inspect.335 : Str = CallByName Inspect.61 Inspect.212 Inspect.340; - let Inspect.334 : Str = CallByName Inspect.214 Inspect.335 Inspect.213; - ret Inspect.334; - -procedure Inspect.214 (Inspect.215, Inspect.213): - let Inspect.338 : Str = CallByName Inspect.31 Inspect.213 Inspect.215; - ret Inspect.338; - -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.359 : Str = "\""; - let Inspect.358 : Str = CallByName Inspect.61 Inspect.252 Inspect.359; - let Inspect.356 : Str = CallByName Inspect.61 Inspect.358 Inspect.250; - let Inspect.357 : Str = "\""; - let Inspect.355 : Str = CallByName Inspect.61 Inspect.356 Inspect.357; - ret Inspect.355; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.319 : U8 = GetTagId Inspect.307; - switch Inspect.319: +procedure Inspect.206 (Inspect.207, Inspect.208): + let Inspect.332 : Str = " "; + let Inspect.327 : Str = CallByName Inspect.59 Inspect.207 Inspect.332; + let Inspect.326 : Str = CallByName Inspect.209 Inspect.327 Inspect.208; + ret Inspect.326; + +procedure Inspect.209 (Inspect.210, Inspect.208): + let Inspect.330 : Str = CallByName Inspect.31 Inspect.208 Inspect.210; + ret Inspect.330; + +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.351 : Str = "\""; + let Inspect.350 : Str = CallByName Inspect.59 Inspect.247 Inspect.351; + let Inspect.348 : Str = CallByName Inspect.59 Inspect.350 Inspect.245; + let Inspect.349 : Str = "\""; + let Inspect.347 : Str = CallByName Inspect.59 Inspect.348 Inspect.349; + ret Inspect.347; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.311 : U8 = GetTagId Inspect.299; + switch Inspect.311: case 0: - let Inspect.318 : Str = CallByName Inspect.205 Inspect.150 Inspect.307; - ret Inspect.318; + let Inspect.310 : Str = CallByName Inspect.200 Inspect.145 Inspect.299; + ret Inspect.310; default: - let Inspect.318 : Str = CallByName Inspect.207 Inspect.150 Inspect.307; - ret Inspect.318; + let Inspect.310 : Str = CallByName Inspect.202 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.339 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.339; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.40 (Inspect.203, Inspect.204): - inc Inspect.204; - let Inspect.345 : Int1 = CallByName List.1 Inspect.204; - if Inspect.345 then - dec Inspect.204; - let Inspect.347 : [C Str, C Str List Str] = TagId(0) Inspect.203; - let Inspect.346 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.347; - ret Inspect.346; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.331 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.331; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.39 (Inspect.198, Inspect.199): + inc Inspect.199; + let Inspect.337 : Int1 = CallByName List.1 Inspect.199; + if Inspect.337 then + dec Inspect.199; + let Inspect.339 : [C Str, C Str List Str] = TagId(0) Inspect.198; + let Inspect.338 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.339; + ret Inspect.338; else - let Inspect.321 : [C Str, C Str List Str] = TagId(1) Inspect.203 Inspect.204; - let Inspect.320 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.321; - ret Inspect.320; + let Inspect.313 : [C Str, C Str List Str] = TagId(1) Inspect.198 Inspect.199; + let Inspect.312 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.313; + ret Inspect.312; -procedure Inspect.44 (Inspect.250): - let Inspect.351 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.351; +procedure Inspect.43 (Inspect.245): + let Inspect.343 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.343; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : Str = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.3 Inspect.312 Inspect.316; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : Str = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.3 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.328 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.328; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.320 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.320; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.1 (List.105): let List.584 : U64 = CallByName List.6 List.105; @@ -143,13 +143,13 @@ procedure List.66 (#Attr.2, #Attr.3): let List.581 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; ret List.581; -procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): +procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): joinpoint List.574 List.161 List.162 List.163 List.164 List.165: let List.576 : Int1 = CallByName Num.22 List.164 List.165; if List.576 then let List.580 : Str = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : Str = CallByName Inspect.211 List.162 List.580; + let List.166 : Str = CallByName Inspect.206 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -157,21 +157,21 @@ procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_g dec List.161; ret List.162; in - jump List.574 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.574 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.4 : Str = "foo"; - let Test.3 : Str = CallByName Inspect.34 Test.4; + let Test.3 : Str = CallByName Inspect.33 Test.4; ret Test.3; 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 58c5cc94924..5f34fb0530e 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 @@ -10,120 +10,120 @@ procedure #Derived.4 (#Derived.5, #Derived.1): let #Derived.2 : Str = StructAtIndex 0 #Derived.1; let #Derived.3 : Str = StructAtIndex 1 #Derived.1; let #Derived_gen.7 : Str = "A"; - let #Derived_gen.9 : Str = CallByName Inspect.44 #Derived.2; - let #Derived_gen.10 : Str = CallByName Inspect.44 #Derived.3; + let #Derived_gen.9 : Str = CallByName Inspect.43 #Derived.2; + let #Derived_gen.10 : Str = CallByName Inspect.43 #Derived.3; let #Derived_gen.8 : List Str = Array [#Derived_gen.9, #Derived_gen.10]; - let #Derived_gen.6 : [C Str, C Str List Str] = CallByName Inspect.40 #Derived_gen.7 #Derived_gen.8; + let #Derived_gen.6 : [C Str, C Str List Str] = CallByName Inspect.39 #Derived_gen.7 #Derived_gen.8; jump #Derived_gen.5 #Derived_gen.6; procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure Inspect.205 (Inspect.206, #Attr.12): - let Inspect.350 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12; - let Inspect.349 : Str = CallByName Inspect.61 Inspect.206 Inspect.350; - ret Inspect.349; - -procedure Inspect.207 (Inspect.208, #Attr.12): - let Inspect.344 : List Str = UnionAtIndex (Id 1) (Index 1) #Attr.12; - let Inspect.343 : Str = UnionAtIndex (Id 1) (Index 0) #Attr.12; - let Inspect.342 : Str = "("; - let Inspect.341 : Str = CallByName Inspect.61 Inspect.208 Inspect.342; - let Inspect.329 : Str = CallByName Inspect.61 Inspect.341 Inspect.343; - let Inspect.325 : Str = CallByName Inspect.209 Inspect.329 Inspect.344; - let Inspect.326 : Str = ")"; - let Inspect.324 : Str = CallByName Inspect.61 Inspect.325 Inspect.326; +procedure Inspect.200 (Inspect.201, #Attr.12): + let Inspect.342 : Str = UnionAtIndex (Id 0) (Index 0) #Attr.12; + let Inspect.341 : Str = CallByName Inspect.59 Inspect.201 Inspect.342; + ret Inspect.341; + +procedure Inspect.202 (Inspect.203, #Attr.12): + let Inspect.336 : List Str = UnionAtIndex (Id 1) (Index 1) #Attr.12; + let Inspect.335 : Str = UnionAtIndex (Id 1) (Index 0) #Attr.12; + let Inspect.334 : Str = "("; + let Inspect.333 : Str = CallByName Inspect.59 Inspect.203 Inspect.334; + let Inspect.321 : Str = CallByName Inspect.59 Inspect.333 Inspect.335; + let Inspect.317 : Str = CallByName Inspect.204 Inspect.321 Inspect.336; + let Inspect.318 : Str = ")"; + let Inspect.316 : Str = CallByName Inspect.59 Inspect.317 Inspect.318; + ret Inspect.316; + +procedure Inspect.204 (Inspect.205, Inspect.199): + let Inspect.325 : {} = Struct {}; + let Inspect.324 : Str = CallByName List.18 Inspect.199 Inspect.205 Inspect.325; ret Inspect.324; -procedure Inspect.209 (Inspect.210, Inspect.204): - let Inspect.333 : {} = Struct {}; - let Inspect.332 : Str = CallByName List.18 Inspect.204 Inspect.210 Inspect.333; - ret Inspect.332; - -procedure Inspect.211 (Inspect.212, Inspect.213): - let Inspect.340 : Str = " "; - let Inspect.335 : Str = CallByName Inspect.61 Inspect.212 Inspect.340; - let Inspect.334 : Str = CallByName Inspect.214 Inspect.335 Inspect.213; - ret Inspect.334; - -procedure Inspect.214 (Inspect.215, Inspect.213): - let Inspect.338 : Str = CallByName Inspect.31 Inspect.213 Inspect.215; - ret Inspect.338; - -procedure Inspect.251 (Inspect.252, Inspect.250): - let Inspect.359 : Str = "\""; - let Inspect.358 : Str = CallByName Inspect.61 Inspect.252 Inspect.359; - let Inspect.356 : Str = CallByName Inspect.61 Inspect.358 Inspect.250; - let Inspect.357 : Str = "\""; - let Inspect.355 : Str = CallByName Inspect.61 Inspect.356 Inspect.357; - ret Inspect.355; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.319 : U8 = GetTagId Inspect.307; - switch Inspect.319: +procedure Inspect.206 (Inspect.207, Inspect.208): + let Inspect.332 : Str = " "; + let Inspect.327 : Str = CallByName Inspect.59 Inspect.207 Inspect.332; + let Inspect.326 : Str = CallByName Inspect.209 Inspect.327 Inspect.208; + ret Inspect.326; + +procedure Inspect.209 (Inspect.210, Inspect.208): + let Inspect.330 : Str = CallByName Inspect.31 Inspect.208 Inspect.210; + ret Inspect.330; + +procedure Inspect.246 (Inspect.247, Inspect.245): + let Inspect.351 : Str = "\""; + let Inspect.350 : Str = CallByName Inspect.59 Inspect.247 Inspect.351; + let Inspect.348 : Str = CallByName Inspect.59 Inspect.350 Inspect.245; + let Inspect.349 : Str = "\""; + let Inspect.347 : Str = CallByName Inspect.59 Inspect.348 Inspect.349; + ret Inspect.347; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.311 : U8 = GetTagId Inspect.299; + switch Inspect.311: case 0: - let Inspect.318 : Str = CallByName Inspect.205 Inspect.150 Inspect.307; - ret Inspect.318; + let Inspect.310 : Str = CallByName Inspect.200 Inspect.145 Inspect.299; + ret Inspect.310; default: - let Inspect.318 : Str = CallByName Inspect.207 Inspect.150 Inspect.307; - ret Inspect.318; + let Inspect.310 : Str = CallByName Inspect.202 Inspect.145 Inspect.299; + ret Inspect.310; -procedure Inspect.31 (Inspect.307, Inspect.150): - let Inspect.339 : Str = CallByName Inspect.251 Inspect.150 Inspect.307; - ret Inspect.339; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; - -procedure Inspect.40 (Inspect.203, Inspect.204): - inc Inspect.204; - let Inspect.345 : Int1 = CallByName List.1 Inspect.204; - if Inspect.345 then - dec Inspect.204; - let Inspect.347 : [C Str, C Str List Str] = TagId(0) Inspect.203; - let Inspect.346 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.347; - ret Inspect.346; +procedure Inspect.31 (Inspect.299, Inspect.145): + let Inspect.331 : Str = CallByName Inspect.246 Inspect.145 Inspect.299; + ret Inspect.331; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.39 (Inspect.198, Inspect.199): + inc Inspect.199; + let Inspect.337 : Int1 = CallByName List.1 Inspect.199; + if Inspect.337 then + dec Inspect.199; + let Inspect.339 : [C Str, C Str List Str] = TagId(0) Inspect.198; + let Inspect.338 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.339; + ret Inspect.338; else - let Inspect.321 : [C Str, C Str List Str] = TagId(1) Inspect.203 Inspect.204; - let Inspect.320 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.321; - ret Inspect.320; + let Inspect.313 : [C Str, C Str List Str] = TagId(1) Inspect.198 Inspect.199; + let Inspect.312 : [C Str, C Str List Str] = CallByName Inspect.30 Inspect.313; + ret Inspect.312; -procedure Inspect.44 (Inspect.250): - let Inspect.360 : Str = CallByName Inspect.30 Inspect.250; - ret Inspect.360; +procedure Inspect.43 (Inspect.245): + let Inspect.352 : Str = CallByName Inspect.30 Inspect.245; + ret Inspect.352; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {Str, Str} = CallByName #Derived.0 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName #Derived.4 Inspect.312 Inspect.316; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {Str, Str} = CallByName #Derived.0 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName #Derived.4 Inspect.304 Inspect.308; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.328 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.328; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.320 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.320; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure List.1 (List.105): let List.584 : U64 = CallByName List.6 List.105; @@ -152,7 +152,7 @@ procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_g if List.576 then let List.580 : Str = CallByName List.66 List.161 List.164; inc List.580; - let List.166 : Str = CallByName Inspect.211 List.162 List.580; + let List.166 : Str = CallByName Inspect.206 List.162 List.580; let List.579 : U64 = 1i64; let List.578 : U64 = CallByName Num.51 List.164 List.579; jump List.574 List.161 List.166 List.163 List.578 List.165; @@ -163,20 +163,20 @@ procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_g jump List.574 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.5 : Str = "foo"; let Test.4 : Str = "foo"; let Test.1 : {Str, Str} = Struct {Test.4, Test.5}; - let Test.3 : Str = CallByName Inspect.34 Test.1; + let Test.3 : Str = CallByName Inspect.33 Test.1; ret Test.3; diff --git a/crates/compiler/test_mono/generated/ir_int_add.txt b/crates/compiler/test_mono/generated/ir_int_add.txt index 2819c81d600..ebce884fb07 100644 --- a/crates/compiler/test_mono/generated/ir_int_add.txt +++ b/crates/compiler/test_mono/generated/ir_int_add.txt @@ -3,8 +3,8 @@ procedure List.6 (#Attr.2): ret List.571; procedure Num.19 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.259; procedure Test.0 (): let Test.1 : List I64 = Array [1i64, 2i64]; diff --git a/crates/compiler/test_mono/generated/ir_plus.txt b/crates/compiler/test_mono/generated/ir_plus.txt index 53e7c668f17..2bbd4d95d22 100644 --- a/crates/compiler/test_mono/generated/ir_plus.txt +++ b/crates/compiler/test_mono/generated/ir_plus.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.2 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/ir_round.txt b/crates/compiler/test_mono/generated/ir_round.txt index 0173f8dd9c3..7eebe5e11a7 100644 --- a/crates/compiler/test_mono/generated/ir_round.txt +++ b/crates/compiler/test_mono/generated/ir_round.txt @@ -1,6 +1,6 @@ procedure Num.45 (#Attr.2): - let Num.297 : I64 = lowlevel NumRound #Attr.2; - ret Num.297; + let Num.257 : I64 = lowlevel NumRound #Attr.2; + ret Num.257; procedure Test.0 (): let Test.2 : Decimal = 3.6dec; diff --git a/crates/compiler/test_mono/generated/ir_two_defs.txt b/crates/compiler/test_mono/generated/ir_two_defs.txt index 500fff595df..f54ffd118b2 100644 --- a/crates/compiler/test_mono/generated/ir_two_defs.txt +++ b/crates/compiler/test_mono/generated/ir_two_defs.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.1 : I64 = 3i64; diff --git a/crates/compiler/test_mono/generated/ir_when_idiv.txt b/crates/compiler/test_mono/generated/ir_when_idiv.txt index bdc0575da14..f7d1f27cd7a 100644 --- a/crates/compiler/test_mono/generated/ir_when_idiv.txt +++ b/crates/compiler/test_mono/generated/ir_when_idiv.txt @@ -1,22 +1,22 @@ procedure Num.30 (#Attr.2): - let Num.304 : I64 = 0i64; - let Num.303 : Int1 = lowlevel Eq #Attr.2 Num.304; - ret Num.303; + let Num.264 : I64 = 0i64; + let Num.263 : Int1 = lowlevel Eq #Attr.2 Num.264; + ret Num.263; procedure Num.39 (#Attr.2, #Attr.3): - let Num.299 : I64 = lowlevel NumDivTruncUnchecked #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : I64 = lowlevel NumDivTruncUnchecked #Attr.2 #Attr.3; + ret Num.259; -procedure Num.40 (Num.267, Num.268): - let Num.300 : Int1 = CallByName Num.30 Num.268; - if Num.300 then - let Num.302 : {} = Struct {}; - let Num.301 : [C {}, C I64] = TagId(0) Num.302; - ret Num.301; +procedure Num.40 (Num.227, Num.228): + let Num.260 : Int1 = CallByName Num.30 Num.228; + if Num.260 then + let Num.262 : {} = Struct {}; + let Num.261 : [C {}, C I64] = TagId(0) Num.262; + ret Num.261; else - let Num.298 : I64 = CallByName Num.39 Num.267 Num.268; - let Num.297 : [C {}, C I64] = TagId(1) Num.298; - ret Num.297; + let Num.258 : I64 = CallByName Num.39 Num.227 Num.228; + let Num.257 : [C {}, C I64] = TagId(1) Num.258; + ret Num.257; procedure Test.0 (): let Test.8 : I64 = 1000i64; diff --git a/crates/compiler/test_mono/generated/ir_when_just.txt b/crates/compiler/test_mono/generated/ir_when_just.txt index 158163aecff..8ceef4e3e4d 100644 --- a/crates/compiler/test_mono/generated/ir_when_just.txt +++ b/crates/compiler/test_mono/generated/ir_when_just.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.10 : I64 = 41i64; 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 990c1569281..f9473e35ed8 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 @@ -44,31 +44,31 @@ procedure List.9 (List.333): ret List.573; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; -procedure Str.27 (Str.87): - let Str.250 : [C Int1, C I64] = CallByName Str.61 Str.87; - ret Str.250; +procedure Str.27 (Str.86): + let Str.249 : [C Int1, C I64] = CallByName Str.60 Str.86; + ret Str.249; procedure Str.42 (#Attr.2): - let Str.258 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.258; + let Str.257 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.257; -procedure Str.61 (Str.194): - let Str.195 : {I64, U8} = CallByName Str.42 Str.194; - dec Str.194; - let Str.256 : U8 = StructAtIndex 1 Str.195; - let Str.257 : U8 = 0i64; - let Str.253 : Int1 = CallByName Bool.11 Str.256 Str.257; - if Str.253 then - let Str.255 : I64 = StructAtIndex 0 Str.195; - let Str.254 : [C Int1, C I64] = TagId(1) Str.255; - ret Str.254; +procedure Str.60 (Str.193): + let Str.194 : {I64, U8} = CallByName Str.42 Str.193; + dec Str.193; + let Str.255 : U8 = StructAtIndex 1 Str.194; + let Str.256 : U8 = 0i64; + let Str.252 : Int1 = CallByName Bool.11 Str.255 Str.256; + if Str.252 then + let Str.254 : I64 = StructAtIndex 0 Str.194; + let Str.253 : [C Int1, C I64] = TagId(1) Str.254; + ret Str.253; else - let Str.252 : Int1 = false; - let Str.251 : [C Int1, C I64] = TagId(0) Str.252; - ret Str.251; + let Str.251 : Int1 = false; + let Str.250 : [C Int1, C I64] = TagId(0) Str.251; + ret Str.250; procedure Test.0 (): let Test.3 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt index 686bf280c17..d01906691d9 100644 --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -178,72 +178,67 @@ procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen. in jump List.636 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; -procedure Num.133 (#Attr.2): - let Num.336 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.336; - procedure Num.19 (#Attr.2, #Attr.3): - let Num.300 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.260; procedure Num.19 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.309; + let Num.269 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.269; procedure Num.20 (#Attr.2, #Attr.3): - let Num.312 : U8 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.312; + let Num.272 : U8 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.272; procedure Num.22 (#Attr.2, #Attr.3): - let Num.334 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.334; + let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.294; procedure Num.23 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; - ret Num.318; + let Num.278 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; + ret Num.278; procedure Num.25 (#Attr.2, #Attr.3): - let Num.324 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; - ret Num.324; + let Num.284 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; + ret Num.284; procedure Num.51 (#Attr.2, #Attr.3): - let Num.335 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.335; + let Num.295 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.295; procedure Num.71 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U8 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; + ret Num.257; procedure Num.72 (#Attr.2, #Attr.3): - let Num.298 : U8 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U8 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; + ret Num.258; procedure Num.77 (#Attr.2, #Attr.3): - let Num.331 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.331; + let Num.291 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.291; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.259 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.259; - -procedure Str.9 (Str.68): - let Str.257 : U64 = 0i64; - let Str.260 : U64 = CallByName List.6 Str.68; - let Str.258 : U64 = CallByName Num.133 Str.260; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.257 Str.258; - let Str.254 : Int1 = StructAtIndex 2 Str.69; - if Str.254 then - let Str.256 : Str = StructAtIndex 1 Str.69; - let Str.255 : [C {U64, U8}, C Str] = TagId(1) Str.256; - ret Str.255; + let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.258; + +procedure Str.9 (Str.67): + let Str.256 : U64 = 0i64; + let Str.257 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; + let Str.253 : Int1 = StructAtIndex 2 Str.68; + if Str.253 then + let Str.255 : Str = StructAtIndex 1 Str.68; + let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; + ret Str.254; else - let Str.252 : U8 = StructAtIndex 3 Str.69; - let Str.253 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.6 : Str = StructAtIndex 1 Str.69; + let Str.251 : U8 = StructAtIndex 3 Str.68; + let Str.252 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.6 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.6; - let Str.251 : {U64, U8} = Struct {Str.253, Str.252}; - let Str.250 : [C {U64, U8}, C Str] = TagId(0) Str.251; - ret Str.250; + let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; + let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; + ret Str.249; procedure Test.3 (): let Test.0 : List U8 = Array [82i64, 111i64, 99i64]; diff --git a/crates/compiler/test_mono/generated/issue_4770.txt b/crates/compiler/test_mono/generated/issue_4770.txt index ee626124247..d2b6108ea5b 100644 --- a/crates/compiler/test_mono/generated/issue_4770.txt +++ b/crates/compiler/test_mono/generated/issue_4770.txt @@ -82,16 +82,16 @@ procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen. jump List.587 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.51 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.259; procedure Test.1 (#Derived_gen.0): joinpoint Test.26 Test.6: 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 03821460455..3fcfa7a9899 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 @@ -152,99 +152,94 @@ procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen. in jump List.632 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; -procedure Num.133 (#Attr.2): - let Num.336 : U64 = lowlevel NumIntCast #Attr.2; - ret Num.336; - procedure Num.19 (#Attr.2, #Attr.3): - let Num.300 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.260; procedure Num.19 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.309; + let Num.269 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.269; procedure Num.20 (#Attr.2, #Attr.3): - let Num.312 : U8 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.312; + let Num.272 : U8 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.272; procedure Num.22 (#Attr.2, #Attr.3): - let Num.334 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.334; + let Num.294 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.294; procedure Num.23 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; - ret Num.318; + let Num.278 : Int1 = lowlevel NumLte #Attr.2 #Attr.3; + ret Num.278; procedure Num.25 (#Attr.2, #Attr.3): - let Num.324 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; - ret Num.324; + let Num.284 : Int1 = lowlevel NumGte #Attr.2 #Attr.3; + ret Num.284; procedure Num.51 (#Attr.2, #Attr.3): - let Num.335 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.335; + let Num.295 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.295; procedure Num.71 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U8 = lowlevel NumBitwiseOr #Attr.2 #Attr.3; + ret Num.257; procedure Num.72 (#Attr.2, #Attr.3): - let Num.298 : U8 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U8 = lowlevel NumShiftLeftBy #Attr.2 #Attr.3; + ret Num.258; procedure Num.77 (#Attr.2, #Attr.3): - let Num.331 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.331; + let Num.291 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.291; procedure Str.12 (#Attr.2): - let Str.259 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.259; + let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.258; -procedure Str.27 (Str.87): - let Str.250 : [C {}, C I64] = CallByName Str.61 Str.87; - ret Str.250; +procedure Str.27 (Str.86): + let Str.249 : [C {}, C I64] = CallByName Str.60 Str.86; + ret Str.249; procedure Str.42 (#Attr.2): - let Str.258 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.258; + let Str.257 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.257; procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.269 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.269; - -procedure Str.61 (Str.194): - let Str.195 : {I64, U8} = CallByName Str.42 Str.194; - dec Str.194; - let Str.256 : U8 = StructAtIndex 1 Str.195; - let Str.257 : U8 = 0i64; - let Str.253 : Int1 = CallByName Bool.11 Str.256 Str.257; - if Str.253 then - let Str.255 : I64 = StructAtIndex 0 Str.195; - let Str.254 : [C {}, C I64] = TagId(1) Str.255; - ret Str.254; + let Str.268 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; + ret Str.268; + +procedure Str.60 (Str.193): + let Str.194 : {I64, U8} = CallByName Str.42 Str.193; + dec Str.193; + let Str.255 : U8 = StructAtIndex 1 Str.194; + let Str.256 : U8 = 0i64; + let Str.252 : Int1 = CallByName Bool.11 Str.255 Str.256; + if Str.252 then + let Str.254 : I64 = StructAtIndex 0 Str.194; + let Str.253 : [C {}, C I64] = TagId(1) Str.254; + ret Str.253; else - let Str.252 : {} = Struct {}; - let Str.251 : [C {}, C I64] = TagId(0) Str.252; - ret Str.251; - -procedure Str.9 (Str.68): - let Str.267 : U64 = 0i64; - let Str.270 : U64 = CallByName List.6 Str.68; - let Str.268 : U64 = CallByName Num.133 Str.270; - let Str.69 : {U64, Str, Int1, U8} = CallByName Str.43 Str.68 Str.267 Str.268; - let Str.264 : Int1 = StructAtIndex 2 Str.69; - if Str.264 then - let Str.266 : Str = StructAtIndex 1 Str.69; - let Str.265 : [C {U64, U8}, C Str] = TagId(1) Str.266; - ret Str.265; + let Str.251 : {} = Struct {}; + let Str.250 : [C {}, C I64] = TagId(0) Str.251; + ret Str.250; + +procedure Str.9 (Str.67): + let Str.266 : U64 = 0i64; + let Str.267 : U64 = CallByName List.6 Str.67; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.266 Str.267; + let Str.263 : Int1 = StructAtIndex 2 Str.68; + if Str.263 then + let Str.265 : Str = StructAtIndex 1 Str.68; + let Str.264 : [C {U64, U8}, C Str] = TagId(1) Str.265; + ret Str.264; else - let Str.262 : U8 = StructAtIndex 3 Str.69; - let Str.263 : U64 = StructAtIndex 0 Str.69; - let #Derived_gen.7 : Str = StructAtIndex 1 Str.69; + let Str.261 : U8 = StructAtIndex 3 Str.68; + let Str.262 : U64 = StructAtIndex 0 Str.68; + let #Derived_gen.7 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.7; - let Str.261 : {U64, U8} = Struct {Str.263, Str.262}; - let Str.260 : [C {U64, U8}, C Str] = TagId(0) Str.261; - ret Str.260; + let Str.260 : {U64, U8} = Struct {Str.262, Str.261}; + let Str.259 : [C {U64, U8}, C Str] = TagId(0) Str.260; + ret Str.259; procedure Test.0 (): let Test.37 : Str = "-1234"; diff --git a/crates/compiler/test_mono/generated/issue_6196.txt b/crates/compiler/test_mono/generated/issue_6196.txt index 75b457e90fc..c215423608d 100644 --- a/crates/compiler/test_mono/generated/issue_6196.txt +++ b/crates/compiler/test_mono/generated/issue_6196.txt @@ -1,6 +1,6 @@ procedure Num.20 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.12 Test.2 Test.3: diff --git a/crates/compiler/test_mono/generated/lambda_capture_niche_u8_vs_u64.txt b/crates/compiler/test_mono/generated/lambda_capture_niche_u8_vs_u64.txt index d0d9e46a840..8a609ad08bb 100644 --- a/crates/compiler/test_mono/generated/lambda_capture_niche_u8_vs_u64.txt +++ b/crates/compiler/test_mono/generated/lambda_capture_niche_u8_vs_u64.txt @@ -1,10 +1,10 @@ procedure Num.96 (#Attr.2): - let Num.297 : Str = lowlevel NumToStr #Attr.2; - ret Num.297; + let Num.257 : Str = lowlevel NumToStr #Attr.2; + ret Num.257; procedure Num.96 (#Attr.2): - let Num.298 : Str = lowlevel NumToStr #Attr.2; - ret Num.298; + let Num.258 : Str = lowlevel NumToStr #Attr.2; + ret Num.258; procedure Test.1 (Test.4): let Test.13 : [C U8, C U64] = TagId(1) Test.4; diff --git a/crates/compiler/test_mono/generated/lambda_set_with_imported_toplevels_issue_4733.txt b/crates/compiler/test_mono/generated/lambda_set_with_imported_toplevels_issue_4733.txt index ea6275acd9c..df9fffa6604 100644 --- a/crates/compiler/test_mono/generated/lambda_set_with_imported_toplevels_issue_4733.txt +++ b/crates/compiler/test_mono/generated/lambda_set_with_imported_toplevels_issue_4733.txt @@ -7,12 +7,12 @@ procedure Bool.2 (): ret Bool.24; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Num.21 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.258; procedure Test.0 (Test.8): let Test.20 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt index 7a3c3068e3a..be24d0c8e41 100644 --- a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt +++ b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt @@ -29,12 +29,12 @@ procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Num.51 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.257; procedure Test.7 (Test.11, Test.12): let Test.17 : {[C *self, ], [, C {[C *self, ], *self}]} = Struct {Test.12, Test.11}; diff --git a/crates/compiler/test_mono/generated/linked_list_filter.txt b/crates/compiler/test_mono/generated/linked_list_filter.txt index 77d3419132f..5d3e6dd5c9c 100644 --- a/crates/compiler/test_mono/generated/linked_list_filter.txt +++ b/crates/compiler/test_mono/generated/linked_list_filter.txt @@ -1,11 +1,11 @@ -procedure Num.31 (Num.239): - let Num.298 : I64 = 2i64; - let Num.297 : Int1 = CallByName Num.86 Num.239 Num.298; - ret Num.297; +procedure Num.31 (Num.199): + let Num.258 : I64 = 2i64; + let Num.257 : Int1 = CallByName Num.86 Num.199 Num.258; + ret Num.257; procedure Num.86 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumIsMultipleOf #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumIsMultipleOf #Attr.2 #Attr.3; + ret Num.259; procedure Test.2 (#Derived_gen.0, #Derived_gen.1): let #Derived_gen.3 : [, C I64 *self] = NullPointer; diff --git a/crates/compiler/test_mono/generated/linked_list_map.txt b/crates/compiler/test_mono/generated/linked_list_map.txt index f14e7d2a79d..9ac0bff1a27 100644 --- a/crates/compiler/test_mono/generated/linked_list_map.txt +++ b/crates/compiler/test_mono/generated/linked_list_map.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.10 (Test.11): let Test.28 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt b/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt index 8b52b32cfb1..8a9a0d4cc67 100644 --- a/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt +++ b/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt @@ -22,12 +22,12 @@ procedure List.67 (#Attr.2, #Attr.3, #Attr.4): ret List.578; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Num.22 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.258; procedure Test.1 (): let Test.8 : List I64 = Array [1i64, 2i64, 3i64]; diff --git a/crates/compiler/test_mono/generated/list_get.txt b/crates/compiler/test_mono/generated/list_get.txt index eac83ac49be..40a1b5be6e9 100644 --- a/crates/compiler/test_mono/generated/list_get.txt +++ b/crates/compiler/test_mono/generated/list_get.txt @@ -21,8 +21,8 @@ procedure List.66 (#Attr.2, #Attr.3): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): let Test.6 : List I64 = Array [1i64, 2i64, 3i64]; diff --git a/crates/compiler/test_mono/generated/list_len.txt b/crates/compiler/test_mono/generated/list_len.txt index 5ee28e936fc..a9dd9b95131 100644 --- a/crates/compiler/test_mono/generated/list_len.txt +++ b/crates/compiler/test_mono/generated/list_len.txt @@ -7,8 +7,8 @@ procedure List.6 (#Attr.2): ret List.572; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.1 : List I64 = Array [1i64, 2i64, 3i64]; 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 fb3c9126320..ab480b3721e 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt @@ -27,16 +27,16 @@ procedure List.66 (#Attr.2, #Attr.3): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Str.16 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; + ret Str.249; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; 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 a97575e2983..92bd93dc018 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_owns.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_owns.txt @@ -27,12 +27,12 @@ procedure List.66 (#Attr.2, #Attr.3): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.1 (): let Test.21 : Str = "lllllllllllllllllllllooooooooooong"; diff --git a/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt b/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt index 6f84ed23c98..28d519f5e8a 100644 --- a/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt +++ b/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt @@ -21,8 +21,8 @@ procedure List.5 (#Attr.2, #Attr.3): procedure Num.19 (#Attr.2, #Attr.3): - let Num.299 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.259; procedure Test.4 (Test.5, #Attr.12): let Test.16 : U8 = UnionAtIndex (Id 0) (Index 0) #Attr.12; diff --git a/crates/compiler/test_mono/generated/list_pass_to_function.txt b/crates/compiler/test_mono/generated/list_pass_to_function.txt index 3091430e8d3..dd2e01d1c68 100644 --- a/crates/compiler/test_mono/generated/list_pass_to_function.txt +++ b/crates/compiler/test_mono/generated/list_pass_to_function.txt @@ -22,8 +22,8 @@ procedure List.67 (#Attr.2, #Attr.3, #Attr.4): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Test.2 (Test.3): let Test.6 : U64 = 0i64; diff --git a/crates/compiler/test_mono/generated/list_sort_asc.txt b/crates/compiler/test_mono/generated/list_sort_asc.txt index a44d2ab2da1..db7fbc00761 100644 --- a/crates/compiler/test_mono/generated/list_sort_asc.txt +++ b/crates/compiler/test_mono/generated/list_sort_asc.txt @@ -8,8 +8,8 @@ procedure List.59 (List.328): ret List.571; procedure Num.46 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumCompare #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U8 = lowlevel NumCompare #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.2 : List I64 = Array [4i64, 3i64, 2i64, 1i64]; diff --git a/crates/compiler/test_mono/generated/multiline_record_pattern.txt b/crates/compiler/test_mono/generated/multiline_record_pattern.txt index 1544bac27f7..73c82300f72 100644 --- a/crates/compiler/test_mono/generated/multiline_record_pattern.txt +++ b/crates/compiler/test_mono/generated/multiline_record_pattern.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Test.0 (): let Test.7 : I64 = 1i64; diff --git a/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt b/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt index a62795fe6ee..c1273f527aa 100644 --- a/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt +++ b/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.17 : {} = Struct {}; diff --git a/crates/compiler/test_mono/generated/nested_pattern_match.txt b/crates/compiler/test_mono/generated/nested_pattern_match.txt index 16ade25e630..e8e714e59e5 100644 --- a/crates/compiler/test_mono/generated/nested_pattern_match.txt +++ b/crates/compiler/test_mono/generated/nested_pattern_match.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.19 : I64 = 41i64; diff --git a/crates/compiler/test_mono/generated/num_width_gt_u8_layout_as_float.txt b/crates/compiler/test_mono/generated/num_width_gt_u8_layout_as_float.txt index e49fa167625..240d2c7db98 100644 --- a/crates/compiler/test_mono/generated/num_width_gt_u8_layout_as_float.txt +++ b/crates/compiler/test_mono/generated/num_width_gt_u8_layout_as_float.txt @@ -1,6 +1,6 @@ procedure Num.37 (#Attr.2, #Attr.3): - let Num.297 : Decimal = lowlevel NumDivFrac #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Decimal = lowlevel NumDivFrac #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.2 : Decimal = 1dec; diff --git a/crates/compiler/test_mono/generated/optional_field_with_binary_op.txt b/crates/compiler/test_mono/generated/optional_field_with_binary_op.txt index eab2f22da0f..533cc36d086 100644 --- a/crates/compiler/test_mono/generated/optional_field_with_binary_op.txt +++ b/crates/compiler/test_mono/generated/optional_field_with_binary_op.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.5 : {} = Struct {}; diff --git a/crates/compiler/test_mono/generated/optional_when.txt b/crates/compiler/test_mono/generated/optional_when.txt index 9e5a880c45f..1da4dd989cc 100644 --- a/crates/compiler/test_mono/generated/optional_when.txt +++ b/crates/compiler/test_mono/generated/optional_when.txt @@ -1,6 +1,6 @@ procedure Num.21 (#Attr.2, #Attr.3): - let Num.299 : I64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : I64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.259; procedure Test.1 (Test.6): let Test.21 : Int1 = false; diff --git a/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt b/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt index 3a9ba4f34fd..56ea2423ae3 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.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.250; procedure Test.2 (Test.7): let Test.24 : Str = ".trace(\""; diff --git a/crates/compiler/test_mono/generated/quicksort_help.txt b/crates/compiler/test_mono/generated/quicksort_help.txt index d012c4719fa..f015401a183 100644 --- a/crates/compiler/test_mono/generated/quicksort_help.txt +++ b/crates/compiler/test_mono/generated/quicksort_help.txt @@ -1,14 +1,14 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Num.20 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.258; procedure Num.22 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.259; procedure Test.1 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): joinpoint Test.12 Test.2 Test.3 Test.4: diff --git a/crates/compiler/test_mono/generated/quicksort_swap.txt b/crates/compiler/test_mono/generated/quicksort_swap.txt index ccd8e70de83..35303f7caed 100644 --- a/crates/compiler/test_mono/generated/quicksort_swap.txt +++ b/crates/compiler/test_mono/generated/quicksort_swap.txt @@ -40,8 +40,8 @@ procedure List.67 (#Attr.2, #Attr.3, #Attr.4): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.259; procedure Test.1 (Test.2): let Test.28 : U64 = 0i64; diff --git a/crates/compiler/test_mono/generated/rb_tree_fbip.txt b/crates/compiler/test_mono/generated/rb_tree_fbip.txt index 35085c1e8de..dda57578150 100644 --- a/crates/compiler/test_mono/generated/rb_tree_fbip.txt +++ b/crates/compiler/test_mono/generated/rb_tree_fbip.txt @@ -1,10 +1,10 @@ procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.24 (#Attr.2, #Attr.3): - let Num.298 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.258; procedure Test.3 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2): let #Derived_gen.4 : [C *self I64 *self I32 Int1, ] = NullPointer; diff --git a/crates/compiler/test_mono/generated/record_optional_field_function_no_use_default.txt b/crates/compiler/test_mono/generated/record_optional_field_function_no_use_default.txt index 633f29e642f..988b0cf432f 100644 --- a/crates/compiler/test_mono/generated/record_optional_field_function_no_use_default.txt +++ b/crates/compiler/test_mono/generated/record_optional_field_function_no_use_default.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.4): let Test.2 : I64 = StructAtIndex 0 Test.4; diff --git a/crates/compiler/test_mono/generated/record_optional_field_function_use_default.txt b/crates/compiler/test_mono/generated/record_optional_field_function_use_default.txt index 680130e2229..356f58f1369 100644 --- a/crates/compiler/test_mono/generated/record_optional_field_function_use_default.txt +++ b/crates/compiler/test_mono/generated/record_optional_field_function_use_default.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.4): let Test.2 : I64 = 10i64; diff --git a/crates/compiler/test_mono/generated/record_optional_field_let_no_use_default.txt b/crates/compiler/test_mono/generated/record_optional_field_let_no_use_default.txt index a9e808ad347..2abaf868ba6 100644 --- a/crates/compiler/test_mono/generated/record_optional_field_let_no_use_default.txt +++ b/crates/compiler/test_mono/generated/record_optional_field_let_no_use_default.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): let Test.3 : I64 = StructAtIndex 0 Test.2; diff --git a/crates/compiler/test_mono/generated/record_optional_field_let_use_default.txt b/crates/compiler/test_mono/generated/record_optional_field_let_use_default.txt index e205fc3bd43..b70eba153b7 100644 --- a/crates/compiler/test_mono/generated/record_optional_field_let_use_default.txt +++ b/crates/compiler/test_mono/generated/record_optional_field_let_use_default.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): let Test.3 : I64 = 10i64; diff --git a/crates/compiler/test_mono/generated/record_update.txt b/crates/compiler/test_mono/generated/record_update.txt index 02b2b8c50c6..10d627861f8 100644 --- a/crates/compiler/test_mono/generated/record_update.txt +++ b/crates/compiler/test_mono/generated/record_update.txt @@ -22,8 +22,8 @@ procedure List.67 (#Attr.2, #Attr.3, #Attr.4): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.297 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): let Test.6 : List U64 = StructAtIndex 0 Test.2; diff --git a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt index 32fc7607661..bab8208aa9a 100644 --- a/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt +++ b/crates/compiler/test_mono/generated/recursive_call_capturing_function.txt @@ -3,8 +3,8 @@ procedure Bool.2 (): ret Bool.23; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U32 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U32 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): let Test.8 : U32 = 0i64; diff --git a/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt b/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt index 8ce77532aea..7f67143be33 100644 --- a/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt +++ b/crates/compiler/test_mono/generated/recursive_lambda_set_resolved_only_upon_specialization.txt @@ -3,12 +3,12 @@ procedure Bool.11 (#Attr.2, #Attr.3): ret Bool.23; procedure Num.20 (#Attr.2, #Attr.3): - let Num.298 : U8 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U8 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.258; procedure Num.21 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U8 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (#Derived_gen.2, #Derived_gen.3): joinpoint Test.11 Test.2 Test.3: diff --git a/crates/compiler/test_mono/generated/recursively_build_effect.txt b/crates/compiler/test_mono/generated/recursively_build_effect.txt index 2595c165df1..71f53b940b9 100644 --- a/crates/compiler/test_mono/generated/recursively_build_effect.txt +++ b/crates/compiler/test_mono/generated/recursively_build_effect.txt @@ -1,10 +1,10 @@ procedure Num.20 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.257; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.251; 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/rigids.txt b/crates/compiler/test_mono/generated/rigids.txt index 7506f3c66d3..69d16b8cb65 100644 --- a/crates/compiler/test_mono/generated/rigids.txt +++ b/crates/compiler/test_mono/generated/rigids.txt @@ -40,8 +40,8 @@ procedure List.67 (#Attr.2, #Attr.3, #Attr.4): ret List.576; procedure Num.22 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.259; procedure Test.1 (Test.2, Test.3, Test.4): inc 2 Test.4; diff --git a/crates/compiler/test_mono/generated/specialize_after_match.txt b/crates/compiler/test_mono/generated/specialize_after_match.txt index 9c63904cc11..e0f54500c48 100644 --- a/crates/compiler/test_mono/generated/specialize_after_match.txt +++ b/crates/compiler/test_mono/generated/specialize_after_match.txt @@ -1,10 +1,10 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Num.24 (#Attr.2, #Attr.3): - let Num.299 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.259; procedure Test.2 (Test.9, Test.10): let Test.38 : U8 = 1i64; diff --git a/crates/compiler/test_mono/generated/specialize_closures.txt b/crates/compiler/test_mono/generated/specialize_closures.txt index b42a45dfe3f..7b0c19301d7 100644 --- a/crates/compiler/test_mono/generated/specialize_closures.txt +++ b/crates/compiler/test_mono/generated/specialize_closures.txt @@ -3,12 +3,12 @@ procedure Bool.2 (): ret Bool.24; procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Num.21 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2, Test.3): let Test.15 : U8 = GetTagId Test.2; diff --git a/crates/compiler/test_mono/generated/specialize_lowlevel.txt b/crates/compiler/test_mono/generated/specialize_lowlevel.txt index 18c77dfe690..7348c12a9a6 100644 --- a/crates/compiler/test_mono/generated/specialize_lowlevel.txt +++ b/crates/compiler/test_mono/generated/specialize_lowlevel.txt @@ -3,12 +3,12 @@ procedure Bool.2 (): ret Bool.23; procedure Num.19 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.258; procedure Num.21 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.257; procedure Test.6 (Test.8, #Attr.12): let Test.20 : I64 = UnionAtIndex (Id 0) (Index 0) #Attr.12; diff --git a/crates/compiler/test_mono/generated/tail_call_elimination.txt b/crates/compiler/test_mono/generated/tail_call_elimination.txt index 45ee8a6699a..fda1781c4f5 100644 --- a/crates/compiler/test_mono/generated/tail_call_elimination.txt +++ b/crates/compiler/test_mono/generated/tail_call_elimination.txt @@ -1,10 +1,10 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Num.20 (#Attr.2, #Attr.3): - let Num.298 : I64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : I64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.258; procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.7 Test.2 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 7f3ca6c4e01..0e30f84992a 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 @@ -184,44 +184,44 @@ procedure List.90 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_g jump List.612 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; procedure Num.127 (#Attr.2): - let Num.304 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.304; + let Num.264 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.264; + +procedure Num.137 (#Attr.2, #Attr.3): + let Num.269 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; + ret Num.269; procedure Num.19 (#Attr.2, #Attr.3): - let Num.308 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.308; + let Num.268 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.268; procedure Num.20 (#Attr.2, #Attr.3): - let Num.305 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.305; + let Num.265 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.265; procedure Num.21 (#Attr.2, #Attr.3): - let Num.310 : U64 = lowlevel NumMul #Attr.2 #Attr.3; - ret Num.310; + let Num.270 : U64 = lowlevel NumMul #Attr.2 #Attr.3; + ret Num.270; procedure Num.22 (#Attr.2, #Attr.3): - let Num.316 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.316; + let Num.276 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.276; procedure Num.24 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.318; + let Num.278 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.278; procedure Num.51 (#Attr.2, #Attr.3): - let Num.313 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.313; + let Num.273 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.273; procedure Num.75 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; - ret Num.317; - -procedure Num.94 (#Attr.2, #Attr.3): - let Num.309 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; - ret Num.309; + let Num.277 : U64 = lowlevel NumSubWrap #Attr.2 #Attr.3; + ret Num.277; procedure Str.12 (#Attr.2): - let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.251; + let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.250; procedure Test.2 (Test.10): let Test.15 : {Str, Str} = CallByName Encode.23 Test.10; @@ -421,7 +421,7 @@ procedure TotallyNotJson.26 (TotallyNotJson.152): let TotallyNotJson.1062 : U64 = 120i64; let TotallyNotJson.1059 : U64 = CallByName Num.21 TotallyNotJson.1061 TotallyNotJson.1062; let TotallyNotJson.1060 : U64 = 100i64; - let TotallyNotJson.1058 : U64 = CallByName Num.94 TotallyNotJson.1059 TotallyNotJson.1060; + let TotallyNotJson.1058 : U64 = CallByName Num.137 TotallyNotJson.1059 TotallyNotJson.1060; let TotallyNotJson.1055 : List U8 = CallByName List.68 TotallyNotJson.1058; let TotallyNotJson.1057 : U8 = 34i64; let TotallyNotJson.1056 : List U8 = Array [TotallyNotJson.1057]; 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 69d7a5e38bf..dd3e0490078 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 @@ -158,28 +158,28 @@ procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_g jump List.600 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; procedure Num.127 (#Attr.2): - let Num.316 : U8 = lowlevel NumIntCast #Attr.2; - ret Num.316; + let Num.276 : U8 = lowlevel NumIntCast #Attr.2; + ret Num.276; procedure Num.20 (#Attr.2, #Attr.3): - let Num.317 : U64 = lowlevel NumSub #Attr.2 #Attr.3; - ret Num.317; + let Num.277 : U64 = lowlevel NumSub #Attr.2 #Attr.3; + ret Num.277; procedure Num.22 (#Attr.2, #Attr.3): - let Num.320 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.320; + let Num.280 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.280; procedure Num.24 (#Attr.2, #Attr.3): - let Num.318 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; - ret Num.318; + let Num.278 : Int1 = lowlevel NumGt #Attr.2 #Attr.3; + ret Num.278; procedure Num.51 (#Attr.2, #Attr.3): - let Num.319 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.319; + let Num.279 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.279; procedure Str.12 (#Attr.2): - let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.251; + let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.250; procedure Test.2 (Test.11): let Test.18 : {{}, {}} = CallByName Encode.23 Test.11; diff --git a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt index f739d970f71..b771575b192 100644 --- a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt +++ b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt @@ -78,16 +78,16 @@ procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen. jump List.591 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): - let Num.300 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; - ret Num.300; + let Num.260 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; + ret Num.260; procedure Num.51 (#Attr.2, #Attr.3): - let Num.299 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; - ret Num.299; + let Num.259 : U64 = lowlevel NumAddWrap #Attr.2 #Attr.3; + ret Num.259; procedure Num.77 (#Attr.2, #Attr.3): - let Num.298 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; - ret Num.298; + let Num.258 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; + ret Num.258; procedure Test.3 (Test.4, Test.12): let Test.13 : [C U64, C U64] = TagId(0) Test.4; diff --git a/crates/compiler/test_mono/generated/when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176.txt b/crates/compiler/test_mono/generated/when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176.txt index 41ca8698b0d..6b3d991ab7b 100644 --- a/crates/compiler/test_mono/generated/when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176.txt +++ b/crates/compiler/test_mono/generated/when_guard_appears_multiple_times_in_compiled_decision_tree_issue_5176.txt @@ -3,8 +3,8 @@ procedure Bool.2 (): ret Bool.25; procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.1 (Test.2): joinpoint Test.12: diff --git a/crates/compiler/test_mono/generated/when_nested_maybe.txt b/crates/compiler/test_mono/generated/when_nested_maybe.txt index 16ade25e630..e8e714e59e5 100644 --- a/crates/compiler/test_mono/generated/when_nested_maybe.txt +++ b/crates/compiler/test_mono/generated/when_nested_maybe.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.19 : I64 = 41i64; diff --git a/crates/compiler/test_mono/generated/when_on_record.txt b/crates/compiler/test_mono/generated/when_on_record.txt index 603b2ad8a38..18381ca0433 100644 --- a/crates/compiler/test_mono/generated/when_on_record.txt +++ b/crates/compiler/test_mono/generated/when_on_record.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.5 : I64 = 2i64; diff --git a/crates/compiler/test_mono/generated/when_on_two_values.txt b/crates/compiler/test_mono/generated/when_on_two_values.txt index 03b76fff036..76a1f733391 100644 --- a/crates/compiler/test_mono/generated/when_on_two_values.txt +++ b/crates/compiler/test_mono/generated/when_on_two_values.txt @@ -1,6 +1,6 @@ procedure Num.19 (#Attr.2, #Attr.3): - let Num.297 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; - ret Num.297; + let Num.257 : I64 = lowlevel NumAdd #Attr.2 #Attr.3; + ret Num.257; procedure Test.0 (): let Test.15 : I64 = 3i64; 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 d491b9f6cff..67e1dcc1c82 100644 --- a/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt +++ b/crates/compiler/uitest/tests/ability/specialize/inspect/opaque_automatic.txt @@ -8,50 +8,50 @@ main = 1 # -emit:mono -procedure Inspect.253 (Inspect.254): - let Inspect.321 : Str = ""; - let Inspect.320 : Str = CallByName Inspect.61 Inspect.254 Inspect.321; - ret Inspect.320; - -procedure Inspect.30 (Inspect.148): - ret Inspect.148; - -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; - -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; +procedure Inspect.248 (Inspect.249): + let Inspect.313 : Str = ""; + let Inspect.312 : Str = CallByName Inspect.59 Inspect.249 Inspect.313; + ret Inspect.312; + +procedure Inspect.30 (Inspect.143): + ret Inspect.143; + +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; + +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; + +procedure Inspect.44 (Inspect.295): + let Inspect.310 : {} = Struct {}; + let Inspect.309 : {} = CallByName Inspect.30 Inspect.310; + ret Inspect.309; + +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {} = CallByName Inspect.44 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Inspect.248 Inspect.304; + ret Inspect.303; + +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.315 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; ret Inspect.315; -procedure Inspect.45 (Inspect.303): - let Inspect.318 : {} = Struct {}; - let Inspect.317 : {} = CallByName Inspect.30 Inspect.318; - ret Inspect.317; - -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {} = CallByName Inspect.45 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Inspect.253 Inspect.312; - ret Inspect.311; - -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.323 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.323; - -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.0 (): let Test.4 : {} = Struct {}; - let Test.2 : Str = CallByName Inspect.34 Test.4; + let Test.2 : Str = CallByName Inspect.33 Test.4; dbg Test.2; dec Test.2; let Test.3 : I64 = 1i64; 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 13fea846b36..212898ee56c 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 @@ -11,49 +11,49 @@ main = late (@Op {}) # -emit:mono -procedure Inspect.253 (Inspect.254): - let Inspect.321 : Str = ""; - let Inspect.320 : Str = CallByName Inspect.61 Inspect.254 Inspect.321; - ret Inspect.320; +procedure Inspect.248 (Inspect.249): + let Inspect.313 : Str = ""; + let Inspect.312 : Str = CallByName Inspect.59 Inspect.249 Inspect.313; + ret Inspect.312; -procedure Inspect.30 (Inspect.148): - ret Inspect.148; +procedure Inspect.30 (Inspect.143): + ret Inspect.143; -procedure Inspect.34 (Inspect.153): - let Inspect.309 : Str = CallByName Inspect.5 Inspect.153; - let Inspect.308 : Str = CallByName Inspect.62 Inspect.309; - ret Inspect.308; +procedure Inspect.33 (Inspect.148): + let Inspect.301 : Str = CallByName Inspect.5 Inspect.148; + let Inspect.300 : Str = CallByName Inspect.60 Inspect.301; + ret Inspect.300; -procedure Inspect.36 (Inspect.305): - let Inspect.315 : Str = ""; - ret Inspect.315; +procedure Inspect.35 (Inspect.297): + let Inspect.307 : Str = ""; + ret Inspect.307; -procedure Inspect.45 (Inspect.303): - let Inspect.318 : {} = Struct {}; - let Inspect.317 : {} = CallByName Inspect.30 Inspect.318; - ret Inspect.317; +procedure Inspect.44 (Inspect.295): + let Inspect.310 : {} = Struct {}; + let Inspect.309 : {} = CallByName Inspect.30 Inspect.310; + ret Inspect.309; -procedure Inspect.5 (Inspect.151): - let Inspect.316 : {} = CallByName Inspect.45 Inspect.151; - let Inspect.313 : {} = Struct {}; - let Inspect.312 : Str = CallByName Inspect.36 Inspect.313; - let Inspect.311 : Str = CallByName Inspect.253 Inspect.312; - ret Inspect.311; +procedure Inspect.5 (Inspect.146): + let Inspect.308 : {} = CallByName Inspect.44 Inspect.146; + let Inspect.305 : {} = Struct {}; + let Inspect.304 : Str = CallByName Inspect.35 Inspect.305; + let Inspect.303 : Str = CallByName Inspect.248 Inspect.304; + ret Inspect.303; -procedure Inspect.61 (Inspect.304, Inspect.300): - let Inspect.323 : Str = CallByName Str.3 Inspect.304 Inspect.300; - dec Inspect.300; - ret Inspect.323; +procedure Inspect.59 (Inspect.296, Inspect.292): + let Inspect.315 : Str = CallByName Str.3 Inspect.296 Inspect.292; + dec Inspect.292; + ret Inspect.315; -procedure Inspect.62 (Inspect.306): - ret Inspect.306; +procedure Inspect.60 (Inspect.298): + ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.249; procedure Test.2 (Test.3): - let Test.4 : Str = CallByName Inspect.34 Test.3; + let Test.4 : Str = CallByName Inspect.33 Test.3; dbg Test.4; dec Test.4; let Test.7 : I64 = 1i64; diff --git a/crates/compiler/uitest/tests/recursion/generalization_among_large_recursive_group.txt b/crates/compiler/uitest/tests/recursion/generalization_among_large_recursive_group.txt index 2070f3f20b3..2b36a017b16 100644 --- a/crates/compiler/uitest/tests/recursion/generalization_among_large_recursive_group.txt +++ b/crates/compiler/uitest/tests/recursion/generalization_among_large_recursive_group.txt @@ -3,22 +3,22 @@ app "test" provides [main] to "./platform" f = \{} -> -#^{-1} <2937><117>{} -<120>[[f(1)]]-> <116>[Ok <2945>{}]<80>* +#^{-1} <2897><113>{} -<116>[[f(1)]]-> <112>[Ok <2905>{}]<76>* when g {} is -# ^ <2927><2945>{} -<2935>[[g(2)]]-> <72>[Ok <2945>{}]<102>* +# ^ <2887><2905>{} -<2895>[[g(2)]]-> <68>[Ok <2905>{}]<98>* _ -> Ok {} g = \{} -> -#^{-1} <2927><2945>{} -<2935>[[g(2)]]-> <72>[Ok <2945>{}]<102>* +#^{-1} <2887><2905>{} -<2895>[[g(2)]]-> <68>[Ok <2905>{}]<98>* when h {} is -# ^ <2932><2945>{} -<2940>[[h(3)]]-> <94>[Ok <2945>{}]<124>* +# ^ <2892><2905>{} -<2900>[[h(3)]]-> <90>[Ok <2905>{}]<120>* _ -> Ok {} h = \{} -> -#^{-1} <2932><2945>{} -<2940>[[h(3)]]-> <94>[Ok <2945>{}]<124>* +#^{-1} <2892><2905>{} -<2900>[[h(3)]]-> <90>[Ok <2905>{}]<120>* when f {} is -# ^ <2937><117>{} -<120>[[f(1)]]-> <116>[Ok <2945>{}]<80>* +# ^ <2897><113>{} -<116>[[f(1)]]-> <112>[Ok <2905>{}]<76>* _ -> Ok {} main = f {} -# ^ <2947><133>{} -<136>[[f(1)]]-> <138>[Ok <2945>{}]<2946>w_a +# ^ <2907><129>{} -<132>[[f(1)]]-> <134>[Ok <2905>{}]<2906>w_a diff --git a/crates/compiler/uitest/tests/solve/to_int.txt b/crates/compiler/uitest/tests/solve/to_int.txt index d965bdbe07f..6aeb375ae71 100644 --- a/crates/compiler/uitest/tests/solve/to_int.txt +++ b/crates/compiler/uitest/tests/solve/to_int.txt @@ -15,4 +15,4 @@ entry = } main = entry -# ^^^^^ { toI128 : Int * -[[Num.toI128(125)]]-> I128, toI16 : Int w_a -[[Num.toI16(119)]]-> I16, toI32 : Int w_b -[[Num.toI32(121)]]-> I32, toI64 : Int w_c -[[Num.toI64(123)]]-> I64, toI8 : Int w_d -[[Num.toI8(117)]]-> I8, toU128 : Int w_f -[[Num.toU128(135)]]-> U128, toU16 : Int w_g -[[Num.toU16(129)]]-> U16, toU32 : Int w_h -[[Num.toU32(131)]]-> U32, toU64 : Int w_i -[[Num.toU64(133)]]-> U64, toU8 : Int w_j -[[Num.toU8(127)]]-> U8 } +# ^^^^^ { toI128 : Int * -[[Num.toI128(125)]]-> I128, toI16 : Int w_a -[[Num.toI16(119)]]-> I16, toI32 : Int w_b -[[Num.toI32(121)]]-> I32, toI64 : Int w_c -[[Num.toI64(123)]]-> I64, toI8 : Int w_d -[[Num.toI8(117)]]-> I8, toU128 : Int w_e -[[Num.toU128(135)]]-> U128, toU16 : Int w_f -[[Num.toU16(129)]]-> U16, toU32 : Int w_g -[[Num.toU32(131)]]-> U32, toU64 : Int w_h -[[Num.toU64(133)]]-> U64, toU8 : Int w_i -[[Num.toU8(127)]]-> U8 } From aa720af599f1ce71b5a042f53dcb83347d62d1d3 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 26 Jan 2024 16:28:23 -0500 Subject: [PATCH 48/80] Update parse-movies-csv example to basic-cli 0.8.1 --- examples/parser/parse-movies-csv.roc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/parser/parse-movies-csv.roc b/examples/parser/parse-movies-csv.roc index e3c2153680d..10705e91ef8 100644 --- a/examples/parser/parse-movies-csv.roc +++ b/examples/parser/parse-movies-csv.roc @@ -1,6 +1,6 @@ app "example" packages { - pf: "https://github.com/roc-lang/basic-cli/releases/download/0.7.1/Icc3xJoIixF3hCcfXrDwLCu4wQHtNdPyoJkEbkgIElA.tar.br", + pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5/KB-TITJ4DfunB88sFBWjCtCGV7LRRDdTH5JUXp4gIb8.tar.br", } imports [ From 33152819f7e5495f8f41af3517d757dca86a2830 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 26 Jan 2024 19:57:00 -0500 Subject: [PATCH 49/80] Upgrade roc-parser in examples --- examples/parser/letter-counts.roc | 2 +- examples/parser/parse-movies-csv.roc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/parser/letter-counts.roc b/examples/parser/letter-counts.roc index e34d2f7555a..838b48aa316 100644 --- a/examples/parser/letter-counts.roc +++ b/examples/parser/letter-counts.roc @@ -1,7 +1,7 @@ app "example" packages { cli: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", - parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5/KB-TITJ4DfunB88sFBWjCtCGV7LRRDdTH5JUXp4gIb8.tar.br", + parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5.2/9VrPjwfQQ1QeSL3CfmWr2Pr9DESdDIXy97pwpuq84Ck.tar.br", } imports [ cli.Stdout, diff --git a/examples/parser/parse-movies-csv.roc b/examples/parser/parse-movies-csv.roc index 10705e91ef8..0610d74b724 100644 --- a/examples/parser/parse-movies-csv.roc +++ b/examples/parser/parse-movies-csv.roc @@ -1,7 +1,7 @@ app "example" packages { pf: "https://github.com/roc-lang/basic-cli/releases/download/0.8.1/x8URkvfyi9I0QhmVG98roKBUs_AZRkLFwFJVJ3942YA.tar.br", - parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5/KB-TITJ4DfunB88sFBWjCtCGV7LRRDdTH5JUXp4gIb8.tar.br", + parser: "https://github.com/lukewilliamboswell/roc-parser/releases/download/0.5.2/9VrPjwfQQ1QeSL3CfmWr2Pr9DESdDIXy97pwpuq84Ck.tar.br", } imports [ pf.Stdout, From 62ec6ad8eaf9b726d427c3e3b95cc98b1008d64e Mon Sep 17 00:00:00 2001 From: Luke Boswell Date: Sat, 27 Jan 2024 13:43:29 +1100 Subject: [PATCH 50/80] fix glue InternalTypeId.roc --- crates/glue/platform/InternalTypeId.roc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/glue/platform/InternalTypeId.roc b/crates/glue/platform/InternalTypeId.roc index bae9254837b..3b23a32ff73 100644 --- a/crates/glue/platform/InternalTypeId.roc +++ b/crates/glue/platform/InternalTypeId.roc @@ -2,10 +2,10 @@ interface InternalTypeId exposes [InternalTypeId, fromU64, toU64] imports [] -InternalTypeId : U64 +InternalTypeId := U64 -toU64 := InternalTypeId -> U64 +toU64 : InternalTypeId -> U64 toU64 = \@InternalTypeId x -> x fromU64 : U64 -> InternalTypeId -fromU64 = \x -> @InternalTypeId x +fromU64 = @InternalTypeId From be5c538763ed5ee37fec4135319feab9b33c2753 Mon Sep 17 00:00:00 2001 From: Luke Boswell Date: Sun, 28 Jan 2024 10:57:43 +1100 Subject: [PATCH 51/80] fix glue TypeId --- crates/glue/platform/InternalTypeId.roc | 11 ----------- crates/glue/platform/TypeId.roc | 12 +++++++++--- crates/glue/platform/Types.roc | 16 ++++++++-------- crates/glue/src/RustGlue.roc | 10 ++++++++-- 4 files changed, 25 insertions(+), 24 deletions(-) delete mode 100644 crates/glue/platform/InternalTypeId.roc diff --git a/crates/glue/platform/InternalTypeId.roc b/crates/glue/platform/InternalTypeId.roc deleted file mode 100644 index 3b23a32ff73..00000000000 --- a/crates/glue/platform/InternalTypeId.roc +++ /dev/null @@ -1,11 +0,0 @@ -interface InternalTypeId - exposes [InternalTypeId, fromU64, toU64] - imports [] - -InternalTypeId := U64 - -toU64 : InternalTypeId -> U64 -toU64 = \@InternalTypeId x -> x - -fromU64 : U64 -> InternalTypeId -fromU64 = @InternalTypeId diff --git a/crates/glue/platform/TypeId.roc b/crates/glue/platform/TypeId.roc index 18e1b887760..e5e4f1f93a5 100644 --- a/crates/glue/platform/TypeId.roc +++ b/crates/glue/platform/TypeId.roc @@ -1,5 +1,11 @@ interface TypeId - exposes [TypeId] - imports [InternalTypeId.{ InternalTypeId }] + exposes [TypeId, fromU64, toU64] + imports [] -TypeId : InternalTypeId +TypeId := U64 implements [Eq, Hash] + +toU64 : TypeId -> U64 +toU64 = \@TypeId x -> x + +fromU64 : U64 -> TypeId +fromU64 = @TypeId diff --git a/crates/glue/platform/Types.roc b/crates/glue/platform/Types.roc index f62c7814fb2..ae9e2751d44 100644 --- a/crates/glue/platform/Types.roc +++ b/crates/glue/platform/Types.roc @@ -1,6 +1,6 @@ interface Types exposes [Types, shape, size, alignment, target, walkShapes, entryPoints] - imports [Shape.{ Shape }, TypeId.{ TypeId }, Target.{ Target }, InternalTypeId] + imports [Shape.{ Shape }, TypeId.{ TypeId }, Target.{ Target }, TypeId] # TODO: switch AssocList uses to Dict once roc_std is updated. Tuple1 : [T Str TypeId] @@ -34,33 +34,33 @@ entryPoints = \@Types { entrypoints } -> entrypoints walkShapes : Types, state, (state, Shape, TypeId -> state) -> state walkShapes = \@Types { types: shapes }, originalState, update -> List.walkWithIndex shapes originalState \state, elem, index -> - id = InternalTypeId.fromU64 index + id = TypeId.fromU64 index update state elem id shape : Types, TypeId -> Shape shape = \@Types types, id -> - when List.get types.types (InternalTypeId.toU64 id) is + when List.get types.types (TypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toU64 id) + idStr = Num.toStr (TypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " alignment : Types, TypeId -> U32 alignment = \@Types types, id -> - when List.get types.aligns (InternalTypeId.toU64 id) is + when List.get types.aligns (TypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toU64 id) + idStr = Num.toStr (TypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " size : Types, TypeId -> U32 size = \@Types types, id -> - when List.get types.sizes (InternalTypeId.toU64 id) is + when List.get types.sizes (TypeId.toU64 id) is Ok answer -> answer Err OutOfBounds -> - idStr = Num.toStr (InternalTypeId.toU64 id) + idStr = Num.toStr (TypeId.toU64 id) crash "TypeId #\(idStr) was not found in Types. This should never happen, and means there was a bug in `roc glue`. If you have time, please open an issue at " diff --git a/crates/glue/src/RustGlue.roc b/crates/glue/src/RustGlue.roc index 286ec345564..fc39ce7088f 100644 --- a/crates/glue/src/RustGlue.roc +++ b/crates/glue/src/RustGlue.roc @@ -1360,12 +1360,18 @@ generateUnionField = \types -> commaSeparated : Str, List a, (a, U64 -> Str) -> Str commaSeparated = \buf, items, step -> - length = List.len items - List.walk items { buf, count: 0 } \accum, item -> + + length = List.len items |> Num.intCast + + help : { buf : Str, count : U64 }, a -> { buf : Str, count : U64 } + help = \accum, item -> if accum.count + 1 == length then { buf: Str.concat accum.buf (step item accum.count), count: length } else { buf: Str.concat accum.buf (step item accum.count) |> Str.concat ", ", count: accum.count + 1 } + + items + |> List.walk { buf, count: 0 } help |> .buf generateNullableUnwrapped : Str, Types, TypeId, Str, Str, Str, TypeId, [FirstTagIsNull, SecondTagIsNull] -> Str From 2985f4c277799e633fcf3ee09f2760ea2bb6c46b Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 28 Jan 2024 14:55:11 -0500 Subject: [PATCH 52/80] Fix bad merge --- www/content/tutorial.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/www/content/tutorial.md b/www/content/tutorial.md index 7310e3326b6..442a3df459f 100644 --- a/www/content/tutorial.md +++ b/www/content/tutorial.md @@ -1423,16 +1423,8 @@ These modules are not ordinary `.roc` files that live on your filesystem. Rather Besides being built into the compiler, the builtin modules are different from other modules in that: -<<<<<<< HEAD - -- They are always imported. You never need to add them to `imports`. -- All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module). - ||||||| parent of cda0cfb47 (Remove Nat from documentation) -- They are always imported. You never need to add them to `imports`. -- # All their types are imported unqualified automatically. So you never need to write `Num.Nat`, because it's as if the `Num` module was imported using `imports [Num.{ Nat }]` (the same is true for all the other types in the `Num` module. - They are always imported. You never need to add them to `imports`. -- All their types are imported unqualified automatically. So you never need to write `Num.Dec`, because it's as if the `Num` module was imported using `imports [Num.{ Dec }]` (the same is true for all the other types in the `Num` module. - > > > > > > > cda0cfb47 (Remove Nat from documentation) +- All their types are imported unqualified automatically. So you never need to write `Num.Dec`, because it's as if the `Num` module was imported using `imports [Num.{ Dec }]` (the same is true for all the other types in the `Num` module.) ### [App Module Header](#app-module-header) {#app-module-header} From d84de324d84d1924872fd4b47c5d341b4d4008a9 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 28 Jan 2024 14:56:50 -0500 Subject: [PATCH 53/80] Update insta tests --- crates/compiler/load/tests/test_reporting.rs | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/crates/compiler/load/tests/test_reporting.rs b/crates/compiler/load/tests/test_reporting.rs index 267a258abdc..0b54d93edc2 100644 --- a/crates/compiler/load/tests/test_reporting.rs +++ b/crates/compiler/load/tests/test_reporting.rs @@ -5640,7 +5640,7 @@ All branches in an `if` must have the same type! Num.if " ), - @r" + @r###" ── NOT EXPOSED in /code/proj/Main.roc ────────────────────────────────────────── The Num module does not expose `if`: @@ -5652,9 +5652,9 @@ All branches in an `if` must have the same type! Num.sin Num.div - Num.min Num.e - " + Num.pi + "### ); test_report!( @@ -5790,7 +5790,7 @@ All branches in an `if` must have the same type! ["foo", bar("")] "# ), - @r#" + @r###" ── UNRECOGNIZED NAME in /code/proj/Main.roc ──────────────────────────────────── Nothing is named `bar` in this scope. @@ -5800,11 +5800,11 @@ All branches in an `if` must have the same type! Did you mean one of these? - Nat Str Err U8 - "# + F64 + "### ); test_report!( @@ -6822,7 +6822,7 @@ In roc, functions are always written as a lambda, like{} C a b : a -> D a b D a b : { a, b } - f : C a Num.Nat -> D a Num.Nat + f : C a U64 -> D a U64 f = \c -> c 6 f " @@ -7572,7 +7572,7 @@ In roc, functions are always written as a lambda, like{} But `get` needs its 2nd argument to be: - Nat + U64 " ); @@ -7598,7 +7598,7 @@ In roc, functions are always written as a lambda, like{} But `get` needs its 2nd argument to be: - Nat + U64 " ); @@ -7625,7 +7625,7 @@ In roc, functions are always written as a lambda, like{} But `get` needs its 2nd argument to be: - Nat + U64 " ); @@ -8215,7 +8215,7 @@ In roc, functions are always written as a lambda, like{} invalid_record_extension_type, indoc!( r" - f : { x : Num.Nat }[] + f : { x : U64 }[] f " ), @@ -8224,8 +8224,8 @@ In roc, functions are always written as a lambda, like{} This record extension type is invalid: - 4│ f : { x : Num.Nat }[] - ^^ + 4│ f : { x : U64 }[] + ^^ Note: A record extension variable can only contain a type variable or another record. @@ -11751,7 +11751,7 @@ In roc, functions are always written as a lambda, like{} The argument is a Unicode scalar value of type: - U16, I32, U32, I64, Nat, U64, I128, or U128 + U16, I32, U32, I64, U64, I128, or U128 But `contains` needs its 2nd argument to be: @@ -11808,7 +11808,7 @@ In roc, functions are always written as a lambda, like{} But the branch patterns have type: - U16, I32, U32, I64, Nat, U64, I128, or U128 + U16, I32, U32, I64, U64, I128, or U128 The branches must be cases of the `when` condition's type! "# From b21e75e3599338ff2888c4648b36c767c92339be Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 28 Jan 2024 15:16:41 -0500 Subject: [PATCH 54/80] Remove a `nat` suffix --- crates/compiler/test_gen/src/gen_erased.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/compiler/test_gen/src/gen_erased.rs b/crates/compiler/test_gen/src/gen_erased.rs index 396f72a06c4..76dfb5a04c9 100644 --- a/crates/compiler/test_gen/src/gen_erased.rs +++ b/crates/compiler/test_gen/src/gen_erased.rs @@ -32,7 +32,7 @@ fn multi_branch_capturing() { f = \t, s -> if t - then \{} -> 15nat + then \{} -> 15u64 else \{} -> Str.countUtf8Bytes s main = ((f Bool.true "abc") {}, (f Bool.false "abc") {}) From 3be96e52d8234209d8f826e33d01c99a4b5bcbad Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 28 Jan 2024 16:35:57 -0500 Subject: [PATCH 55/80] roc format --- crates/compiler/builtins/roc/Dict.roc | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/compiler/builtins/roc/Dict.roc b/crates/compiler/builtins/roc/Dict.roc index 2280b92d3f7..ee82d213fea 100644 --- a/crates/compiler/builtins/roc/Dict.roc +++ b/crates/compiler/builtins/roc/Dict.roc @@ -1185,7 +1185,6 @@ expect |> len |> Bool.isEq 0 - # All BadKey's hash to the same location. # This is needed to test some robinhood logic. BadKey := U64 implements [ From 0681929d6d177b406baff380cb0614a2d519ca97 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 28 Jan 2024 17:34:47 -0500 Subject: [PATCH 56/80] Update snapshot syntax tests --- .../number_literal_suffixes.expr.result-ast | 132 +++++++++--------- 1 file changed, 66 insertions(+), 66 deletions(-) diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast index c67fcc468a4..9fafa599ed8 100644 --- a/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast +++ b/crates/compiler/test_syntax/tests/snapshots/pass/number_literal_suffixes.expr.result-ast @@ -121,11 +121,11 @@ Record( Newline, ], ), - @180-192 SpaceBefore( + @164-176 SpaceBefore( RequiredValue( - @180-183 "dec", + @164-167 "dec", [], - @186-192 Num( + @170-176 Num( "123dec", ), ), @@ -133,11 +133,11 @@ Record( Newline, ], ), - @196-211 SpaceBefore( + @180-195 SpaceBefore( RequiredValue( - @196-201 "u8Neg", + @180-185 "u8Neg", [], - @205-211 Num( + @189-195 Num( "-123u8", ), ), @@ -145,11 +145,11 @@ Record( Newline, ], ), - @215-231 SpaceBefore( + @199-215 SpaceBefore( RequiredValue( - @215-221 "u16Neg", + @199-205 "u16Neg", [], - @224-231 Num( + @208-215 Num( "-123u16", ), ), @@ -157,11 +157,11 @@ Record( Newline, ], ), - @235-251 SpaceBefore( + @219-235 SpaceBefore( RequiredValue( - @235-241 "u32Neg", + @219-225 "u32Neg", [], - @244-251 Num( + @228-235 Num( "-123u32", ), ), @@ -169,11 +169,11 @@ Record( Newline, ], ), - @255-271 SpaceBefore( + @239-255 SpaceBefore( RequiredValue( - @255-261 "u64Neg", + @239-245 "u64Neg", [], - @264-271 Num( + @248-255 Num( "-123u64", ), ), @@ -181,11 +181,11 @@ Record( Newline, ], ), - @275-292 SpaceBefore( + @259-276 SpaceBefore( RequiredValue( - @275-282 "u128Neg", + @259-266 "u128Neg", [], - @284-292 Num( + @268-276 Num( "-123u128", ), ), @@ -193,11 +193,11 @@ Record( Newline, ], ), - @296-311 SpaceBefore( + @280-295 SpaceBefore( RequiredValue( - @296-301 "i8Neg", + @280-285 "i8Neg", [], - @305-311 Num( + @289-295 Num( "-123i8", ), ), @@ -205,11 +205,11 @@ Record( Newline, ], ), - @315-331 SpaceBefore( + @299-315 SpaceBefore( RequiredValue( - @315-321 "i16Neg", + @299-305 "i16Neg", [], - @324-331 Num( + @308-315 Num( "-123i16", ), ), @@ -217,11 +217,11 @@ Record( Newline, ], ), - @335-351 SpaceBefore( + @319-335 SpaceBefore( RequiredValue( - @335-341 "i32Neg", + @319-325 "i32Neg", [], - @344-351 Num( + @328-335 Num( "-123i32", ), ), @@ -229,11 +229,11 @@ Record( Newline, ], ), - @355-371 SpaceBefore( + @339-355 SpaceBefore( RequiredValue( - @355-361 "i64Neg", + @339-345 "i64Neg", [], - @364-371 Num( + @348-355 Num( "-123i64", ), ), @@ -241,11 +241,11 @@ Record( Newline, ], ), - @375-392 SpaceBefore( + @359-376 SpaceBefore( RequiredValue( - @375-382 "i128Neg", + @359-366 "i128Neg", [], - @384-392 Num( + @368-376 Num( "-123i128", ), ), @@ -253,11 +253,11 @@ Record( Newline, ], ), - @416-432 SpaceBefore( + @380-396 SpaceBefore( RequiredValue( - @416-422 "decNeg", + @380-386 "decNeg", [], - @425-432 Num( + @389-396 Num( "-123dec", ), ), @@ -265,11 +265,11 @@ Record( Newline, ], ), - @436-452 SpaceBefore( + @400-416 SpaceBefore( RequiredValue( - @436-441 "u8Bin", + @400-405 "u8Bin", [], - @445-452 NonBase10Int { + @409-416 NonBase10Int { string: "101u8", base: Binary, is_negative: false, @@ -279,11 +279,11 @@ Record( Newline, ], ), - @456-473 SpaceBefore( + @420-437 SpaceBefore( RequiredValue( - @456-462 "u16Bin", + @420-426 "u16Bin", [], - @465-473 NonBase10Int { + @429-437 NonBase10Int { string: "101u16", base: Binary, is_negative: false, @@ -293,11 +293,11 @@ Record( Newline, ], ), - @477-494 SpaceBefore( + @441-458 SpaceBefore( RequiredValue( - @477-483 "u32Bin", + @441-447 "u32Bin", [], - @486-494 NonBase10Int { + @450-458 NonBase10Int { string: "101u32", base: Binary, is_negative: false, @@ -307,11 +307,11 @@ Record( Newline, ], ), - @498-515 SpaceBefore( + @462-479 SpaceBefore( RequiredValue( - @498-504 "u64Bin", + @462-468 "u64Bin", [], - @507-515 NonBase10Int { + @471-479 NonBase10Int { string: "101u64", base: Binary, is_negative: false, @@ -321,11 +321,11 @@ Record( Newline, ], ), - @519-537 SpaceBefore( + @483-501 SpaceBefore( RequiredValue( - @519-526 "u128Bin", + @483-490 "u128Bin", [], - @528-537 NonBase10Int { + @492-501 NonBase10Int { string: "101u128", base: Binary, is_negative: false, @@ -335,11 +335,11 @@ Record( Newline, ], ), - @541-557 SpaceBefore( + @505-521 SpaceBefore( RequiredValue( - @541-546 "i8Bin", + @505-510 "i8Bin", [], - @550-557 NonBase10Int { + @514-521 NonBase10Int { string: "101i8", base: Binary, is_negative: false, @@ -349,11 +349,11 @@ Record( Newline, ], ), - @561-578 SpaceBefore( + @525-542 SpaceBefore( RequiredValue( - @561-567 "i16Bin", + @525-531 "i16Bin", [], - @570-578 NonBase10Int { + @534-542 NonBase10Int { string: "101i16", base: Binary, is_negative: false, @@ -363,11 +363,11 @@ Record( Newline, ], ), - @582-599 SpaceBefore( + @546-563 SpaceBefore( RequiredValue( - @582-588 "i32Bin", + @546-552 "i32Bin", [], - @591-599 NonBase10Int { + @555-563 NonBase10Int { string: "101i32", base: Binary, is_negative: false, @@ -377,11 +377,11 @@ Record( Newline, ], ), - @603-620 SpaceBefore( + @567-584 SpaceBefore( RequiredValue( - @603-609 "i64Bin", + @567-573 "i64Bin", [], - @612-620 NonBase10Int { + @576-584 NonBase10Int { string: "101i64", base: Binary, is_negative: false, @@ -391,11 +391,11 @@ Record( Newline, ], ), - @624-642 SpaceBefore( + @588-606 SpaceBefore( RequiredValue( - @624-631 "i128Bin", + @588-595 "i128Bin", [], - @633-642 NonBase10Int { + @597-606 NonBase10Int { string: "101i128", base: Binary, is_negative: false, From cc7b9def5ee441d85843c51bbad828ca3da5b8e1 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Mon, 29 Jan 2024 06:44:41 -0500 Subject: [PATCH 57/80] Update some string interpolation tests --- crates/repl_test/src/tests.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/repl_test/src/tests.rs b/crates/repl_test/src/tests.rs index e68d4f13df5..920ed8e98ec 100644 --- a/crates/repl_test/src/tests.rs +++ b/crates/repl_test/src/tests.rs @@ -1419,7 +1419,7 @@ fn interpolation_with_nested_strings() { expect_success( indoc!( r#" - "foo \(Str.joinWith ["a", "b", "c"] ", ") bar" + "foo $(Str.joinWith ["a", "b", "c"] ", ") bar" "# ), r#""foo a, b, c bar" : Str"#, @@ -1431,7 +1431,7 @@ fn interpolation_with_num_to_str() { expect_success( indoc!( r#" - "foo \(Num.toStr Num.maxI8) bar" + "foo $(Num.toStr Num.maxI8) bar" "# ), r#""foo 127 bar" : Str"#, @@ -1443,7 +1443,7 @@ fn interpolation_with_operator_desugaring() { expect_success( indoc!( r#" - "foo \(Num.toStr (1 + 2)) bar" + "foo $(Num.toStr (1 + 2)) bar" "# ), r#""foo 3 bar" : Str"#, @@ -1458,7 +1458,7 @@ fn interpolation_with_nested_interpolation() { expect_failure( indoc!( r#" - "foo \(Str.joinWith ["a\(Num.toStr 5)", "b"] "c")" + "foo $(Str.joinWith ["a\(Num.toStr 5)", "b"] "c")" "# ), indoc!( @@ -1467,7 +1467,7 @@ fn interpolation_with_nested_interpolation() { This string interpolation is invalid: - 4│ "foo \(Str.joinWith ["a\(Num.toStr 5)", "b"] "c")" + 4│ "foo $(Str.joinWith ["a\(Num.toStr 5)", "b"] "c")" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ String interpolations cannot contain newlines or other interpolations. From 0b42a902aba8dd6382067531b2022826bc28a787 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 31 Jan 2024 20:29:17 -0500 Subject: [PATCH 58/80] Have List.withCapacity lowlevel use u64 over usize --- crates/compiler/builtins/bitcode/src/list.zig | 2 +- crates/compiler/gen_llvm/src/llvm/expect.rs | 28 ++++++++----------- crates/compiler/gen_wasm/src/low_level.rs | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index 4ffafeb2284..bc95fa43d61 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -472,7 +472,7 @@ pub fn listMap4( } pub fn listWithCapacity( - capacity: usize, + capacity: u64, alignment: u32, element_width: usize, ) callconv(.C) RocList { diff --git a/crates/compiler/gen_llvm/src/llvm/expect.rs b/crates/compiler/gen_llvm/src/llvm/expect.rs index 4cfeab970d4..b1e8b5f9c0e 100644 --- a/crates/compiler/gen_llvm/src/llvm/expect.rs +++ b/crates/compiler/gen_llvm/src/llvm/expect.rs @@ -978,22 +978,18 @@ fn build_clone_builtin<'a, 'ctx>( cursors.extra_offset } - Builtin::Str => { - // - - call_str_bitcode_fn( - env, - &[value], - &[ - ptr.into(), - cursors.offset.into(), - cursors.extra_offset.into(), - ], - crate::llvm::bitcode::BitcodeReturns::Basic, - bitcode::STR_CLONE_TO, - ) - .into_int_value() - } + Builtin::Str => call_str_bitcode_fn( + env, + &[value], + &[ + ptr.into(), + cursors.offset.into(), + cursors.extra_offset.into(), + ], + crate::llvm::bitcode::BitcodeReturns::Basic, + bitcode::STR_CLONE_TO, + ) + .into_int_value(), Builtin::List(elem) => { let bd = env.builder; diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 6ecf9791622..c8e5bdeec26 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -459,7 +459,7 @@ impl<'a> LowLevelCall<'a> { // Zig arguments Wasm types // (return pointer) i32 - // capacity: usize i32 + // capacity: u64 i64 // alignment: u32 i32 // element_width: usize i32 From 6a6c25d32dceca4ff3511c347dad2c2cec5890fd Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Thu, 1 Feb 2024 21:30:40 -0500 Subject: [PATCH 59/80] Update some docs and names --- crates/compiler/gen_llvm/src/llvm/build_list.rs | 6 +++--- crates/compiler/gen_llvm/src/llvm/compare.rs | 6 +++--- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/build_list.rs b/crates/compiler/gen_llvm/src/llvm/build_list.rs index 643e5502747..c475a171251 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_list.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_list.rs @@ -250,7 +250,7 @@ pub(crate) fn list_prepend<'a, 'ctx>( ) } -/// List.swap : List elem, U64,U64 -> List elem +/// List.swap : List elem, U64, U64 -> List elem pub(crate) fn list_swap<'a, 'ctx>( env: &Env<'a, 'ctx, '_>, layout_interner: &STLayoutInterner<'a>, @@ -425,8 +425,8 @@ fn bounds_check_comparison<'ctx>( builder.new_build_int_compare(IntPredicate::ULT, elem_index, len, "bounds_check") } -/// List.len : List * -> usize (return value will be cast to usize in user-facing API) -pub(crate) fn list_len<'ctx>( +/// List.len : List * -> usize (return value will be cast to U64 in user-facing API) +pub(crate) fn list_len_usize<'ctx>( builder: &Builder<'ctx>, wrapper_struct: StructValue<'ctx>, ) -> IntValue<'ctx> { diff --git a/crates/compiler/gen_llvm/src/llvm/compare.rs b/crates/compiler/gen_llvm/src/llvm/compare.rs index de9ac950737..3d1b5e771bc 100644 --- a/crates/compiler/gen_llvm/src/llvm/compare.rs +++ b/crates/compiler/gen_llvm/src/llvm/compare.rs @@ -1,5 +1,5 @@ use crate::llvm::build::{get_tag_id, tag_pointer_clear_tag_id, Env, FAST_CALL_CONV}; -use crate::llvm::build_list::{list_len, load_list_ptr}; +use crate::llvm::build_list::{list_len_usize, load_list_ptr}; use crate::llvm::build_str::str_equal; use crate::llvm::convert::basic_type_from_layout; use bumpalo::collections::Vec; @@ -510,8 +510,8 @@ fn build_list_eq_help<'a, 'ctx>( // first, check whether the length is equal - let len1 = list_len(env.builder, list1); - let len2 = list_len(env.builder, list2); + let len1 = list_len_usize(env.builder, list1); + let len2 = list_len_usize(env.builder, list2); let length_equal: IntValue = env.builder diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 5fcb5b2263f..b236637e2fa 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -34,10 +34,10 @@ use crate::llvm::{ BuilderExt, FuncBorrowSpec, RocReturn, }, build_list::{ - layout_width, list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, list_len, - list_map, list_map2, list_map3, list_map4, list_prepend, list_release_excess_capacity, - list_replace_unsafe, list_reserve, list_sort_with, list_sublist, list_swap, - list_symbol_to_c_abi, list_with_capacity, pass_update_mode, + layout_width, list_append_unsafe, list_concat, list_drop_at, list_get_unsafe, + list_len_usize, list_map, list_map2, list_map3, list_map4, list_prepend, + list_release_excess_capacity, list_replace_unsafe, list_reserve, list_sort_with, + list_sublist, list_swap, list_symbol_to_c_abi, list_with_capacity, pass_update_mode, }, compare::{generic_eq, generic_neq}, convert::{ @@ -621,7 +621,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( // List.len : List * -> U64 arguments!(list); - let len_usize = list_len(env.builder, list.into_struct_value()); + let len_usize = list_len_usize(env.builder, list.into_struct_value()); // List.len returns U64, although length is stored as usize env.builder From 50ea255703b974560e6b8af438fcd88b10c63b6d Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 11 Feb 2024 12:21:50 -0500 Subject: [PATCH 60/80] Fix some tests that were expecting usize over u64 --- crates/compiler/test_gen/src/gen_dict.rs | 4 ++-- crates/compiler/test_gen/src/gen_erased.rs | 2 +- crates/compiler/test_gen/src/gen_num.rs | 8 ++++---- crates/compiler/test_gen/src/gen_primitives.rs | 4 +++- crates/compiler/test_gen/src/gen_refcount.rs | 4 ++-- crates/compiler/test_gen/src/gen_set.rs | 4 ++-- crates/compiler/test_gen/src/gen_str.rs | 10 +++++----- crates/compiler/test_gen/src/gen_tags.rs | 7 +++++-- crates/compiler/test_gen/src/wasm_str.rs | 6 +++--- 9 files changed, 27 insertions(+), 22 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_dict.rs b/crates/compiler/test_gen/src/gen_dict.rs index 933991fc8a2..a9d71357405 100644 --- a/crates/compiler/test_gen/src/gen_dict.rs +++ b/crates/compiler/test_gen/src/gen_dict.rs @@ -25,7 +25,7 @@ fn dict_empty_len() { " ), 0, - usize + u64 ); } @@ -41,7 +41,7 @@ fn dict_insert_empty() { " ), 1, - usize + u64 ); } diff --git a/crates/compiler/test_gen/src/gen_erased.rs b/crates/compiler/test_gen/src/gen_erased.rs index 76dfb5a04c9..de2dd7fb5b0 100644 --- a/crates/compiler/test_gen/src/gen_erased.rs +++ b/crates/compiler/test_gen/src/gen_erased.rs @@ -39,6 +39,6 @@ fn multi_branch_capturing() { "# ), (15, 3), - (usize, usize) + (u64, u64) ); } diff --git a/crates/compiler/test_gen/src/gen_num.rs b/crates/compiler/test_gen/src/gen_num.rs index bf6839827f9..367a78bfdc4 100644 --- a/crates/compiler/test_gen/src/gen_num.rs +++ b/crates/compiler/test_gen/src/gen_num.rs @@ -26,7 +26,7 @@ fn u64_alias() { " ), 1, - usize + u64 ); } @@ -3076,7 +3076,7 @@ fn monomorphized_ints() { " ), 18, - usize + u64 ) } @@ -3095,7 +3095,7 @@ fn monomorphized_floats() { " ), 18, - usize + u64 ) } @@ -3119,7 +3119,7 @@ fn monomorphized_ints_names_dont_conflict() { " ), 18, - usize + u64 ) } diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index 19507282732..fdb806801d6 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -1367,6 +1367,8 @@ fn linked_list_is_empty_2() { #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] fn linked_list_singleton() { // verifies only that valid llvm is produced + + use std::os::raw::c_void; assert_evals_to!( indoc!( r#" @@ -1379,7 +1381,7 @@ fn linked_list_singleton() { "# ), 0, - usize, + *const c_void, |_| 0 ); } diff --git a/crates/compiler/test_gen/src/gen_refcount.rs b/crates/compiler/test_gen/src/gen_refcount.rs index de2c8463805..bc1e29266b8 100644 --- a/crates/compiler/test_gen/src/gen_refcount.rs +++ b/crates/compiler/test_gen/src/gen_refcount.rs @@ -75,7 +75,7 @@ fn list_int_dealloc() { List.len [list, list, list] "# ), - usize, + u64, &[ Deallocated, // list Deallocated // result @@ -114,7 +114,7 @@ fn list_str_dealloc() { List.len [list, list] "# ), - usize, + u64, &[ Deallocated, // s Deallocated, // list diff --git a/crates/compiler/test_gen/src/gen_set.rs b/crates/compiler/test_gen/src/gen_set.rs index 1e26b3bda16..d3571ad965f 100644 --- a/crates/compiler/test_gen/src/gen_set.rs +++ b/crates/compiler/test_gen/src/gen_set.rs @@ -25,7 +25,7 @@ fn empty_len() { " ), 0, - usize + u64 ); } @@ -39,7 +39,7 @@ fn single_len() { " ), 1, - usize + u64 ); } diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index 3d9dee49a30..66f863ad252 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -59,7 +59,7 @@ fn str_split_empty_delimiter() { "# ), 1, - usize + u64 ); assert_evals_to!( @@ -75,7 +75,7 @@ fn str_split_empty_delimiter() { "# ), 3, - usize + u64 ); } @@ -89,7 +89,7 @@ fn str_split_bigger_delimiter_small_str() { "# ), 1, - usize + u64 ); assert_evals_to!( @@ -105,7 +105,7 @@ fn str_split_bigger_delimiter_small_str() { "# ), 3, - usize + u64 ); } @@ -244,7 +244,7 @@ fn str_split_small_str_big_delimiter() { "# ), 3, - usize + u64 ); assert_evals_to!( diff --git a/crates/compiler/test_gen/src/gen_tags.rs b/crates/compiler/test_gen/src/gen_tags.rs index 2e32ebe8c82..71bd6b53eda 100644 --- a/crates/compiler/test_gen/src/gen_tags.rs +++ b/crates/compiler/test_gen/src/gen_tags.rs @@ -13,6 +13,9 @@ use crate::helpers::wasm::assert_evals_to; #[cfg(test)] use indoc::indoc; +#[cfg(test)] +use std::os::raw::c_void; + use roc_mono::layout::{LayoutRepr, STLayoutInterner}; #[cfg(test)] use roc_std::{RocList, RocStr, U128}; @@ -1019,7 +1022,7 @@ fn nested_recursive_literal() { #" ), 0, - usize, + *const c_void, |_| 0 ); } @@ -1161,7 +1164,7 @@ fn recursive_tag_union_into_flat_tag_union() { "# ), 0, - usize, + *const c_void, |_| 0 ) } diff --git a/crates/compiler/test_gen/src/wasm_str.rs b/crates/compiler/test_gen/src/wasm_str.rs index 4b0ca42c6bc..4628683d81e 100644 --- a/crates/compiler/test_gen/src/wasm_str.rs +++ b/crates/compiler/test_gen/src/wasm_str.rs @@ -23,7 +23,7 @@ fn str_split_empty_delimiter() { "# ), 1, - usize + u64 ); } @@ -36,7 +36,7 @@ fn str_split_bigger_delimiter_small_str() { "# ), 1, - usize + u64 ); } @@ -176,7 +176,7 @@ fn str_split_small_str_big_delimiter() { "# ), 3, - usize + u64 ); assert_evals_to!( From ca8f83b8968c0c2114974bcbbfcb0b8b7aaa441c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 11 Feb 2024 12:35:37 -0500 Subject: [PATCH 61/80] Use usize instead of pointer type for wasm tests --- crates/compiler/test_gen/src/gen_primitives.rs | 3 +-- crates/compiler/test_gen/src/gen_tags.rs | 7 ++----- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_primitives.rs b/crates/compiler/test_gen/src/gen_primitives.rs index ae59a57918e..77ddba776eb 100644 --- a/crates/compiler/test_gen/src/gen_primitives.rs +++ b/crates/compiler/test_gen/src/gen_primitives.rs @@ -1368,7 +1368,6 @@ fn linked_list_is_empty_2() { fn linked_list_singleton() { // verifies only that valid llvm is produced - use std::os::raw::c_void; assert_evals_to!( indoc!( r#" @@ -1381,7 +1380,7 @@ fn linked_list_singleton() { "# ), 0, - *const c_void, + usize, |_| 0 ); } diff --git a/crates/compiler/test_gen/src/gen_tags.rs b/crates/compiler/test_gen/src/gen_tags.rs index 71bd6b53eda..2e32ebe8c82 100644 --- a/crates/compiler/test_gen/src/gen_tags.rs +++ b/crates/compiler/test_gen/src/gen_tags.rs @@ -13,9 +13,6 @@ use crate::helpers::wasm::assert_evals_to; #[cfg(test)] use indoc::indoc; -#[cfg(test)] -use std::os::raw::c_void; - use roc_mono::layout::{LayoutRepr, STLayoutInterner}; #[cfg(test)] use roc_std::{RocList, RocStr, U128}; @@ -1022,7 +1019,7 @@ fn nested_recursive_literal() { #" ), 0, - *const c_void, + usize, |_| 0 ); } @@ -1164,7 +1161,7 @@ fn recursive_tag_union_into_flat_tag_union() { "# ), 0, - *const c_void, + usize, |_| 0 ) } From b2ce7e5fcfeaf75672fd7485c30d00943b017379 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 09:26:22 -0500 Subject: [PATCH 62/80] Rearrange where usize -> u64 conversions happen --- crates/compiler/builtins/bitcode/src/main.zig | 10 ++--- crates/compiler/builtins/bitcode/src/str.zig | 39 +++++++++++++------ crates/compiler/gen_wasm/src/low_level.rs | 4 +- crates/compiler/test_gen/src/gen_str.rs | 2 +- 4 files changed, 35 insertions(+), 20 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/main.zig b/crates/compiler/builtins/bitcode/src/main.zig index a258feb2669..9070a36be3b 100644 --- a/crates/compiler/builtins/bitcode/src/main.zig +++ b/crates/compiler/builtins/bitcode/src/main.zig @@ -192,17 +192,17 @@ comptime { exportStrFn(str.strJoinWithC, "joinWith"); exportStrFn(str.strNumberOfBytes, "number_of_bytes"); exportStrFn(str.strEqual, "equal"); - exportStrFn(str.substringUnsafe, "substring_unsafe"); - exportStrFn(str.getUnsafe, "get_unsafe"); - exportStrFn(str.reserve, "reserve"); + exportStrFn(str.substringUnsafeC, "substring_unsafe"); + exportStrFn(str.getUnsafeC, "get_unsafe"); + exportStrFn(str.reserveC, "reserve"); exportStrFn(str.strToUtf8C, "to_utf8"); exportStrFn(str.fromUtf8RangeC, "from_utf8_range"); - exportStrFn(str.repeat, "repeat"); + exportStrFn(str.repeatC, "repeat"); exportStrFn(str.strTrim, "trim"); exportStrFn(str.strTrimStart, "trim_start"); exportStrFn(str.strTrimEnd, "trim_end"); exportStrFn(str.strCloneTo, "clone_to"); - exportStrFn(str.withCapacity, "with_capacity"); + exportStrFn(str.withCapacityC, "with_capacity"); exportStrFn(str.strAllocationPtr, "allocation_ptr"); exportStrFn(str.strReleaseExcessCapacity, "release_excess_capacity"); diff --git a/crates/compiler/builtins/bitcode/src/str.zig b/crates/compiler/builtins/bitcode/src/str.zig index ca46dce32bd..31c5d0b48df 100644 --- a/crates/compiler/builtins/bitcode/src/str.zig +++ b/crates/compiler/builtins/bitcode/src/str.zig @@ -1146,10 +1146,14 @@ pub fn getCapacity(string: RocStr) callconv(.C) usize { return string.getCapacity(); } -pub fn substringUnsafe(string: RocStr, start_u64: u64, length_u64: u64) callconv(.C) RocStr { +pub fn substringUnsafeC(string: RocStr, start_u64: u64, length_u64: u64) callconv(.C) RocStr { const start: usize = @intCast(start_u64); const length: usize = @intCast(length_u64); + return substringUnsafe(string, start, length); +} + +fn substringUnsafe(string: RocStr, start: usize, length: usize) RocStr { if (string.isSmallStr()) { if (start == 0) { var output = string; @@ -1181,7 +1185,7 @@ pub fn substringUnsafe(string: RocStr, start_u64: u64, length_u64: u64) callconv return RocStr.empty(); } -pub fn getUnsafe(string: RocStr, index: u64) callconv(.C) u8 { +pub fn getUnsafeC(string: RocStr, index: u64) callconv(.C) u8 { return string.getUnchecked(@intCast(index)); } @@ -1245,7 +1249,7 @@ pub fn startsWith(string: RocStr, prefix: RocStr) callconv(.C) bool { } // Str.repeat -pub fn repeat(string: RocStr, count_u64: u64) callconv(.C) RocStr { +pub fn repeatC(string: RocStr, count_u64: u64) callconv(.C) RocStr { const count: usize = @intCast(count_u64); const bytes_len = string.len(); const bytes_ptr = string.asU8ptr(); @@ -1514,17 +1518,24 @@ const CountAndStart = extern struct { pub fn fromUtf8RangeC( list: RocList, - start: u64, - count: u64, + start_u64: u64, + count_u64: u64, update_mode: UpdateMode, ) callconv(.C) FromUtf8Result { - return fromUtf8Range(list, start, count, update_mode); + return fromUtf8Range(list, @intCast(start_u64), @intCast(count_u64), update_mode); } -pub fn fromUtf8Range(arg: RocList, start_u64: u64, count_u64: u64, update_mode: UpdateMode) FromUtf8Result { - const start: usize = @intCast(start_u64); - const count: usize = @intCast(count_u64); +test "fromUtf8RangeC(\"hello\", 1, 3)" { + const original_bytes = "hello"; + const list = RocList.fromSlice(u8, original_bytes[0..]); + const result = fromUtf8RangeC(list, 1, 3, UpdateMode.Immutable); + + try expectEqual(result.is_ok, true); + result.string.decref(); +} + +pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: UpdateMode) FromUtf8Result { if (arg.len() == 0 or count == 0) { arg.decref(RocStr.alignment); return FromUtf8Result{ @@ -2374,9 +2385,12 @@ test "capacity: big string" { try expect(data.getCapacity() >= data_bytes.len); } -pub fn reserve(string: RocStr, spare_u64: u64) callconv(.C) RocStr { +pub fn reserveC(string: RocStr, spare_u64: u64) callconv(.C) RocStr { + return reserve(string, @intCast(spare_u64)); +} + +fn reserve(string: RocStr, spare: usize) RocStr { const old_length = string.len(); - const spare: usize = @intCast(spare_u64); if (string.getCapacity() >= old_length + spare) { return string; @@ -2387,11 +2401,12 @@ pub fn reserve(string: RocStr, spare_u64: u64) callconv(.C) RocStr { } } -pub fn withCapacity(capacity: u64) callconv(.C) RocStr { +pub fn withCapacityC(capacity: u64) callconv(.C) RocStr { var str = RocStr.allocate(@intCast(capacity)); str.setLen(0); return str; } + pub fn strCloneTo( string: RocStr, ptr: [*]u8, diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 3180caca46c..43f746894f4 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -232,8 +232,8 @@ impl<'a> LowLevelCall<'a> { output: *FromUtf8Result i32 arg: RocList i32 - start i32 - count i32 + start i64 + count i64 update_mode: UpdateMode i32 */ diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index 66f863ad252..80245fe4b96 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -965,7 +965,7 @@ fn str_from_utf8_range_order_does_not_matter() { bytes = Str.toUtf8 "hello" when Str.fromUtf8Range bytes { start: 1, count: 3 } is Ok utf8String -> utf8String - _ -> "" + Err _ -> "Str.fromUtf8Range returned Err instead of Ok!" "# ), RocStr::from("ell"), From e8a0b0930d3fd29415449c8c43b6396e2d2ca28b Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 12:50:13 -0500 Subject: [PATCH 63/80] Fix some usize -> u64 in List patterns --- .../compiler/gen_llvm/src/llvm/build_str.rs | 11 +++++----- crates/compiler/mono/src/ir/decision_tree.rs | 15 ++++--------- crates/compiler/mono/src/ir/pattern.rs | 21 +++++++------------ 3 files changed, 17 insertions(+), 30 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/build_str.rs b/crates/compiler/gen_llvm/src/llvm/build_str.rs index 2e1af6f89b5..7e23c88e03f 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_str.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_str.rs @@ -13,12 +13,11 @@ pub(crate) fn decode_from_utf8_result<'a, 'ctx>( layout_interner: &STLayoutInterner<'a>, pointer: PointerValue<'ctx>, ) -> BasicValueEnum<'ctx> { - let layout = LayoutRepr::Struct(env.arena.alloc([ - Layout::usize(env.target_info), - Layout::STR, - Layout::BOOL, - Layout::U8, - ])); + let layout = + LayoutRepr::Struct( + env.arena + .alloc([Layout::U64, Layout::STR, Layout::BOOL, Layout::U8]), + ); load_roc_value( env, diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index 745d2cae123..878c2e09776 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1779,10 +1779,8 @@ fn test_to_comparison<'a>( let real_len = env.unique_symbol(); let test_len = env.unique_symbol(); - let usize_layout = Layout::usize(env.target_info); - - stores.push((real_len, usize_layout, real_len_expr)); - stores.push((test_len, usize_layout, test_len_expr)); + stores.push((real_len, Layout::U64, real_len_expr)); + stores.push((test_len, Layout::U64, test_len_expr)); let comparison = match bound { ListLenBound::Exact => (real_len, Comparator::Eq, test_len), @@ -2337,7 +2335,7 @@ fn decide_to_branching<'a>( let len_symbol = env.unique_symbol(); let switch = Stmt::Switch { - cond_layout: Layout::usize(env.target_info), + cond_layout: Layout::U64, cond_symbol: len_symbol, branches: branches.into_bump_slice(), default_branch: (default_branch_info, env.arena.alloc(default_branch)), @@ -2352,12 +2350,7 @@ fn decide_to_branching<'a>( arguments: env.arena.alloc([inner_cond_symbol]), }); - Stmt::Let( - len_symbol, - len_expr, - Layout::usize(env.target_info), - env.arena.alloc(switch), - ) + Stmt::Let(len_symbol, len_expr, Layout::U64, env.arena.alloc(switch)) } else { Stmt::Switch { cond_layout: inner_cond_layout, diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index 38ebdcfe04d..0f132d4eec6 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1397,15 +1397,12 @@ pub(crate) fn build_list_index_probe<'a>( list_sym: Symbol, list_index: &ListIndex, ) -> (Symbol, impl DoubleEndedIterator>) { - let usize_layout = Layout::usize(env.target_info); - let list_index = list_index.0; let index_sym = env.unique_symbol(); let (opt_len_store, opt_offset_store, index_store) = if list_index >= 0 { let index_expr = Expr::Literal(Literal::Int((list_index as i128).to_ne_bytes())); - - let index_store = (index_sym, usize_layout, index_expr); + let index_store = (index_sym, Layout::U64, index_expr); (None, None, index_store) } else { @@ -1430,9 +1427,9 @@ pub(crate) fn build_list_index_probe<'a>( arguments: env.arena.alloc([len_sym, offset_sym]), }); - let len_store = (len_sym, usize_layout, len_expr); - let offset_store = (offset_sym, usize_layout, offset_expr); - let index_store = (index_sym, usize_layout, index_expr); + let len_store = (len_sym, Layout::U64, len_expr); + let offset_store = (offset_sym, Layout::U64, offset_expr); + let index_store = (index_sym, Layout::U64, index_expr); (Some(len_store), Some(offset_store), index_store) }; @@ -1560,8 +1557,6 @@ fn store_list_rest<'a>( if let Some((index, Some(rest_sym))) = opt_rest { is_productive = true; - let usize_layout = Layout::usize(env.target_info); - let total_dropped = list_arity.min_len(); let total_dropped_sym = env.unique_symbol(); @@ -1596,10 +1591,10 @@ fn store_list_rest<'a>( arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]), }); let needed_stores = [ - (total_dropped_sym, total_dropped_expr, usize_layout), - (list_len_sym, list_len_expr, usize_layout), - (rest_len_sym, rest_len_expr, usize_layout), - (start_sym, start_expr, usize_layout), + (total_dropped_sym, total_dropped_expr, Layout::U64), + (list_len_sym, list_len_expr, Layout::U64), + (rest_len_sym, rest_len_expr, Layout::U64), + (start_sym, start_expr, Layout::U64), (*rest_sym, rest_expr, list_layout), ]; for (sym, expr, lay) in needed_stores.into_iter().rev() { From 5fe9c0d7a375ca219920c495ee5f5a78214bfcd7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 12:58:42 -0500 Subject: [PATCH 64/80] Remove obsolete wasm-specific test cfg --- crates/compiler/test_gen/src/gen_str.rs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index 80245fe4b96..a759d48be58 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -1752,7 +1752,6 @@ fn str_walk_utf8() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] fn str_walk_utf8_with_index() { - #[cfg(not(feature = "gen-llvm-wasm"))] assert_evals_to!( indoc!( r#" @@ -1762,17 +1761,6 @@ fn str_walk_utf8_with_index() { RocList::from_slice(&[(0, b'a'), (1, b'b'), (2, b'c'), (3, b'd')]), RocList<(u64, u8)> ); - - #[cfg(feature = "gen-llvm-wasm")] - assert_evals_to!( - indoc!( - r#" - Str.walkUtf8WithIndex "abcd" [] (\list, byte, index -> List.append list (Pair index byte)) - "# - ), - RocList::from_slice(&[(0, 'a'), (1, 'b'), (2, 'c'), (3, 'd')]), - RocList<(u32, char)> - ); } #[test] From 47b7ff73650ad9cef509d3a51decaa695a1917d7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 19:48:51 -0500 Subject: [PATCH 65/80] Auto-collapse generated mono stuff on GitHub diffs --- .gitattributes | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitattributes b/.gitattributes index f15056f5a74..9943d78c230 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,4 @@ -# Require roc files to be checlked out with Unix line endings, even on windows +# Require roc files to be checked out with Unix line endings, even on windows *.roc text eol=lf + +crates/compiler/test_mono/generated/* linguist-generated=true From d378a14414fd814fcb07b74d422d2b7390dfc7e7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 19:49:11 -0500 Subject: [PATCH 66/80] Minor zig refactor --- crates/compiler/builtins/bitcode/src/list.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/compiler/builtins/bitcode/src/list.zig b/crates/compiler/builtins/bitcode/src/list.zig index bc95fa43d61..c8fdcccaa9d 100644 --- a/crates/compiler/builtins/bitcode/src/list.zig +++ b/crates/compiler/builtins/bitcode/src/list.zig @@ -641,7 +641,7 @@ pub fn listSublist( if (list.bytes) |source_ptr| { // This cast is lossless because we would have early-returned already // if `start_u64` were greater than `size`, and `size` fits in usize. - const start = @as(usize, @intCast(start_u64)); + const start: usize = @intCast(start_u64); const drop_start_len = start; // (size - start) can't overflow because we would have early-returned already @@ -721,7 +721,7 @@ pub fn listDropAt( // This cast must be lossless, because we would have just early-returned if drop_index // were >= than `size`, and we know `size` fits in usize. - const drop_index = @as(usize, @intCast(drop_index_u64)); + const drop_index: usize = @intCast(drop_index_u64); const element = source_ptr + drop_index * element_width; dec(element); From a62234cb0b174f224413c0719c9ac764a4ba7dfa Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Tue, 13 Feb 2024 19:49:23 -0500 Subject: [PATCH 67/80] Delete some trailing spaces --- flake.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 501b00eeea8..fa419b0a02f 100644 --- a/flake.nix +++ b/flake.nix @@ -19,7 +19,7 @@ inputs.flake-utils.follows = "flake-utils"; }; - # for non flake backwards compatibility + # for non flake backwards compatibility flake-compat = { url = "github:edolstra/flake-compat"; flake = false; @@ -45,7 +45,7 @@ inherit (compile-deps) zigPkg llvmPkgs llvmVersion llvmMajorMinorStr glibcPath libGccSPath darwinInputs; - # DevInputs are not necessary to build roc as a user + # DevInputs are not necessary to build roc as a user linuxDevInputs = with pkgs; lib.optionals stdenv.isLinux [ valgrind # used in cli tests, see cli/tests/cli_run.rs @@ -60,7 +60,7 @@ xorg.libxcb ]; - # DevInputs are not necessary to build roc as a user + # DevInputs are not necessary to build roc as a user darwinDevInputs = with pkgs; lib.optionals stdenv.isDarwin (with pkgs.darwin.apple_sdk.frameworks; [ From adfaefd4b7d71e48198307e64ac9d985f17672cd Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 13:43:49 -0500 Subject: [PATCH 68/80] Fix some more usize -> u64 in gen tests --- crates/compiler/test_gen/src/gen_list.rs | 44 ++++++++++++------------ 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_list.rs b/crates/compiler/test_gen/src/gen_list.rs index b5b61157ada..e7b15284fe7 100644 --- a/crates/compiler/test_gen/src/gen_list.rs +++ b/crates/compiler/test_gen/src/gen_list.rs @@ -1074,7 +1074,7 @@ fn list_walk_implements_position() { Some v -> v ", 2, - usize + u64 ); } @@ -1221,7 +1221,7 @@ fn list_count_if_empty_list() { " ), 0, - usize + u64 ); } @@ -1243,7 +1243,7 @@ fn list_count_if_always_true_for_non_empty_list() { " ), 8, - usize + u64 ); } @@ -1261,7 +1261,7 @@ fn list_count_if_always_false_for_non_empty_list() { " ), 0, - usize + u64 ); } @@ -1279,7 +1279,7 @@ fn list_count_if_condition() { " ), 2, - usize + u64 ); } @@ -1293,7 +1293,7 @@ fn list_count_if_str() { "# ), 2, - usize + u64 ); } @@ -1943,13 +1943,13 @@ fn list_concat_large() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] fn empty_list_len() { - assert_evals_to!("List.len []", 0, usize); + assert_evals_to!("List.len []", 0, u64); } #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))] fn basic_int_list_len() { - assert_evals_to!("List.len [12, 9, 6, 3]", 4, usize); + assert_evals_to!("List.len [12, 9, 6, 3]", 4, u64); } #[test] @@ -1964,7 +1964,7 @@ fn loaded_int_list_len() { " ), 3, - usize + u64 ); } @@ -1982,7 +1982,7 @@ fn fn_int_list_len() { " ), 4, - usize + u64 ); } @@ -2402,7 +2402,7 @@ fn gen_wrap_len() { " ), RocList::from_slice(&[3]), - RocList + RocList ); } @@ -2715,7 +2715,7 @@ fn empty_list_increment_decrement() { " ), 0, - usize + u64 ); } @@ -2732,7 +2732,7 @@ fn list_literal_increment_decrement() { " ), 6, - usize + u64 ); } @@ -3319,7 +3319,7 @@ fn list_find_index() { "# ), 1, - usize + u64 ); assert_evals_to!( @@ -3331,7 +3331,7 @@ fn list_find_index() { "# ), 2, - usize + u64 ); } @@ -3347,7 +3347,7 @@ fn list_find_index_not_found() { "# ), 999, - usize + u64 ); assert_evals_to!( @@ -3359,7 +3359,7 @@ fn list_find_index_not_found() { "# ), 999, - usize + u64 ); } @@ -3375,7 +3375,7 @@ fn list_find_index_empty_typed_list() { " ), 999, - usize + u64 ); assert_evals_to!( @@ -3387,7 +3387,7 @@ fn list_find_index_empty_typed_list() { " ), 999, - usize + u64 ); } @@ -3562,7 +3562,7 @@ fn monomorphized_lists() { " ), 18, - usize + u64 ) } @@ -3785,7 +3785,7 @@ fn list_infer_usage() { "# ), 1, - usize + u64 ); } @@ -3813,7 +3813,7 @@ fn list_walk_backwards_implements_position() { Some v -> v ", 0, - usize + u64 ); } From 3aec2a9182c18fed15130da9822fd40120d205f2 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 13:47:26 -0500 Subject: [PATCH 69/80] Address some unused warnings --- crates/compiler/test_gen/src/gen_abilities.rs | 16 ++++++---------- crates/compiler/test_gen/src/gen_erased.rs | 1 + crates/compiler/test_gen/src/helpers/dev.rs | 1 - 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/crates/compiler/test_gen/src/gen_abilities.rs b/crates/compiler/test_gen/src/gen_abilities.rs index 03889c74e15..d1e3e864321 100644 --- a/crates/compiler/test_gen/src/gen_abilities.rs +++ b/crates/compiler/test_gen/src/gen_abilities.rs @@ -12,8 +12,6 @@ use roc_std::RocList; #[cfg(all(test, any(feature = "gen-llvm", feature = "gen-wasm")))] use roc_std::RocStr; -use crate::helpers::with_larger_debug_stack; - #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn hash_specialization() { @@ -937,7 +935,7 @@ fn encode_derived_generic_tag_with_different_field_types() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn specialize_unique_newtype_records() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" @@ -1060,12 +1058,10 @@ mod decode_immediate { #[cfg(all(test, feature = "gen-llvm"))] use roc_std::RocStr; - use crate::helpers::with_larger_debug_stack; - #[test] #[cfg(feature = "gen-llvm")] fn string() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" @@ -1187,7 +1183,7 @@ mod decode_immediate { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn decode_list_of_strings() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" @@ -1208,7 +1204,7 @@ fn decode_list_of_strings() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn encode_then_decode_list_of_strings() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" @@ -1230,7 +1226,7 @@ fn encode_then_decode_list_of_strings() { #[cfg(feature = "gen-llvm")] #[ignore = "#3696: Currently hits some weird panic in borrow checking, not sure if it's directly related to abilities."] fn encode_then_decode_list_of_lists_of_strings() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" @@ -2149,7 +2145,7 @@ mod eq { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))] fn issue_4772_weakened_monomorphic_destructure() { - with_larger_debug_stack(|| { + crate::helpers::with_larger_debug_stack(|| { assert_evals_to!( indoc!( r#" diff --git a/crates/compiler/test_gen/src/gen_erased.rs b/crates/compiler/test_gen/src/gen_erased.rs index de2dd7fb5b0..de089d30979 100644 --- a/crates/compiler/test_gen/src/gen_erased.rs +++ b/crates/compiler/test_gen/src/gen_erased.rs @@ -1,6 +1,7 @@ #[cfg(feature = "gen-llvm")] use crate::helpers::llvm::assert_evals_to_erased; +#[cfg(feature = "gen-llvm")] use indoc::indoc; #[test] diff --git a/crates/compiler/test_gen/src/helpers/dev.rs b/crates/compiler/test_gen/src/helpers/dev.rs index f5f2c2687f3..fe148d121cb 100644 --- a/crates/compiler/test_gen/src/helpers/dev.rs +++ b/crates/compiler/test_gen/src/helpers/dev.rs @@ -1,6 +1,5 @@ use libloading::Library; use roc_build::link::{link, LinkType}; -use roc_builtins::bitcode; use roc_load::{EntryPoint, ExecutionMode, LoadConfig, Threading}; use roc_mono::ir::CrashTag; use roc_mono::ir::SingleEntryPoint; From c2ab73c11559b457bfe9619e11dbeb56edbe63fb Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 20:16:28 -0500 Subject: [PATCH 70/80] Add a TODO comment for later --- crates/compiler/mono/src/ir/decision_tree.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index 878c2e09776..b18a2324aed 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1779,6 +1779,11 @@ fn test_to_comparison<'a>( let real_len = env.unique_symbol(); let test_len = env.unique_symbol(); + // TODO if we make a LowLevel for getting list lenth that returns + // usize, then we could use usize here instead of u64, which + // would be slightly more efficient on 32-bit targets. + // Would let us change Layout::U64 to Layout::usize(env.target_info) + // in here and in various related places that also rely on list length. stores.push((real_len, Layout::U64, real_len_expr)); stores.push((test_len, Layout::U64, test_len_expr)); From 30712d352a2de8b3eefcc808ee0131cdc7a224ab Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 20:16:39 -0500 Subject: [PATCH 71/80] Silence some unused test macro warnings --- crates/compiler/test_gen/src/helpers/llvm.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/compiler/test_gen/src/helpers/llvm.rs b/crates/compiler/test_gen/src/helpers/llvm.rs index 7ecbb0ebd50..f6d7b9f7a54 100644 --- a/crates/compiler/test_gen/src/helpers/llvm.rs +++ b/crates/compiler/test_gen/src/helpers/llvm.rs @@ -628,6 +628,7 @@ macro_rules! assert_llvm_evals_to { // // let (_main_fn_name, _delayed_errors, _module) = // $crate::helpers::llvm::create_llvm_module(&arena, $src, config, &context, &target); +#[allow(unused_macros)] macro_rules! assert_evals_to { ($src:expr, $expected:expr, $ty:ty) => {{ assert_evals_to!($src, $expected, $ty, $crate::helpers::llvm::identity, false); From a15cc0589cb81ad2ce74a16e874220626b140f90 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 20:17:14 -0500 Subject: [PATCH 72/80] Revert "Fix some usize -> u64 in List patterns" This reverts commit e8a0b0930d3fd29415449c8c43b6396e2d2ca28b. --- .../compiler/gen_llvm/src/llvm/build_str.rs | 11 +++++----- crates/compiler/mono/src/ir/decision_tree.rs | 20 ++++++++++-------- crates/compiler/mono/src/ir/pattern.rs | 21 ++++++++++++------- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/build_str.rs b/crates/compiler/gen_llvm/src/llvm/build_str.rs index 7e23c88e03f..2e1af6f89b5 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_str.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_str.rs @@ -13,11 +13,12 @@ pub(crate) fn decode_from_utf8_result<'a, 'ctx>( layout_interner: &STLayoutInterner<'a>, pointer: PointerValue<'ctx>, ) -> BasicValueEnum<'ctx> { - let layout = - LayoutRepr::Struct( - env.arena - .alloc([Layout::U64, Layout::STR, Layout::BOOL, Layout::U8]), - ); + let layout = LayoutRepr::Struct(env.arena.alloc([ + Layout::usize(env.target_info), + Layout::STR, + Layout::BOOL, + Layout::U8, + ])); load_roc_value( env, diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index b18a2324aed..745d2cae123 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1779,13 +1779,10 @@ fn test_to_comparison<'a>( let real_len = env.unique_symbol(); let test_len = env.unique_symbol(); - // TODO if we make a LowLevel for getting list lenth that returns - // usize, then we could use usize here instead of u64, which - // would be slightly more efficient on 32-bit targets. - // Would let us change Layout::U64 to Layout::usize(env.target_info) - // in here and in various related places that also rely on list length. - stores.push((real_len, Layout::U64, real_len_expr)); - stores.push((test_len, Layout::U64, test_len_expr)); + let usize_layout = Layout::usize(env.target_info); + + stores.push((real_len, usize_layout, real_len_expr)); + stores.push((test_len, usize_layout, test_len_expr)); let comparison = match bound { ListLenBound::Exact => (real_len, Comparator::Eq, test_len), @@ -2340,7 +2337,7 @@ fn decide_to_branching<'a>( let len_symbol = env.unique_symbol(); let switch = Stmt::Switch { - cond_layout: Layout::U64, + cond_layout: Layout::usize(env.target_info), cond_symbol: len_symbol, branches: branches.into_bump_slice(), default_branch: (default_branch_info, env.arena.alloc(default_branch)), @@ -2355,7 +2352,12 @@ fn decide_to_branching<'a>( arguments: env.arena.alloc([inner_cond_symbol]), }); - Stmt::Let(len_symbol, len_expr, Layout::U64, env.arena.alloc(switch)) + Stmt::Let( + len_symbol, + len_expr, + Layout::usize(env.target_info), + env.arena.alloc(switch), + ) } else { Stmt::Switch { cond_layout: inner_cond_layout, diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index 0f132d4eec6..38ebdcfe04d 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1397,12 +1397,15 @@ pub(crate) fn build_list_index_probe<'a>( list_sym: Symbol, list_index: &ListIndex, ) -> (Symbol, impl DoubleEndedIterator>) { + let usize_layout = Layout::usize(env.target_info); + let list_index = list_index.0; let index_sym = env.unique_symbol(); let (opt_len_store, opt_offset_store, index_store) = if list_index >= 0 { let index_expr = Expr::Literal(Literal::Int((list_index as i128).to_ne_bytes())); - let index_store = (index_sym, Layout::U64, index_expr); + + let index_store = (index_sym, usize_layout, index_expr); (None, None, index_store) } else { @@ -1427,9 +1430,9 @@ pub(crate) fn build_list_index_probe<'a>( arguments: env.arena.alloc([len_sym, offset_sym]), }); - let len_store = (len_sym, Layout::U64, len_expr); - let offset_store = (offset_sym, Layout::U64, offset_expr); - let index_store = (index_sym, Layout::U64, index_expr); + let len_store = (len_sym, usize_layout, len_expr); + let offset_store = (offset_sym, usize_layout, offset_expr); + let index_store = (index_sym, usize_layout, index_expr); (Some(len_store), Some(offset_store), index_store) }; @@ -1557,6 +1560,8 @@ fn store_list_rest<'a>( if let Some((index, Some(rest_sym))) = opt_rest { is_productive = true; + let usize_layout = Layout::usize(env.target_info); + let total_dropped = list_arity.min_len(); let total_dropped_sym = env.unique_symbol(); @@ -1591,10 +1596,10 @@ fn store_list_rest<'a>( arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]), }); let needed_stores = [ - (total_dropped_sym, total_dropped_expr, Layout::U64), - (list_len_sym, list_len_expr, Layout::U64), - (rest_len_sym, rest_len_expr, Layout::U64), - (start_sym, start_expr, Layout::U64), + (total_dropped_sym, total_dropped_expr, usize_layout), + (list_len_sym, list_len_expr, usize_layout), + (rest_len_sym, rest_len_expr, usize_layout), + (start_sym, start_expr, usize_layout), (*rest_sym, rest_expr, list_layout), ]; for (sym, expr, lay) in needed_stores.into_iter().rev() { From ada83561e590b57444b4df57ce84d88c8c4e0f2f Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Wed, 14 Feb 2024 20:41:52 -0500 Subject: [PATCH 73/80] Split ListLen into ListLenU64 and ListLenUsize The usize one gets used internally for things like pattern matches. This is both more efficient (means they don't have to do unnecessary casts) and also less error-prone due to e.g. comparing length to capacity, which is usize. --- crates/compiler/alias_analysis/src/lib.rs | 2 +- crates/compiler/can/src/builtins.rs | 3 +- crates/compiler/gen_dev/src/generic64/mod.rs | 9 +++- .../compiler/gen_dev/src/generic64/storage.rs | 7 ++- crates/compiler/gen_dev/src/lib.rs | 21 ++++++-- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 8 ++- crates/compiler/gen_wasm/src/low_level.rs | 50 +++++++++++-------- crates/compiler/load_internal/src/file.rs | 4 +- crates/compiler/module/src/low_level.rs | 6 ++- crates/compiler/module/src/symbol.rs | 3 +- .../mono/src/code_gen_help/equality.rs | 4 +- .../mono/src/code_gen_help/refcount.rs | 2 +- .../compiler/mono/src/drop_specialization.rs | 4 +- crates/compiler/mono/src/inc_dec.rs | 2 +- crates/compiler/mono/src/ir/decision_tree.rs | 4 +- crates/compiler/mono/src/ir/pattern.rs | 4 +- crates/compiler/mono/src/low_level.rs | 3 +- 17 files changed, 88 insertions(+), 48 deletions(-) diff --git a/crates/compiler/alias_analysis/src/lib.rs b/crates/compiler/alias_analysis/src/lib.rs index 0880d41c34d..fbc50997da8 100644 --- a/crates/compiler/alias_analysis/src/lib.rs +++ b/crates/compiler/alias_analysis/src/lib.rs @@ -1121,7 +1121,7 @@ fn lowlevel_spec<'a>( // just dream up a unit value builder.add_make_tuple(block, &[]) } - ListLen => { + ListLenUsize | ListLenU64 => { // TODO should this touch the heap cell? // just dream up a unit value builder.add_make_tuple(block, &[]) diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index a67ac6c221a..3223ebb6f3e 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -129,7 +129,8 @@ map_symbol_to_lowlevel_and_arity! { StrWithCapacity; STR_WITH_CAPACITY; 1, StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1, - ListLen; LIST_LEN; 1, + ListLenUsize; LIST_LEN_USIZE; 1, + ListLenU64; LIST_LEN_U64; 1, ListWithCapacity; LIST_WITH_CAPACITY; 1, ListReserve; LIST_RESERVE; 2, ListIsUnique; LIST_IS_UNIQUE; 1, diff --git a/crates/compiler/gen_dev/src/generic64/mod.rs b/crates/compiler/gen_dev/src/generic64/mod.rs index 0ae17f2e078..2ba1abc46a1 100644 --- a/crates/compiler/gen_dev/src/generic64/mod.rs +++ b/crates/compiler/gen_dev/src/generic64/mod.rs @@ -2830,8 +2830,13 @@ impl< } } - fn build_list_len(&mut self, dst: &Symbol, list: &Symbol) { - self.storage_manager.list_len(&mut self.buf, dst, list); + fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol) { + self.storage_manager + .list_len_usize(&mut self.buf, dst, list); + } + + fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol) { + self.storage_manager.list_len_u64(&mut self.buf, dst, list); } fn build_list_clone( diff --git a/crates/compiler/gen_dev/src/generic64/storage.rs b/crates/compiler/gen_dev/src/generic64/storage.rs index b5814b0cbbc..7943832f043 100644 --- a/crates/compiler/gen_dev/src/generic64/storage.rs +++ b/crates/compiler/gen_dev/src/generic64/storage.rs @@ -694,7 +694,7 @@ impl< } // Loads the dst to be the later 64 bits of a list (its length). - pub fn list_len(&mut self, _buf: &mut Vec<'a, u8>, dst: &Symbol, list: &Symbol) { + pub fn list_len_u64(&mut self, _buf: &mut Vec<'a, u8>, dst: &Symbol, list: &Symbol) { let owned_data = self.remove_allocation_for_sym(list); self.allocation_map.insert(*list, Rc::clone(&owned_data)); self.allocation_map.insert(*dst, owned_data); @@ -709,6 +709,11 @@ impl< ); } + /// In a 64-bit backend, this is the same as list_len_u64 + pub fn list_len_usize(&mut self, buf: &mut Vec<'a, u8>, dst: &Symbol, list: &Symbol) { + self.list_len_u64(buf, dst, list) + } + /// Creates a struct on the stack, moving the data in fields into the struct. pub fn create_struct( &mut self, diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index 8eb10c9d575..a8685ed587c 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1484,13 +1484,21 @@ trait Backend<'a> { self.build_fn_call(sym, intrinsic.to_string(), args, arg_layouts, ret_layout) } - LowLevel::ListLen => { + LowLevel::ListLenU64 => { debug_assert_eq!( 1, args.len(), - "ListLen: expected to have exactly one argument" + "ListLenU64: expected to have exactly one argument" ); - self.build_list_len(sym, &args[0]) + self.build_list_len_u64(sym, &args[0]) + } + LowLevel::ListLenUsize => { + debug_assert_eq!( + 1, + args.len(), + "ListLenUsize: expected to have exactly one argument" + ); + self.build_list_len_usize(sym, &args[0]) } LowLevel::ListWithCapacity => { debug_assert_eq!( @@ -2372,8 +2380,11 @@ trait Backend<'a> { /// build_sqrt stores the result of `sqrt(src)` into dst. fn build_num_sqrt(&mut self, dst: Symbol, src: Symbol, float_width: FloatWidth); - /// build_list_len returns the length of a list. - fn build_list_len(&mut self, dst: &Symbol, list: &Symbol); + /// build_list_len_usize returns the length of a list as a usize. This is for internal use only. + fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol); + + /// build_list_len_u64 returns the length of a list and casts it from usize to u64. This is for the public List.len. + fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol); /// generate a call to a higher-order lowlevel fn build_higher_order_lowlevel( diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index cb3e07cb484..4c5f73d8f42 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -611,7 +611,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( bitcode::STR_WITH_CAPACITY, ) } - ListLen => { + ListLenU64 => { // List.len : List * -> U64 arguments!(list); @@ -622,6 +622,12 @@ pub(crate) fn run_low_level<'a, 'ctx>( .new_build_int_cast(len_usize, env.context.i64_type(), "usize_to_u64") .into() } + ListLenUsize => { + // List.lenUsize : List * -> usize # used internally, not exposed + arguments!(list); + + list_len_usize(env.builder, list.into_struct_value()).into() + } ListGetCapacity => { // List.capacity: List a -> U64 arguments!(list); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 43f746894f4..b18ae7b5891 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -262,28 +262,14 @@ impl<'a> LowLevelCall<'a> { StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY), // List - ListLen => match backend.storage.get(&self.arguments[0]) { - StoredValue::StackMemory { location, .. } => { - let (local_id, offset) = - location.local_and_offset(backend.storage.stack_frame_pointer); - backend.code_builder.get_local(local_id); - // List is stored as (pointer, length, capacity), - // with each of those fields being 4 bytes on wasm. - // So the length is 4 bytes after the start of the struct. - // - // WRAPPER_LEN represents the index of the length field - // (which is 1 as of the writing of this comment). If the field order - // ever changes, WRAPPER_LEN should be updated and this logic should - // continue to work even though this comment may become inaccurate. - backend - .code_builder - .i32_load(Align::Bytes4, offset + (4 * Builtin::WRAPPER_LEN)); + ListLenU64 => { + self.load_list_len_usize(backend); - // Length is stored as 32 bits in memory, but List.len returns U64 - backend.code_builder.i64_extend_u_i32(); - } - _ => internal_error!("invalid storage for List"), - }, + // Length is stored as 32 bits in memory on wasm32, + // but List.len always returns U64 + backend.code_builder.i64_extend_u_i32(); + } + ListLenUsize => self.load_list_len_usize(backend), ListGetCapacity => self.load_args_and_call_zig(backend, bitcode::LIST_CAPACITY), @@ -2119,6 +2105,28 @@ impl<'a> LowLevelCall<'a> { } } + fn load_list_len_usize(&self, backend: &mut WasmBackend<'_, '_>) { + match backend.storage.get(&self.arguments[0]) { + StoredValue::StackMemory { location, .. } => { + let (local_id, offset) = + location.local_and_offset(backend.storage.stack_frame_pointer); + backend.code_builder.get_local(local_id); + // List is stored as (pointer, length, capacity), + // with each of those fields being 4 bytes on wasm. + // So the length is 4 bytes after the start of the struct. + // + // WRAPPER_LEN represents the index of the length field + // (which is 1 as of the writing of this comment). If the field order + // ever changes, WRAPPER_LEN should be updated and this logic should + // continue to work even though this comment may become inaccurate. + backend + .code_builder + .i32_load(Align::Bytes4, offset + (4 * Builtin::WRAPPER_LEN)); + } + _ => internal_error!("invalid storage for List"), + } + } + /// Equality and inequality /// These can operate on any data type (except functions) so they're more complex than other operators. fn eq_or_neq(&self, backend: &mut WasmBackend<'a, '_>) { diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index 2eb1d05e6ec..c4239ded421 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -4703,7 +4703,7 @@ fn synth_list_len_type(subs: &mut Subs) -> Variable { Content::Structure(FlatType::Apply(Symbol::LIST_LIST, a_slice)), ); let fn_var = synth_import(subs, Content::Error); - let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN, [])]); + let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN_U64, [])]); let clos_list_len = synth_import( subs, Content::LambdaSet(LambdaSet { @@ -4757,7 +4757,7 @@ pub fn add_imports( // Num needs List.len, but List imports Num. let list_len_type_var = synth_list_len_type(subs); let list_len_type_index = constraints.push_variable(list_len_type_var); - def_types.push((Symbol::LIST_LEN, Loc::at_zero(list_len_type_index))); + def_types.push((Symbol::LIST_LEN_U64, Loc::at_zero(list_len_type_index))); import_variables.push(list_len_type_var); } diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 7208993ef4c..0ef2fc346a5 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -26,7 +26,8 @@ pub enum LowLevel { StrReserve, StrWithCapacity, StrReleaseExcessCapacity, - ListLen, + ListLenUsize, + ListLenU64, ListWithCapacity, ListReserve, ListReleaseExcessCapacity, @@ -268,7 +269,8 @@ map_symbol_to_lowlevel! { StrToNum <= STR_TO_NUM; StrWithCapacity <= STR_WITH_CAPACITY; StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY; - ListLen <= LIST_LEN; + ListLenU64 <= LIST_LEN_U64; + ListLenUsize <= LIST_LEN_USIZE; ListGetCapacity <= LIST_CAPACITY; ListWithCapacity <= LIST_WITH_CAPACITY; ListReserve <= LIST_RESERVE; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 14cb252dc3b..3c462a4a925 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1342,7 +1342,7 @@ define_builtins! { 3 LIST_SET: "set" 4 LIST_APPEND: "append" 5 LIST_MAP: "map" - 6 LIST_LEN: "len" + 6 LIST_LEN_U64: "len" 7 LIST_WALK_BACKWARDS: "walkBackwards" 8 LIST_CONCAT: "concat" 9 LIST_FIRST: "first" @@ -1424,6 +1424,7 @@ define_builtins! { 85 LIST_PREPEND_IF_OK: "prependIfOk" 86 LIST_WALK_WITH_INDEX_UNTIL: "walkWithIndexUntil" 87 LIST_CLONE: "clone" + 88 LIST_LEN_USIZE: "lenUsize" } 7 RESULT: "Result" => { 0 RESULT_RESULT: "Result" exposed_type=true // the Result.Result type alias diff --git a/crates/compiler/mono/src/code_gen_help/equality.rs b/crates/compiler/mono/src/code_gen_help/equality.rs index de3eadf65ac..3a0d12e826d 100644 --- a/crates/compiler/mono/src/code_gen_help/equality.rs +++ b/crates/compiler/mono/src/code_gen_help/equality.rs @@ -668,8 +668,8 @@ fn eq_list<'a>( let len_1 = root.create_symbol(ident_ids, "len_1"); let len_2 = root.create_symbol(ident_ids, "len_2"); - let len_1_stmt = |next| let_lowlevel(arena, layout_isize, len_1, ListLen, &[ARG_1], next); - let len_2_stmt = |next| let_lowlevel(arena, layout_isize, len_2, ListLen, &[ARG_2], next); + let len_1_stmt = |next| let_lowlevel(arena, layout_isize, len_1, ListLenUsize, &[ARG_1], next); + let len_2_stmt = |next| let_lowlevel(arena, layout_isize, len_2, ListLenUsize, &[ARG_2], next); let eq_len = root.create_symbol(ident_ids, "eq_len"); let eq_len_stmt = |next| let_lowlevel(arena, LAYOUT_BOOL, eq_len, Eq, &[len_1, len_2], next); diff --git a/crates/compiler/mono/src/code_gen_help/refcount.rs b/crates/compiler/mono/src/code_gen_help/refcount.rs index 2449977b850..d2882732f5a 100644 --- a/crates/compiler/mono/src/code_gen_help/refcount.rs +++ b/crates/compiler/mono/src/code_gen_help/refcount.rs @@ -926,7 +926,7 @@ fn refcount_list<'a>( // let len = root.create_symbol(ident_ids, "len"); - let len_stmt = |next| let_lowlevel(arena, layout_isize, len, ListLen, &[structure], next); + let len_stmt = |next| let_lowlevel(arena, layout_isize, len, ListLenUsize, &[structure], next); // let zero = 0 let zero = root.create_symbol(ident_ids, "zero"); diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index b4853934369..7a16409fc09 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1533,8 +1533,8 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { match lowlevel { Unreachable => RC::Uknown, - ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity | ListWithCapacity - | StrWithCapacity => RC::NoRc, + ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity + | ListWithCapacity | StrWithCapacity => RC::NoRc, ListReplaceUnsafe => RC::Rc, StrGetUnsafe | ListGetUnsafe => RC::NoRc, ListConcat => RC::Rc, diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index d669286fd1f..79925daa351 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1283,7 +1283,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { match op { Unreachable => arena.alloc_slice_copy(&[irrelevant]), DictPseudoSeed => arena.alloc_slice_copy(&[irrelevant]), - ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { + ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { arena.alloc_slice_copy(&[borrowed]) } ListWithCapacity | StrWithCapacity => arena.alloc_slice_copy(&[irrelevant]), diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index 745d2cae123..853011ca090 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1769,7 +1769,7 @@ fn test_to_comparison<'a>( LayoutRepr::Builtin(Builtin::List(_elem_layout)) => { let real_len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -2346,7 +2346,7 @@ fn decide_to_branching<'a>( let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([inner_cond_symbol]), diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index 38ebdcfe04d..155b3a26419 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1412,7 +1412,7 @@ pub(crate) fn build_list_index_probe<'a>( let len_sym = env.unique_symbol(); let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1570,7 +1570,7 @@ fn store_list_rest<'a>( let list_len_sym = env.unique_symbol(); let list_len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), diff --git a/crates/compiler/mono/src/low_level.rs b/crates/compiler/mono/src/low_level.rs index 1279b8eb34d..2472ed97787 100644 --- a/crates/compiler/mono/src/low_level.rs +++ b/crates/compiler/mono/src/low_level.rs @@ -69,7 +69,8 @@ enum FirstOrder { StrToUtf8, StrRepeat, StrFromFloat, - ListLen, + ListLenU64, + ListLenUsize, ListGetUnsafe, ListSublist, ListDropAt, From 3b55b64ca68e9d955e3fef2cfb630eec3c0cda94 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Thu, 15 Feb 2024 06:47:14 -0500 Subject: [PATCH 74/80] Update mono tests --- ...e_in_polymorphic_expression_issue_4717.txt | 116 +++---- .../generated/call_function_in_empty_list.txt | 4 +- .../call_function_in_empty_list_unbound.txt | 4 +- .../generated/capture_void_layout_task.txt | 44 +-- ...ose_correct_recursion_var_under_record.txt | 66 ++-- .../test_mono/generated/closure_in_list.txt | 4 +- ...lambda_set_productive_nullable_wrapped.txt | 46 +-- crates/compiler/test_mono/generated/dict.txt | 4 +- .../generated/empty_list_of_function_type.txt | 32 +- .../compiler/test_mono/generated/encode.txt | 18 +- .../encode_derived_nested_record_string.txt | 294 +++++++++--------- ...encode_derived_record_one_field_string.txt | 250 +++++++-------- ...ncode_derived_record_two_field_strings.txt | 250 +++++++-------- .../generated/encode_derived_string.txt | 178 +++++------ .../encode_derived_tag_one_field_string.txt | 246 +++++++-------- ...encode_derived_tag_two_payloads_string.txt | 250 +++++++-------- .../generated/inspect_derived_dict.txt | 276 ++++++++-------- .../generated/inspect_derived_list.txt | 44 +-- .../inspect_derived_nested_record_string.txt | 94 +++--- .../generated/inspect_derived_record.txt | 46 +-- ...nspect_derived_record_one_field_string.txt | 46 +-- ...spect_derived_record_two_field_strings.txt | 46 +-- .../inspect_derived_tag_one_field_string.txt | 60 ++-- ...nspect_derived_tag_two_payloads_string.txt | 60 ++-- .../test_mono/generated/ir_int_add.txt | 4 +- ...cialize_errors_behind_unified_branches.txt | 58 ++-- .../test_mono/generated/issue_4749.txt | 192 ++++++------ .../test_mono/generated/issue_4770.txt | 110 +++---- ..._4772_weakened_monomorphic_destructure.txt | 192 ++++++------ .../test_mono/generated/issue_6196.txt | 4 +- ...ure_with_multiple_recursive_structures.txt | 44 +-- .../test_mono/generated/list_append.txt | 18 +- .../generated/list_append_closure.txt | 18 +- .../generated/list_cannot_update_inplace.txt | 34 +- .../compiler/test_mono/generated/list_get.txt | 32 +- .../compiler/test_mono/generated/list_len.txt | 8 +- .../generated/list_map_closure_borrows.txt | 38 +-- .../generated/list_map_closure_owns.txt | 38 +-- ...ist_map_take_capturing_or_noncapturing.txt | 20 +- .../list_one_vs_one_spread_issue_4685.txt | 4 +- .../generated/list_pass_to_function.txt | 32 +- .../test_mono/generated/list_sort_asc.txt | 12 +- .../test_mono/generated/match_list.txt | 6 +- .../nested_optional_field_with_binary_op.txt | 2 +- .../order_list_size_tests_issue_4732.txt | 8 +- .../test_mono/generated/quicksort_swap.txt | 60 ++-- .../test_mono/generated/record_update.txt | 32 +- ...function_and_union_with_inference_hole.txt | 4 +- .../compiler/test_mono/generated/rigids.txt | 60 ++-- ...not_duplicate_identical_concrete_types.txt | 250 +++++++-------- ...types_without_unification_of_unifiable.txt | 114 +++---- .../weakening_avoids_overspecialization.txt | 116 +++---- 52 files changed, 1994 insertions(+), 1994 deletions(-) diff --git a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt index 471c6926475..062c85939a6 100644 --- a/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt +++ b/crates/compiler/test_mono/generated/anonymous_closure_in_polymorphic_expression_issue_4717.txt @@ -2,80 +2,80 @@ procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure List.102 (List.486, List.487, List.488): - let List.589 : U64 = 0i64; - let List.590 : U64 = CallByName List.6 List.486; - let List.588 : [C U64, C U64] = CallByName List.80 List.486 List.487 List.488 List.589 List.590; - ret List.588; +procedure List.103 (List.487, List.488, List.489): + let List.590 : U64 = 0i64; + let List.591 : U64 = CallByName List.6 List.487; + let List.589 : [C U64, C U64] = CallByName List.80 List.487 List.488 List.489 List.590 List.591; + ret List.589; -procedure List.26 (List.199, List.200, List.201): - let List.582 : [C U64, C U64] = CallByName List.102 List.199 List.200 List.201; - let List.585 : U8 = 1i64; - let List.586 : U8 = GetTagId List.582; - let List.587 : Int1 = lowlevel Eq List.585 List.586; - if List.587 then - let List.202 : U64 = UnionAtIndex (Id 1) (Index 0) List.582; - ret List.202; - else - let List.203 : U64 = UnionAtIndex (Id 0) (Index 0) List.582; +procedure List.26 (List.200, List.201, List.202): + let List.583 : [C U64, C U64] = CallByName List.103 List.200 List.201 List.202; + let List.586 : U8 = 1i64; + let List.587 : U8 = GetTagId List.583; + let List.588 : Int1 = lowlevel Eq List.586 List.587; + if List.588 then + let List.203 : U64 = UnionAtIndex (Id 1) (Index 0) List.583; ret List.203; + else + let List.204 : U64 = UnionAtIndex (Id 0) (Index 0) List.583; + ret List.204; -procedure List.38 (List.342, List.343): - let List.581 : U64 = CallByName List.6 List.342; - let List.344 : U64 = CallByName Num.77 List.581 List.343; - let List.571 : List U8 = CallByName List.43 List.342 List.344; - ret List.571; - -procedure List.43 (List.340, List.341): - let List.579 : U64 = CallByName List.6 List.340; - let List.578 : U64 = CallByName Num.77 List.579 List.341; - let List.573 : {U64, U64} = Struct {List.341, List.578}; - let List.572 : List U8 = CallByName List.49 List.340 List.573; +procedure List.38 (List.343, List.344): + let List.582 : U64 = CallByName List.6 List.343; + let List.345 : U64 = CallByName Num.77 List.582 List.344; + let List.572 : List U8 = CallByName List.43 List.343 List.345; ret List.572; -procedure List.49 (List.418, List.419): - let List.575 : U64 = StructAtIndex 1 List.419; - let List.576 : U64 = StructAtIndex 0 List.419; - let List.574 : List U8 = CallByName List.72 List.418 List.575 List.576; - ret List.574; +procedure List.43 (List.341, List.342): + let List.580 : U64 = CallByName List.6 List.341; + let List.579 : U64 = CallByName Num.77 List.580 List.342; + let List.574 : {U64, U64} = Struct {List.342, List.579}; + let List.573 : List U8 = CallByName List.49 List.341 List.574; + ret List.573; + +procedure List.49 (List.419, List.420): + let List.576 : U64 = StructAtIndex 1 List.420; + let List.577 : U64 = StructAtIndex 0 List.420; + let List.575 : List U8 = CallByName List.72 List.419 List.576 List.577; + ret List.575; procedure List.6 (#Attr.2): - let List.580 : U64 = lowlevel ListLen #Attr.2; - ret List.580; + let List.581 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.581; procedure List.66 (#Attr.2, #Attr.3): - let List.603 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.603; + let List.604 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.604; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.577 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.577; + let List.578 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.578; procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.591 List.489 List.490 List.491 List.492 List.493: - let List.593 : Int1 = CallByName Num.22 List.492 List.493; - if List.593 then - let List.602 : U8 = CallByName List.66 List.489 List.492; - let List.594 : [C U64, C U64] = CallByName Test.4 List.490 List.602; - let List.599 : U8 = 1i64; - let List.600 : U8 = GetTagId List.594; - let List.601 : Int1 = lowlevel Eq List.599 List.600; - if List.601 then - let List.494 : U64 = UnionAtIndex (Id 1) (Index 0) List.594; - let List.597 : U64 = 1i64; - let List.596 : U64 = CallByName Num.51 List.492 List.597; - jump List.591 List.489 List.494 List.491 List.596 List.493; + joinpoint List.592 List.490 List.491 List.492 List.493 List.494: + let List.594 : Int1 = CallByName Num.22 List.493 List.494; + if List.594 then + let List.603 : U8 = CallByName List.66 List.490 List.493; + let List.595 : [C U64, C U64] = CallByName Test.4 List.491 List.603; + let List.600 : U8 = 1i64; + let List.601 : U8 = GetTagId List.595; + let List.602 : Int1 = lowlevel Eq List.600 List.601; + if List.602 then + let List.495 : U64 = UnionAtIndex (Id 1) (Index 0) List.595; + let List.598 : U64 = 1i64; + let List.597 : U64 = CallByName Num.51 List.493 List.598; + jump List.592 List.490 List.495 List.492 List.597 List.494; else - dec List.489; - let List.495 : U64 = UnionAtIndex (Id 0) (Index 0) List.594; - let List.598 : [C U64, C U64] = TagId(0) List.495; - ret List.598; + dec List.490; + let List.496 : U64 = UnionAtIndex (Id 0) (Index 0) List.595; + let List.599 : [C U64, C U64] = TagId(0) List.496; + ret List.599; else - dec List.489; - let List.592 : [C U64, C U64] = TagId(1) List.490; - ret List.592; + dec List.490; + let List.593 : [C U64, C U64] = TagId(1) List.491; + ret List.593; in - jump List.591 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.592 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): let Num.270 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/call_function_in_empty_list.txt b/crates/compiler/test_mono/generated/call_function_in_empty_list.txt index ce9516fd56a..817279f2ab4 100644 --- a/crates/compiler/test_mono/generated/call_function_in_empty_list.txt +++ b/crates/compiler/test_mono/generated/call_function_in_empty_list.txt @@ -1,7 +1,7 @@ procedure List.5 (#Attr.2, #Attr.3): - let List.571 : List {} = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; + let List.572 : List {} = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; decref #Attr.2; - ret List.571; + ret List.572; procedure Test.2 (Test.3): let Test.7 : {} = Struct {}; diff --git a/crates/compiler/test_mono/generated/call_function_in_empty_list_unbound.txt b/crates/compiler/test_mono/generated/call_function_in_empty_list_unbound.txt index 8f4dc677693..b74bfdc24af 100644 --- a/crates/compiler/test_mono/generated/call_function_in_empty_list_unbound.txt +++ b/crates/compiler/test_mono/generated/call_function_in_empty_list_unbound.txt @@ -1,7 +1,7 @@ procedure List.5 (#Attr.2, #Attr.3): - let List.571 : List [] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; + let List.572 : List [] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; decref #Attr.2; - ret List.571; + ret List.572; procedure Test.2 (Test.3): let Test.7 : {} = Struct {}; diff --git a/crates/compiler/test_mono/generated/capture_void_layout_task.txt b/crates/compiler/test_mono/generated/capture_void_layout_task.txt index 9db7925d85a..db6b9d67282 100644 --- a/crates/compiler/test_mono/generated/capture_void_layout_task.txt +++ b/crates/compiler/test_mono/generated/capture_void_layout_task.txt @@ -1,31 +1,31 @@ -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : [C {}, C *self {{}, []}] = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : [C {}, C *self {{}, []}] = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.3, #Derived_gen.4, #Derived_gen.5, #Derived_gen.6, #Derived_gen.7): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : [] = CallByName List.66 List.161 List.164; - let List.166 : [C {}, C *self {{}, []}] = CallByName Test.29 List.162 List.580 List.163; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : [] = CallByName List.66 List.162 List.165; + let List.167 : [C {}, C *self {{}, []}] = CallByName Test.29 List.163 List.581 List.164; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5 #Derived_gen.6 #Derived_gen.7; + jump List.575 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt index 1574498a0a9..bfe0749251e 100644 --- a/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt +++ b/crates/compiler/test_mono/generated/choose_correct_recursion_var_under_record.txt @@ -2,49 +2,49 @@ procedure Bool.1 (): let Bool.24 : Int1 = false; ret Bool.24; -procedure List.2 (List.106, List.107): - let List.585 : U64 = CallByName List.6 List.106; - let List.581 : Int1 = CallByName Num.22 List.107 List.585; - if List.581 then - let List.583 : Str = CallByName List.66 List.106 List.107; - inc List.583; - dec List.106; - let List.582 : [C {}, C Str] = TagId(1) List.583; - ret List.582; +procedure List.2 (List.107, List.108): + let List.586 : U64 = CallByName List.6 List.107; + let List.582 : Int1 = CallByName Num.22 List.108 List.586; + if List.582 then + let List.584 : Str = CallByName List.66 List.107 List.108; + inc List.584; + dec List.107; + let List.583 : [C {}, C Str] = TagId(1) List.584; + ret List.583; else - dec List.106; - let List.580 : {} = Struct {}; - let List.579 : [C {}, C Str] = TagId(0) List.580; - ret List.579; + dec List.107; + let List.581 : {} = Struct {}; + let List.580 : [C {}, C Str] = TagId(0) List.581; + ret List.580; procedure List.5 (#Attr.2, #Attr.3): - let List.587 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.10 #Attr.3; + let List.588 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.10 #Attr.3; decref #Attr.2; - ret List.587; + ret List.588; procedure List.6 (#Attr.2): - let List.586 : U64 = lowlevel ListLen #Attr.2; - ret List.586; + let List.587 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.587; procedure List.66 (#Attr.2, #Attr.3): - let List.584 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.584; + let List.585 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.585; -procedure List.9 (List.333): - let List.578 : U64 = 0i64; - let List.571 : [C {}, C Str] = CallByName List.2 List.333 List.578; - let List.575 : U8 = 1i64; - let List.576 : U8 = GetTagId List.571; - let List.577 : Int1 = lowlevel Eq List.575 List.576; - if List.577 then - let List.334 : Str = UnionAtIndex (Id 1) (Index 0) List.571; - let List.572 : [C {}, C Str] = TagId(1) List.334; - ret List.572; - else - dec List.571; - let List.574 : {} = Struct {}; - let List.573 : [C {}, C Str] = TagId(0) List.574; +procedure List.9 (List.334): + let List.579 : U64 = 0i64; + let List.572 : [C {}, C Str] = CallByName List.2 List.334 List.579; + let List.576 : U8 = 1i64; + let List.577 : U8 = GetTagId List.572; + let List.578 : Int1 = lowlevel Eq List.576 List.577; + if List.578 then + let List.335 : Str = UnionAtIndex (Id 1) (Index 0) List.572; + let List.573 : [C {}, C Str] = TagId(1) List.335; ret List.573; + else + dec List.572; + let List.575 : {} = Struct {}; + let List.574 : [C {}, C Str] = TagId(0) List.575; + ret List.574; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/closure_in_list.txt b/crates/compiler/test_mono/generated/closure_in_list.txt index ffb77b5f87f..251ad692b59 100644 --- a/crates/compiler/test_mono/generated/closure_in_list.txt +++ b/crates/compiler/test_mono/generated/closure_in_list.txt @@ -1,6 +1,6 @@ procedure List.6 (#Attr.2): - let List.571 : U64 = lowlevel ListLen #Attr.2; - ret List.571; + let List.572 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.572; procedure Test.1 (Test.5): let Test.2 : I64 = 41i64; 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 5e7c9bd030c..c98a783e9c5 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 @@ -2,34 +2,34 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : [, C *self Int1, C *self Int1] = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : [, C *self Int1, C *self Int1] = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : Int1 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; + let List.582 : Int1 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; -procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : Int1 = CallByName List.66 List.161 List.164; - let List.166 : [, C *self Int1, C *self Int1] = CallByName Test.6 List.162 List.580 List.163; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; +procedure List.91 (#Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : Int1 = CallByName List.66 List.162 List.165; + let List.167 : [, C *self Int1, C *self Int1] = CallByName Test.6 List.163 List.581 List.164; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.575 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; @@ -46,7 +46,7 @@ procedure Str.3 (#Attr.2, #Attr.3): procedure Test.1 (Test.5): ret Test.5; -procedure Test.11 (#Derived_gen.8, #Derived_gen.9): +procedure Test.11 (#Derived_gen.3, #Derived_gen.4): joinpoint Test.27 Test.12 #Attr.12: let Test.34 : Int1 = UnionAtIndex (Id 2) (Index 1) #Attr.12; let Test.33 : [, C *self Int1, C *self Int1] = UnionAtIndex (Id 2) (Index 0) #Attr.12; @@ -86,7 +86,7 @@ procedure Test.11 (#Derived_gen.8, #Derived_gen.9): decref #Attr.12; jump #Derived_gen.12; in - jump Test.27 #Derived_gen.8 #Derived_gen.9; + jump Test.27 #Derived_gen.3 #Derived_gen.4; procedure Test.2 (Test.13): ret Test.13; diff --git a/crates/compiler/test_mono/generated/dict.txt b/crates/compiler/test_mono/generated/dict.txt index acaf20cfd52..214db7d719f 100644 --- a/crates/compiler/test_mono/generated/dict.txt +++ b/crates/compiler/test_mono/generated/dict.txt @@ -26,8 +26,8 @@ procedure Dict.45 (): ret Dict.735; procedure List.6 (#Attr.2): - let List.571 : U64 = lowlevel ListLen #Attr.2; - ret List.571; + let List.572 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.572; procedure Num.75 (#Attr.2, #Attr.3): let Num.267 : U8 = lowlevel NumSubWrap #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/empty_list_of_function_type.txt b/crates/compiler/test_mono/generated/empty_list_of_function_type.txt index 23db8577700..5177b3fc663 100644 --- a/crates/compiler/test_mono/generated/empty_list_of_function_type.txt +++ b/crates/compiler/test_mono/generated/empty_list_of_function_type.txt @@ -2,27 +2,27 @@ procedure Bool.1 (): let Bool.23 : Int1 = false; ret Bool.23; -procedure List.2 (List.106, List.107): - let List.577 : U64 = CallByName List.6 List.106; - let List.573 : Int1 = CallByName Num.22 List.107 List.577; - if List.573 then - let List.575 : {} = CallByName List.66 List.106 List.107; - dec List.106; - let List.574 : [C {}, C {}] = TagId(1) List.575; - ret List.574; +procedure List.2 (List.107, List.108): + let List.578 : U64 = CallByName List.6 List.107; + let List.574 : Int1 = CallByName Num.22 List.108 List.578; + if List.574 then + let List.576 : {} = CallByName List.66 List.107 List.108; + dec List.107; + let List.575 : [C {}, C {}] = TagId(1) List.576; + ret List.575; else - dec List.106; - let List.572 : {} = Struct {}; - let List.571 : [C {}, C {}] = TagId(0) List.572; - ret List.571; + dec List.107; + let List.573 : {} = Struct {}; + let List.572 : [C {}, C {}] = TagId(0) List.573; + ret List.572; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; procedure List.66 (#Attr.2, #Attr.3): - let List.576 : {} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.576; + let List.577 : {} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/encode.txt b/crates/compiler/test_mono/generated/encode.txt index d301e40e15b..bd59e39bf11 100644 --- a/crates/compiler/test_mono/generated/encode.txt +++ b/crates/compiler/test_mono/generated/encode.txt @@ -1,16 +1,16 @@ -procedure List.4 (List.122, List.123): - let List.574 : U64 = 1i64; - let List.572 : List U8 = CallByName List.70 List.122 List.574; - let List.571 : List U8 = CallByName List.71 List.572 List.123; - ret List.571; +procedure List.4 (List.123, List.124): + let List.575 : U64 = 1i64; + let List.573 : List U8 = CallByName List.70 List.123 List.575; + let List.572 : List U8 = CallByName List.71 List.573 List.124; + ret List.572; procedure List.70 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.575; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.573 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.573; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure Test.23 (Test.24, Test.35, Test.22): let Test.37 : List U8 = CallByName List.4 Test.24 Test.22; diff --git a/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt b/crates/compiler/test_mono/generated/encode_derived_nested_record_string.txt index 79331d6fdb3..e727df92773 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 @@ -65,189 +65,189 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.683 : U64 = 0i64; - let List.684 : U64 = CallByName List.6 List.486; - let List.682 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.683 List.684; - ret List.682; - -procedure List.18 (List.158, List.159, List.160): - let List.593 : U64 = 0i64; - let List.594 : U64 = CallByName List.6 List.158; - let List.592 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.593 List.594; - ret List.592; - -procedure List.18 (List.158, List.159, List.160): - let List.627 : U64 = 0i64; - let List.628 : U64 = CallByName List.6 List.158; - let List.626 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.627 List.628; - ret List.626; - -procedure List.18 (List.158, List.159, List.160): - let List.639 : U64 = 0i64; - let List.640 : U64 = CallByName List.6 List.158; - let List.638 : List U8 = CallByName List.90 List.158 List.159 List.160 List.639 List.640; - ret List.638; - -procedure List.26 (List.199, List.200, List.201): - let List.676 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.679 : U8 = 1i64; - let List.680 : U8 = GetTagId List.676; - let List.681 : Int1 = lowlevel Eq List.679 List.680; - if List.681 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.676; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.676; +procedure List.103 (List.487, List.488, List.489): + let List.684 : U64 = 0i64; + let List.685 : U64 = CallByName List.6 List.487; + let List.683 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.684 List.685; + ret List.683; + +procedure List.18 (List.159, List.160, List.161): + let List.594 : U64 = 0i64; + let List.595 : U64 = CallByName List.6 List.159; + let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; + ret List.593; + +procedure List.18 (List.159, List.160, List.161): + let List.628 : U64 = 0i64; + let List.629 : U64 = CallByName List.6 List.159; + let List.627 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.628 List.629; + ret List.627; + +procedure List.18 (List.159, List.160, List.161): + let List.640 : U64 = 0i64; + let List.641 : U64 = CallByName List.6 List.159; + let List.639 : List U8 = CallByName List.91 List.159 List.160 List.161 List.640 List.641; + ret List.639; + +procedure List.26 (List.200, List.201, List.202): + let List.677 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.680 : U8 = 1i64; + let List.681 : U8 = GetTagId List.677; + let List.682 : Int1 = lowlevel Eq List.680 List.681; + if List.682 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.677; ret List.203; - -procedure List.4 (List.122, List.123): - let List.625 : U64 = 1i64; - let List.624 : List U8 = CallByName List.70 List.122 List.625; - let List.623 : List U8 = CallByName List.71 List.624 List.123; - ret List.623; - -procedure List.49 (List.418, List.419): - let List.667 : U64 = StructAtIndex 1 List.419; - let List.668 : U64 = StructAtIndex 0 List.419; - let List.666 : List U8 = CallByName List.72 List.418 List.667 List.668; - ret List.666; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.674 List.436: - let List.672 : U64 = 0i64; - let List.671 : {U64, U64} = Struct {List.436, List.672}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.671; - let List.670 : U64 = CallByName Num.75 List.435 List.436; - let List.665 : {U64, U64} = Struct {List.670, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.665; - let List.664 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.664; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.677; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.626 : U64 = 1i64; + let List.625 : List U8 = CallByName List.70 List.123 List.626; + let List.624 : List U8 = CallByName List.71 List.625 List.124; + ret List.624; + +procedure List.49 (List.419, List.420): + let List.668 : U64 = StructAtIndex 1 List.420; + let List.669 : U64 = StructAtIndex 0 List.420; + let List.667 : List U8 = CallByName List.72 List.419 List.668 List.669; + ret List.667; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.675 List.437: + let List.673 : U64 = 0i64; + let List.672 : {U64, U64} = Struct {List.437, List.673}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.672; + let List.671 : U64 = CallByName Num.75 List.436 List.437; + let List.666 : {U64, U64} = Struct {List.671, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.666; + let List.665 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.665; in - let List.675 : Int1 = CallByName Num.24 List.435 List.434; - if List.675 then - jump List.674 List.434; + let List.676 : Int1 = CallByName Num.24 List.436 List.435; + if List.676 then + jump List.675 List.435; else - jump List.674 List.435; + jump List.675 List.436; procedure List.6 (#Attr.2): - let List.605 : U64 = lowlevel ListLen #Attr.2; - ret List.605; + let List.606 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.606; procedure List.6 (#Attr.2): - let List.659 : U64 = lowlevel ListLen #Attr.2; - ret List.659; + let List.660 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.660; procedure List.6 (#Attr.2): - let List.661 : U64 = lowlevel ListLen #Attr.2; - ret List.661; + let List.662 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.662; procedure List.66 (#Attr.2, #Attr.3): - let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.602; + let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.603; procedure List.66 (#Attr.2, #Attr.3): - let List.636 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.636; + let List.637 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.637; procedure List.66 (#Attr.2, #Attr.3): - let List.648 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.648; + let List.649 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.649; procedure List.68 (#Attr.2): - let List.663 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.663; + let List.664 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.664; procedure List.70 (#Attr.2, #Attr.3): - let List.610 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.610; + let List.611 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.611; procedure List.71 (#Attr.2, #Attr.3): - let List.608 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.608; + let List.609 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.609; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.669 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.669; + let List.670 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.670; procedure List.8 (#Attr.2, #Attr.3): - let List.658 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.658; + let List.659 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.659; procedure List.80 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): - joinpoint List.685 List.489 List.490 List.491 List.492 List.493: - let List.687 : Int1 = CallByName Num.22 List.492 List.493; - if List.687 then - let List.696 : U8 = CallByName List.66 List.489 List.492; - let List.688 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.696; - let List.693 : U8 = 1i64; - let List.694 : U8 = GetTagId List.688; - let List.695 : Int1 = lowlevel Eq List.693 List.694; - if List.695 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.688; - let List.691 : U64 = 1i64; - let List.690 : U64 = CallByName Num.51 List.492 List.691; - jump List.685 List.489 List.494 List.491 List.690 List.493; + joinpoint List.686 List.490 List.491 List.492 List.493 List.494: + let List.688 : Int1 = CallByName Num.22 List.493 List.494; + if List.688 then + let List.697 : U8 = CallByName List.66 List.490 List.493; + let List.689 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.697; + let List.694 : U8 = 1i64; + let List.695 : U8 = GetTagId List.689; + let List.696 : Int1 = lowlevel Eq List.694 List.695; + if List.696 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.689; + let List.692 : U64 = 1i64; + let List.691 : U64 = CallByName Num.51 List.493 List.692; + jump List.686 List.490 List.495 List.492 List.691 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.688; - let List.692 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.692; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.689; + let List.693 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.693; else - dec List.489; - let List.686 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.686; + dec List.490; + let List.687 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.687; in - jump List.685 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; - -procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): - joinpoint List.641 List.161 List.162 List.163 List.164 List.165: - let List.643 : Int1 = CallByName Num.22 List.164 List.165; - if List.643 then - let List.647 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.647; - let List.646 : U64 = 1i64; - let List.645 : U64 = CallByName Num.51 List.164 List.646; - jump List.641 List.161 List.166 List.163 List.645 List.165; + jump List.686 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; + +procedure List.91 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): + joinpoint List.642 List.162 List.163 List.164 List.165 List.166: + let List.644 : Int1 = CallByName Num.22 List.165 List.166; + if List.644 then + let List.648 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.648; + let List.647 : U64 = 1i64; + let List.646 : U64 = CallByName Num.51 List.165 List.647; + jump List.642 List.162 List.167 List.164 List.646 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.641 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; - -procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): - joinpoint List.595 List.161 List.162 List.163 List.164 List.165: - let List.597 : Int1 = CallByName Num.22 List.164 List.165; - if List.597 then - let List.601 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.601; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.601; - let List.600 : U64 = 1i64; - let List.599 : U64 = CallByName Num.51 List.164 List.600; - jump List.595 List.161 List.166 List.163 List.599 List.165; + jump List.642 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; + +procedure List.91 (#Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35): + joinpoint List.630 List.162 List.163 List.164 List.165 List.166: + let List.632 : Int1 = CallByName Num.22 List.165 List.166; + if List.632 then + let List.636 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.636; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.636; + let List.635 : U64 = 1i64; + let List.634 : U64 = CallByName Num.51 List.165 List.635; + jump List.630 List.162 List.167 List.164 List.634 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.595 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; - -procedure List.90 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49): - joinpoint List.629 List.161 List.162 List.163 List.164 List.165: - let List.631 : Int1 = CallByName Num.22 List.164 List.165; - if List.631 then - let List.635 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.635; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.635; - let List.634 : U64 = 1i64; - let List.633 : U64 = CallByName Num.51 List.164 List.634; - jump List.629 List.161 List.166 List.163 List.633 List.165; + jump List.630 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35; + +procedure List.91 (#Derived_gen.36, #Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40): + joinpoint List.596 List.162 List.163 List.164 List.165 List.166: + let List.598 : Int1 = CallByName Num.22 List.165 List.166; + if List.598 then + let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.602; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; + let List.601 : U64 = 1i64; + let List.600 : U64 = CallByName Num.51 List.165 List.601; + jump List.596 List.162 List.167 List.164 List.600 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.629 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49; + jump List.596 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40; procedure Num.127 (#Attr.2): let Num.282 : U8 = lowlevel NumIntCast #Attr.2; 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 32713c01c3b..155f17b9941 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 @@ -38,159 +38,159 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.649 : U64 = 0i64; - let List.650 : U64 = CallByName List.6 List.486; - let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.649 List.650; - ret List.648; - -procedure List.18 (List.158, List.159, List.160): - let List.593 : U64 = 0i64; - let List.594 : U64 = CallByName List.6 List.158; - let List.592 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.593 List.594; - ret List.592; - -procedure List.18 (List.158, List.159, List.160): - let List.605 : U64 = 0i64; - let List.606 : U64 = CallByName List.6 List.158; - let List.604 : List U8 = CallByName List.90 List.158 List.159 List.160 List.605 List.606; - ret List.604; - -procedure List.26 (List.199, List.200, List.201): - let List.642 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.645 : U8 = 1i64; - let List.646 : U8 = GetTagId List.642; - let List.647 : Int1 = lowlevel Eq List.645 List.646; - if List.647 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.642; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.642; +procedure List.103 (List.487, List.488, List.489): + let List.650 : U64 = 0i64; + let List.651 : U64 = CallByName List.6 List.487; + let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.650 List.651; + ret List.649; + +procedure List.18 (List.159, List.160, List.161): + let List.594 : U64 = 0i64; + let List.595 : U64 = CallByName List.6 List.159; + let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; + ret List.593; + +procedure List.18 (List.159, List.160, List.161): + let List.606 : U64 = 0i64; + let List.607 : U64 = CallByName List.6 List.159; + let List.605 : List U8 = CallByName List.91 List.159 List.160 List.161 List.606 List.607; + ret List.605; + +procedure List.26 (List.200, List.201, List.202): + let List.643 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.646 : U8 = 1i64; + let List.647 : U8 = GetTagId List.643; + let List.648 : Int1 = lowlevel Eq List.646 List.647; + if List.648 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.643; ret List.203; - -procedure List.4 (List.122, List.123): - let List.591 : U64 = 1i64; - let List.590 : List U8 = CallByName List.70 List.122 List.591; - let List.589 : List U8 = CallByName List.71 List.590 List.123; - ret List.589; - -procedure List.49 (List.418, List.419): - let List.633 : U64 = StructAtIndex 1 List.419; - let List.634 : U64 = StructAtIndex 0 List.419; - let List.632 : List U8 = CallByName List.72 List.418 List.633 List.634; - ret List.632; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.640 List.436: - let List.638 : U64 = 0i64; - let List.637 : {U64, U64} = Struct {List.436, List.638}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.637; - let List.636 : U64 = CallByName Num.75 List.435 List.436; - let List.631 : {U64, U64} = Struct {List.636, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.631; - let List.630 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.630; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.643; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.592 : U64 = 1i64; + let List.591 : List U8 = CallByName List.70 List.123 List.592; + let List.590 : List U8 = CallByName List.71 List.591 List.124; + ret List.590; + +procedure List.49 (List.419, List.420): + let List.634 : U64 = StructAtIndex 1 List.420; + let List.635 : U64 = StructAtIndex 0 List.420; + let List.633 : List U8 = CallByName List.72 List.419 List.634 List.635; + ret List.633; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.641 List.437: + let List.639 : U64 = 0i64; + let List.638 : {U64, U64} = Struct {List.437, List.639}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.638; + let List.637 : U64 = CallByName Num.75 List.436 List.437; + let List.632 : {U64, U64} = Struct {List.637, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.632; + let List.631 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.631; in - let List.641 : Int1 = CallByName Num.24 List.435 List.434; - if List.641 then - jump List.640 List.434; + let List.642 : Int1 = CallByName Num.24 List.436 List.435; + if List.642 then + jump List.641 List.435; else - jump List.640 List.435; + jump List.641 List.436; procedure List.6 (#Attr.2): - let List.625 : U64 = lowlevel ListLen #Attr.2; - ret List.625; + let List.626 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.626; procedure List.6 (#Attr.2): - let List.627 : U64 = lowlevel ListLen #Attr.2; - ret List.627; + let List.628 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.628; procedure List.66 (#Attr.2, #Attr.3): - let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.602; + let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.603; procedure List.66 (#Attr.2, #Attr.3): - let List.614 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.614; + let List.615 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.615; procedure List.68 (#Attr.2): - let List.629 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.629; + let List.630 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.630; procedure List.70 (#Attr.2, #Attr.3): - let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.576; + let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.577; procedure List.71 (#Attr.2, #Attr.3): - let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.574; + let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.575; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.635 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.635; + let List.636 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.636; procedure List.8 (#Attr.2, #Attr.3): - let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.624; - -procedure List.80 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): - joinpoint List.651 List.489 List.490 List.491 List.492 List.493: - let List.653 : Int1 = CallByName Num.22 List.492 List.493; - if List.653 then - let List.662 : U8 = CallByName List.66 List.489 List.492; - let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.662; - let List.659 : U8 = 1i64; - let List.660 : U8 = GetTagId List.654; - let List.661 : Int1 = lowlevel Eq List.659 List.660; - if List.661 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.654; - let List.657 : U64 = 1i64; - let List.656 : U64 = CallByName Num.51 List.492 List.657; - jump List.651 List.489 List.494 List.491 List.656 List.493; + let List.625 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.625; + +procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): + joinpoint List.652 List.490 List.491 List.492 List.493 List.494: + let List.654 : Int1 = CallByName Num.22 List.493 List.494; + if List.654 then + let List.663 : U8 = CallByName List.66 List.490 List.493; + let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.663; + let List.660 : U8 = 1i64; + let List.661 : U8 = GetTagId List.655; + let List.662 : Int1 = lowlevel Eq List.660 List.661; + if List.662 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.655; + let List.658 : U64 = 1i64; + let List.657 : U64 = CallByName Num.51 List.493 List.658; + jump List.652 List.490 List.495 List.492 List.657 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.654; - let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.658; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.655; + let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.659; else - dec List.489; - let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.652; + dec List.490; + let List.653 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.653; in - jump List.651 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; - -procedure List.90 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): - joinpoint List.607 List.161 List.162 List.163 List.164 List.165: - let List.609 : Int1 = CallByName Num.22 List.164 List.165; - if List.609 then - let List.613 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.613; - let List.612 : U64 = 1i64; - let List.611 : U64 = CallByName Num.51 List.164 List.612; - jump List.607 List.161 List.166 List.163 List.611 List.165; + jump List.652 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + +procedure List.91 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint List.596 List.162 List.163 List.164 List.165 List.166: + let List.598 : Int1 = CallByName Num.22 List.165 List.166; + if List.598 then + let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.602; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; + let List.601 : U64 = 1i64; + let List.600 : U64 = CallByName Num.51 List.165 List.601; + jump List.596 List.162 List.167 List.164 List.600 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.607 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; - -procedure List.90 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): - joinpoint List.595 List.161 List.162 List.163 List.164 List.165: - let List.597 : Int1 = CallByName Num.22 List.164 List.165; - if List.597 then - let List.601 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.601; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.601; - let List.600 : U64 = 1i64; - let List.599 : U64 = CallByName Num.51 List.164 List.600; - jump List.595 List.161 List.166 List.163 List.599 List.165; + jump List.596 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + +procedure List.91 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): + joinpoint List.608 List.162 List.163 List.164 List.165 List.166: + let List.610 : Int1 = CallByName Num.22 List.165 List.166; + if List.610 then + let List.614 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.614; + let List.613 : U64 = 1i64; + let List.612 : U64 = CallByName Num.51 List.165 List.613; + jump List.608 List.162 List.167 List.164 List.612 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.595 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + jump List.608 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure Num.127 (#Attr.2): let Num.272 : U8 = lowlevel NumIntCast #Attr.2; 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 4851d458748..ab0039ecbd0 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 @@ -45,159 +45,159 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.649 : U64 = 0i64; - let List.650 : U64 = CallByName List.6 List.486; - let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.649 List.650; - ret List.648; - -procedure List.18 (List.158, List.159, List.160): - let List.593 : U64 = 0i64; - let List.594 : U64 = CallByName List.6 List.158; - let List.592 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.593 List.594; - ret List.592; - -procedure List.18 (List.158, List.159, List.160): - let List.605 : U64 = 0i64; - let List.606 : U64 = CallByName List.6 List.158; - let List.604 : List U8 = CallByName List.90 List.158 List.159 List.160 List.605 List.606; - ret List.604; - -procedure List.26 (List.199, List.200, List.201): - let List.642 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.645 : U8 = 1i64; - let List.646 : U8 = GetTagId List.642; - let List.647 : Int1 = lowlevel Eq List.645 List.646; - if List.647 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.642; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.642; +procedure List.103 (List.487, List.488, List.489): + let List.650 : U64 = 0i64; + let List.651 : U64 = CallByName List.6 List.487; + let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.650 List.651; + ret List.649; + +procedure List.18 (List.159, List.160, List.161): + let List.594 : U64 = 0i64; + let List.595 : U64 = CallByName List.6 List.159; + let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; + ret List.593; + +procedure List.18 (List.159, List.160, List.161): + let List.606 : U64 = 0i64; + let List.607 : U64 = CallByName List.6 List.159; + let List.605 : List U8 = CallByName List.91 List.159 List.160 List.161 List.606 List.607; + ret List.605; + +procedure List.26 (List.200, List.201, List.202): + let List.643 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.646 : U8 = 1i64; + let List.647 : U8 = GetTagId List.643; + let List.648 : Int1 = lowlevel Eq List.646 List.647; + if List.648 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.643; ret List.203; - -procedure List.4 (List.122, List.123): - let List.591 : U64 = 1i64; - let List.590 : List U8 = CallByName List.70 List.122 List.591; - let List.589 : List U8 = CallByName List.71 List.590 List.123; - ret List.589; - -procedure List.49 (List.418, List.419): - let List.633 : U64 = StructAtIndex 1 List.419; - let List.634 : U64 = StructAtIndex 0 List.419; - let List.632 : List U8 = CallByName List.72 List.418 List.633 List.634; - ret List.632; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.640 List.436: - let List.638 : U64 = 0i64; - let List.637 : {U64, U64} = Struct {List.436, List.638}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.637; - let List.636 : U64 = CallByName Num.75 List.435 List.436; - let List.631 : {U64, U64} = Struct {List.636, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.631; - let List.630 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.630; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.643; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.592 : U64 = 1i64; + let List.591 : List U8 = CallByName List.70 List.123 List.592; + let List.590 : List U8 = CallByName List.71 List.591 List.124; + ret List.590; + +procedure List.49 (List.419, List.420): + let List.634 : U64 = StructAtIndex 1 List.420; + let List.635 : U64 = StructAtIndex 0 List.420; + let List.633 : List U8 = CallByName List.72 List.419 List.634 List.635; + ret List.633; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.641 List.437: + let List.639 : U64 = 0i64; + let List.638 : {U64, U64} = Struct {List.437, List.639}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.638; + let List.637 : U64 = CallByName Num.75 List.436 List.437; + let List.632 : {U64, U64} = Struct {List.637, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.632; + let List.631 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.631; in - let List.641 : Int1 = CallByName Num.24 List.435 List.434; - if List.641 then - jump List.640 List.434; + let List.642 : Int1 = CallByName Num.24 List.436 List.435; + if List.642 then + jump List.641 List.435; else - jump List.640 List.435; + jump List.641 List.436; procedure List.6 (#Attr.2): - let List.625 : U64 = lowlevel ListLen #Attr.2; - ret List.625; + let List.626 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.626; procedure List.6 (#Attr.2): - let List.627 : U64 = lowlevel ListLen #Attr.2; - ret List.627; + let List.628 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.628; procedure List.66 (#Attr.2, #Attr.3): - let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.602; + let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.603; procedure List.66 (#Attr.2, #Attr.3): - let List.614 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.614; + let List.615 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.615; procedure List.68 (#Attr.2): - let List.629 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.629; + let List.630 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.630; procedure List.70 (#Attr.2, #Attr.3): - let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.576; + let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.577; procedure List.71 (#Attr.2, #Attr.3): - let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.574; + let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.575; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.635 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.635; + let List.636 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.636; procedure List.8 (#Attr.2, #Attr.3): - let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.624; - -procedure List.80 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): - joinpoint List.651 List.489 List.490 List.491 List.492 List.493: - let List.653 : Int1 = CallByName Num.22 List.492 List.493; - if List.653 then - let List.662 : U8 = CallByName List.66 List.489 List.492; - let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.662; - let List.659 : U8 = 1i64; - let List.660 : U8 = GetTagId List.654; - let List.661 : Int1 = lowlevel Eq List.659 List.660; - if List.661 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.654; - let List.657 : U64 = 1i64; - let List.656 : U64 = CallByName Num.51 List.492 List.657; - jump List.651 List.489 List.494 List.491 List.656 List.493; + let List.625 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.625; + +procedure List.80 (#Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31): + joinpoint List.652 List.490 List.491 List.492 List.493 List.494: + let List.654 : Int1 = CallByName Num.22 List.493 List.494; + if List.654 then + let List.663 : U8 = CallByName List.66 List.490 List.493; + let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.663; + let List.660 : U8 = 1i64; + let List.661 : U8 = GetTagId List.655; + let List.662 : Int1 = lowlevel Eq List.660 List.661; + if List.662 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.655; + let List.658 : U64 = 1i64; + let List.657 : U64 = CallByName Num.51 List.493 List.658; + jump List.652 List.490 List.495 List.492 List.657 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.654; - let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.658; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.655; + let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.659; else - dec List.489; - let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.652; + dec List.490; + let List.653 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.653; in - jump List.651 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; - -procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): - joinpoint List.607 List.161 List.162 List.163 List.164 List.165: - let List.609 : Int1 = CallByName Num.22 List.164 List.165; - if List.609 then - let List.613 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.613; - let List.612 : U64 = 1i64; - let List.611 : U64 = CallByName Num.51 List.164 List.612; - jump List.607 List.161 List.166 List.163 List.611 List.165; + jump List.652 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31; + +procedure List.91 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): + joinpoint List.596 List.162 List.163 List.164 List.165 List.166: + let List.598 : Int1 = CallByName Num.22 List.165 List.166; + if List.598 then + let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.602; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; + let List.601 : U64 = 1i64; + let List.600 : U64 = CallByName Num.51 List.165 List.601; + jump List.596 List.162 List.167 List.164 List.600 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.607 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; - -procedure List.90 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34): - joinpoint List.595 List.161 List.162 List.163 List.164 List.165: - let List.597 : Int1 = CallByName Num.22 List.164 List.165; - if List.597 then - let List.601 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.601; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.203 List.162 List.601; - let List.600 : U64 = 1i64; - let List.599 : U64 = CallByName Num.51 List.164 List.600; - jump List.595 List.161 List.166 List.163 List.599 List.165; + jump List.596 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; + +procedure List.91 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): + joinpoint List.608 List.162 List.163 List.164 List.165 List.166: + let List.610 : Int1 = CallByName Num.22 List.165 List.166; + if List.610 then + let List.614 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.614; + let List.613 : U64 = 1i64; + let List.612 : U64 = CallByName Num.51 List.165 List.613; + jump List.608 List.162 List.167 List.164 List.612 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.595 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34; + jump List.608 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; procedure Num.127 (#Attr.2): let Num.272 : U8 = lowlevel NumIntCast #Attr.2; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index 9ba0416ccd7..9341835e435 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -11,115 +11,115 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.614 : U64 = 0i64; - let List.615 : U64 = CallByName List.6 List.486; - let List.613 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.614 List.615; - ret List.613; - -procedure List.18 (List.158, List.159, List.160): - let List.585 : U64 = 0i64; - let List.586 : U64 = CallByName List.6 List.158; - let List.584 : List U8 = CallByName List.90 List.158 List.159 List.160 List.585 List.586; - ret List.584; - -procedure List.26 (List.199, List.200, List.201): - let List.607 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.610 : U8 = 1i64; - let List.611 : U8 = GetTagId List.607; - let List.612 : Int1 = lowlevel Eq List.610 List.611; - if List.612 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.607; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.607; +procedure List.103 (List.487, List.488, List.489): + let List.615 : U64 = 0i64; + let List.616 : U64 = CallByName List.6 List.487; + let List.614 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.615 List.616; + ret List.614; + +procedure List.18 (List.159, List.160, List.161): + let List.586 : U64 = 0i64; + let List.587 : U64 = CallByName List.6 List.159; + let List.585 : List U8 = CallByName List.91 List.159 List.160 List.161 List.586 List.587; + ret List.585; + +procedure List.26 (List.200, List.201, List.202): + let List.608 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.611 : U8 = 1i64; + let List.612 : U8 = GetTagId List.608; + let List.613 : Int1 = lowlevel Eq List.611 List.612; + if List.613 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.608; ret List.203; - -procedure List.49 (List.418, List.419): - let List.598 : U64 = StructAtIndex 1 List.419; - let List.599 : U64 = StructAtIndex 0 List.419; - let List.597 : List U8 = CallByName List.72 List.418 List.598 List.599; - ret List.597; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.605 List.436: - let List.603 : U64 = 0i64; - let List.602 : {U64, U64} = Struct {List.436, List.603}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.602; - let List.601 : U64 = CallByName Num.75 List.435 List.436; - let List.596 : {U64, U64} = Struct {List.601, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.596; - let List.595 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.595; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.608; + ret List.204; + +procedure List.49 (List.419, List.420): + let List.599 : U64 = StructAtIndex 1 List.420; + let List.600 : U64 = StructAtIndex 0 List.420; + let List.598 : List U8 = CallByName List.72 List.419 List.599 List.600; + ret List.598; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.606 List.437: + let List.604 : U64 = 0i64; + let List.603 : {U64, U64} = Struct {List.437, List.604}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.603; + let List.602 : U64 = CallByName Num.75 List.436 List.437; + let List.597 : {U64, U64} = Struct {List.602, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.597; + let List.596 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.596; in - let List.606 : Int1 = CallByName Num.24 List.435 List.434; - if List.606 then - jump List.605 List.434; + let List.607 : Int1 = CallByName Num.24 List.436 List.435; + if List.607 then + jump List.606 List.435; else - jump List.605 List.435; + jump List.606 List.436; procedure List.6 (#Attr.2): - let List.583 : U64 = lowlevel ListLen #Attr.2; - ret List.583; + let List.584 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.584; procedure List.66 (#Attr.2, #Attr.3): - let List.594 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.594; + let List.595 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.595; procedure List.68 (#Attr.2): - let List.581 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.581; + let List.582 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.582; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.600 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.600; + let List.601 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.601; procedure List.8 (#Attr.2, #Attr.3): - let List.579 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.579; + let List.580 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.580; procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.616 List.489 List.490 List.491 List.492 List.493: - let List.618 : Int1 = CallByName Num.22 List.492 List.493; - if List.618 then - let List.627 : U8 = CallByName List.66 List.489 List.492; - let List.619 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.627; - let List.624 : U8 = 1i64; - let List.625 : U8 = GetTagId List.619; - let List.626 : Int1 = lowlevel Eq List.624 List.625; - if List.626 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.619; - let List.622 : U64 = 1i64; - let List.621 : U64 = CallByName Num.51 List.492 List.622; - jump List.616 List.489 List.494 List.491 List.621 List.493; + joinpoint List.617 List.490 List.491 List.492 List.493 List.494: + let List.619 : Int1 = CallByName Num.22 List.493 List.494; + if List.619 then + let List.628 : U8 = CallByName List.66 List.490 List.493; + let List.620 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.628; + let List.625 : U8 = 1i64; + let List.626 : U8 = GetTagId List.620; + let List.627 : Int1 = lowlevel Eq List.625 List.626; + if List.627 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.620; + let List.623 : U64 = 1i64; + let List.622 : U64 = CallByName Num.51 List.493 List.623; + jump List.617 List.490 List.495 List.492 List.622 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.619; - let List.623 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.623; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.620; + let List.624 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.624; else - dec List.489; - let List.617 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.617; + dec List.490; + let List.618 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.618; in - jump List.616 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; - -procedure List.90 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): - joinpoint List.587 List.161 List.162 List.163 List.164 List.165: - let List.589 : Int1 = CallByName Num.22 List.164 List.165; - if List.589 then - let List.593 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.593; - let List.592 : U64 = 1i64; - let List.591 : U64 = CallByName Num.51 List.164 List.592; - jump List.587 List.161 List.166 List.163 List.591 List.165; + jump List.617 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + +procedure List.91 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): + joinpoint List.588 List.162 List.163 List.164 List.165 List.166: + let List.590 : Int1 = CallByName Num.22 List.165 List.166; + if List.590 then + let List.594 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.594; + let List.593 : U64 = 1i64; + let List.592 : U64 = CallByName Num.51 List.165 List.593; + jump List.588 List.162 List.167 List.164 List.592 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.587 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; + jump List.588 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; procedure Num.137 (#Attr.2, #Attr.3): let Num.269 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; 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 e63e927306c..6ff0ef18740 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 @@ -40,159 +40,159 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.655 : U64 = 0i64; - let List.656 : U64 = CallByName List.6 List.486; - let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.655 List.656; - ret List.654; - -procedure List.18 (List.158, List.159, List.160): - let List.599 : U64 = 0i64; - let List.600 : U64 = CallByName List.6 List.158; - let List.598 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.599 List.600; - ret List.598; - -procedure List.18 (List.158, List.159, List.160): - let List.611 : U64 = 0i64; - let List.612 : U64 = CallByName List.6 List.158; - let List.610 : List U8 = CallByName List.90 List.158 List.159 List.160 List.611 List.612; - ret List.610; - -procedure List.26 (List.199, List.200, List.201): - let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.651 : U8 = 1i64; - let List.652 : U8 = GetTagId List.648; - let List.653 : Int1 = lowlevel Eq List.651 List.652; - if List.653 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648; +procedure List.103 (List.487, List.488, List.489): + let List.656 : U64 = 0i64; + let List.657 : U64 = CallByName List.6 List.487; + let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.656 List.657; + ret List.655; + +procedure List.18 (List.159, List.160, List.161): + let List.600 : U64 = 0i64; + let List.601 : U64 = CallByName List.6 List.159; + let List.599 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.600 List.601; + ret List.599; + +procedure List.18 (List.159, List.160, List.161): + let List.612 : U64 = 0i64; + let List.613 : U64 = CallByName List.6 List.159; + let List.611 : List U8 = CallByName List.91 List.159 List.160 List.161 List.612 List.613; + ret List.611; + +procedure List.26 (List.200, List.201, List.202): + let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.652 : U8 = 1i64; + let List.653 : U8 = GetTagId List.649; + let List.654 : Int1 = lowlevel Eq List.652 List.653; + if List.654 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.649; ret List.203; - -procedure List.4 (List.122, List.123): - let List.597 : U64 = 1i64; - let List.596 : List U8 = CallByName List.70 List.122 List.597; - let List.595 : List U8 = CallByName List.71 List.596 List.123; - ret List.595; - -procedure List.49 (List.418, List.419): - let List.639 : U64 = StructAtIndex 1 List.419; - let List.640 : U64 = StructAtIndex 0 List.419; - let List.638 : List U8 = CallByName List.72 List.418 List.639 List.640; - ret List.638; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.646 List.436: - let List.644 : U64 = 0i64; - let List.643 : {U64, U64} = Struct {List.436, List.644}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.643; - let List.642 : U64 = CallByName Num.75 List.435 List.436; - let List.637 : {U64, U64} = Struct {List.642, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.637; - let List.636 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.636; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.649; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.598 : U64 = 1i64; + let List.597 : List U8 = CallByName List.70 List.123 List.598; + let List.596 : List U8 = CallByName List.71 List.597 List.124; + ret List.596; + +procedure List.49 (List.419, List.420): + let List.640 : U64 = StructAtIndex 1 List.420; + let List.641 : U64 = StructAtIndex 0 List.420; + let List.639 : List U8 = CallByName List.72 List.419 List.640 List.641; + ret List.639; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.647 List.437: + let List.645 : U64 = 0i64; + let List.644 : {U64, U64} = Struct {List.437, List.645}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.644; + let List.643 : U64 = CallByName Num.75 List.436 List.437; + let List.638 : {U64, U64} = Struct {List.643, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.638; + let List.637 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.637; in - let List.647 : Int1 = CallByName Num.24 List.435 List.434; - if List.647 then - jump List.646 List.434; + let List.648 : Int1 = CallByName Num.24 List.436 List.435; + if List.648 then + jump List.647 List.435; else - jump List.646 List.435; + jump List.647 List.436; procedure List.6 (#Attr.2): - let List.622 : U64 = lowlevel ListLen #Attr.2; - ret List.622; + let List.623 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.623; procedure List.6 (#Attr.2): - let List.624 : U64 = lowlevel ListLen #Attr.2; - ret List.624; + let List.625 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.625; procedure List.66 (#Attr.2, #Attr.3): - let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.608; + let List.609 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.609; procedure List.66 (#Attr.2, #Attr.3): - let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.620; + let List.621 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.621; procedure List.68 (#Attr.2): - let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.635; + let List.636 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.636; procedure List.70 (#Attr.2, #Attr.3): - let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.576; + let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.577; procedure List.71 (#Attr.2, #Attr.3): - let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.574; + let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.575; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.641; + let List.642 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.642; procedure List.8 (#Attr.2, #Attr.3): - let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.633; + let List.634 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.634; procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): - joinpoint List.657 List.489 List.490 List.491 List.492 List.493: - let List.659 : Int1 = CallByName Num.22 List.492 List.493; - if List.659 then - let List.668 : U8 = CallByName List.66 List.489 List.492; - let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.668; - let List.665 : U8 = 1i64; - let List.666 : U8 = GetTagId List.660; - let List.667 : Int1 = lowlevel Eq List.665 List.666; - if List.667 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660; - let List.663 : U64 = 1i64; - let List.662 : U64 = CallByName Num.51 List.492 List.663; - jump List.657 List.489 List.494 List.491 List.662 List.493; + joinpoint List.658 List.490 List.491 List.492 List.493 List.494: + let List.660 : Int1 = CallByName Num.22 List.493 List.494; + if List.660 then + let List.669 : U8 = CallByName List.66 List.490 List.493; + let List.661 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.669; + let List.666 : U8 = 1i64; + let List.667 : U8 = GetTagId List.661; + let List.668 : Int1 = lowlevel Eq List.666 List.667; + if List.668 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.661; + let List.664 : U64 = 1i64; + let List.663 : U64 = CallByName Num.51 List.493 List.664; + jump List.658 List.490 List.495 List.492 List.663 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660; - let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.664; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.661; + let List.665 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.665; else - dec List.489; - let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.658; + dec List.490; + let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.659; in - jump List.657 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; - -procedure List.90 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): - joinpoint List.613 List.161 List.162 List.163 List.164 List.165: - let List.615 : Int1 = CallByName Num.22 List.164 List.165; - if List.615 then - let List.619 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; - let List.618 : U64 = 1i64; - let List.617 : U64 = CallByName Num.51 List.164 List.618; - jump List.613 List.161 List.166 List.163 List.617 List.165; + jump List.658 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + +procedure List.91 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): + joinpoint List.614 List.162 List.163 List.164 List.165 List.166: + let List.616 : Int1 = CallByName Num.22 List.165 List.166; + if List.616 then + let List.620 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.620; + let List.619 : U64 = 1i64; + let List.618 : U64 = CallByName Num.51 List.165 List.619; + jump List.614 List.162 List.167 List.164 List.618 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.613 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; - -procedure List.90 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): - joinpoint List.601 List.161 List.162 List.163 List.164 List.165: - let List.603 : Int1 = CallByName Num.22 List.164 List.165; - if List.603 then - let List.607 : Str = CallByName List.66 List.161 List.164; - inc List.607; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.607; - let List.606 : U64 = 1i64; - let List.605 : U64 = CallByName Num.51 List.164 List.606; - jump List.601 List.161 List.166 List.163 List.605 List.165; + jump List.614 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; + +procedure List.91 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): + joinpoint List.602 List.162 List.163 List.164 List.165 List.166: + let List.604 : Int1 = CallByName Num.22 List.165 List.166; + if List.604 then + let List.608 : Str = CallByName List.66 List.162 List.165; + inc List.608; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.608; + let List.607 : U64 = 1i64; + let List.606 : U64 = CallByName Num.51 List.165 List.607; + jump List.602 List.162 List.167 List.164 List.606 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.601 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.602 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure Num.127 (#Attr.2): let Num.274 : U8 = lowlevel NumIntCast #Attr.2; 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 46c5101c767..c921fe7aaab 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 @@ -43,159 +43,159 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.655 : U64 = 0i64; - let List.656 : U64 = CallByName List.6 List.486; - let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.655 List.656; - ret List.654; - -procedure List.18 (List.158, List.159, List.160): - let List.599 : U64 = 0i64; - let List.600 : U64 = CallByName List.6 List.158; - let List.598 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.599 List.600; - ret List.598; - -procedure List.18 (List.158, List.159, List.160): - let List.611 : U64 = 0i64; - let List.612 : U64 = CallByName List.6 List.158; - let List.610 : List U8 = CallByName List.90 List.158 List.159 List.160 List.611 List.612; - ret List.610; - -procedure List.26 (List.199, List.200, List.201): - let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.651 : U8 = 1i64; - let List.652 : U8 = GetTagId List.648; - let List.653 : Int1 = lowlevel Eq List.651 List.652; - if List.653 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648; +procedure List.103 (List.487, List.488, List.489): + let List.656 : U64 = 0i64; + let List.657 : U64 = CallByName List.6 List.487; + let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.656 List.657; + ret List.655; + +procedure List.18 (List.159, List.160, List.161): + let List.600 : U64 = 0i64; + let List.601 : U64 = CallByName List.6 List.159; + let List.599 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.600 List.601; + ret List.599; + +procedure List.18 (List.159, List.160, List.161): + let List.612 : U64 = 0i64; + let List.613 : U64 = CallByName List.6 List.159; + let List.611 : List U8 = CallByName List.91 List.159 List.160 List.161 List.612 List.613; + ret List.611; + +procedure List.26 (List.200, List.201, List.202): + let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.652 : U8 = 1i64; + let List.653 : U8 = GetTagId List.649; + let List.654 : Int1 = lowlevel Eq List.652 List.653; + if List.654 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.649; ret List.203; - -procedure List.4 (List.122, List.123): - let List.597 : U64 = 1i64; - let List.596 : List U8 = CallByName List.70 List.122 List.597; - let List.595 : List U8 = CallByName List.71 List.596 List.123; - ret List.595; - -procedure List.49 (List.418, List.419): - let List.639 : U64 = StructAtIndex 1 List.419; - let List.640 : U64 = StructAtIndex 0 List.419; - let List.638 : List U8 = CallByName List.72 List.418 List.639 List.640; - ret List.638; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.646 List.436: - let List.644 : U64 = 0i64; - let List.643 : {U64, U64} = Struct {List.436, List.644}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.643; - let List.642 : U64 = CallByName Num.75 List.435 List.436; - let List.637 : {U64, U64} = Struct {List.642, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.637; - let List.636 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.636; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.649; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.598 : U64 = 1i64; + let List.597 : List U8 = CallByName List.70 List.123 List.598; + let List.596 : List U8 = CallByName List.71 List.597 List.124; + ret List.596; + +procedure List.49 (List.419, List.420): + let List.640 : U64 = StructAtIndex 1 List.420; + let List.641 : U64 = StructAtIndex 0 List.420; + let List.639 : List U8 = CallByName List.72 List.419 List.640 List.641; + ret List.639; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.647 List.437: + let List.645 : U64 = 0i64; + let List.644 : {U64, U64} = Struct {List.437, List.645}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.644; + let List.643 : U64 = CallByName Num.75 List.436 List.437; + let List.638 : {U64, U64} = Struct {List.643, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.638; + let List.637 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.637; in - let List.647 : Int1 = CallByName Num.24 List.435 List.434; - if List.647 then - jump List.646 List.434; + let List.648 : Int1 = CallByName Num.24 List.436 List.435; + if List.648 then + jump List.647 List.435; else - jump List.646 List.435; + jump List.647 List.436; procedure List.6 (#Attr.2): - let List.622 : U64 = lowlevel ListLen #Attr.2; - ret List.622; + let List.623 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.623; procedure List.6 (#Attr.2): - let List.624 : U64 = lowlevel ListLen #Attr.2; - ret List.624; + let List.625 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.625; procedure List.66 (#Attr.2, #Attr.3): - let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.608; + let List.609 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.609; procedure List.66 (#Attr.2, #Attr.3): - let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.620; + let List.621 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.621; procedure List.68 (#Attr.2): - let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.635; + let List.636 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.636; procedure List.70 (#Attr.2, #Attr.3): - let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.576; + let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.577; procedure List.71 (#Attr.2, #Attr.3): - let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.574; + let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.575; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.641; + let List.642 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.642; procedure List.8 (#Attr.2, #Attr.3): - let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.633; - -procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint List.657 List.489 List.490 List.491 List.492 List.493: - let List.659 : Int1 = CallByName Num.22 List.492 List.493; - if List.659 then - let List.668 : U8 = CallByName List.66 List.489 List.492; - let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.668; - let List.665 : U8 = 1i64; - let List.666 : U8 = GetTagId List.660; - let List.667 : Int1 = lowlevel Eq List.665 List.666; - if List.667 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660; - let List.663 : U64 = 1i64; - let List.662 : U64 = CallByName Num.51 List.492 List.663; - jump List.657 List.489 List.494 List.491 List.662 List.493; + let List.634 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.634; + +procedure List.80 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): + joinpoint List.658 List.490 List.491 List.492 List.493 List.494: + let List.660 : Int1 = CallByName Num.22 List.493 List.494; + if List.660 then + let List.669 : U8 = CallByName List.66 List.490 List.493; + let List.661 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.669; + let List.666 : U8 = 1i64; + let List.667 : U8 = GetTagId List.661; + let List.668 : Int1 = lowlevel Eq List.666 List.667; + if List.668 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.661; + let List.664 : U64 = 1i64; + let List.663 : U64 = CallByName Num.51 List.493 List.664; + jump List.658 List.490 List.495 List.492 List.663 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660; - let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.664; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.661; + let List.665 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.665; else - dec List.489; - let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.658; + dec List.490; + let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.659; in - jump List.657 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; - -procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): - joinpoint List.601 List.161 List.162 List.163 List.164 List.165: - let List.603 : Int1 = CallByName Num.22 List.164 List.165; - if List.603 then - let List.607 : Str = CallByName List.66 List.161 List.164; - inc List.607; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.607; - let List.606 : U64 = 1i64; - let List.605 : U64 = CallByName Num.51 List.164 List.606; - jump List.601 List.161 List.166 List.163 List.605 List.165; + jump List.658 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; + +procedure List.91 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): + joinpoint List.614 List.162 List.163 List.164 List.165 List.166: + let List.616 : Int1 = CallByName Num.22 List.165 List.166; + if List.616 then + let List.620 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.620; + let List.619 : U64 = 1i64; + let List.618 : U64 = CallByName Num.51 List.165 List.619; + jump List.614 List.162 List.167 List.164 List.618 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.601 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; - -procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): - joinpoint List.613 List.161 List.162 List.163 List.164 List.165: - let List.615 : Int1 = CallByName Num.22 List.164 List.165; - if List.615 then - let List.619 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.619; - let List.618 : U64 = 1i64; - let List.617 : U64 = CallByName Num.51 List.164 List.618; - jump List.613 List.161 List.166 List.163 List.617 List.165; + jump List.614 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + +procedure List.91 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): + joinpoint List.602 List.162 List.163 List.164 List.165 List.166: + let List.604 : Int1 = CallByName Num.22 List.165 List.166; + if List.604 then + let List.608 : Str = CallByName List.66 List.162 List.165; + inc List.608; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.608; + let List.607 : U64 = 1i64; + let List.606 : U64 = CallByName Num.51 List.165 List.607; + jump List.602 List.162 List.167 List.164 List.606 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.613 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; + jump List.602 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.127 (#Attr.2): let Num.274 : U8 = lowlevel NumIntCast #Attr.2; diff --git a/crates/compiler/test_mono/generated/inspect_derived_dict.txt b/crates/compiler/test_mono/generated/inspect_derived_dict.txt index cab8223ffb4..7a5a529443d 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_dict.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_dict.txt @@ -283,7 +283,7 @@ procedure Dict.65 (Dict.404, Dict.405, Dict.406): let Dict.846 : {U64, U32} = CallByName Dict.66 Dict.404 Dict.409 Dict.408; ret Dict.846; -procedure Dict.66 (#Derived_gen.9, #Derived_gen.10, #Derived_gen.11): +procedure Dict.66 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16): joinpoint Dict.847 Dict.410 Dict.411 Dict.412: let Dict.413 : {U32, U32} = CallByName Dict.22 Dict.410 Dict.411; let Dict.854 : U32 = StructAtIndex 1 Dict.413; @@ -298,9 +298,9 @@ procedure Dict.66 (#Derived_gen.9, #Derived_gen.10, #Derived_gen.11): let Dict.848 : {U64, U32} = Struct {Dict.411, Dict.412}; ret Dict.848; in - jump Dict.847 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11; + jump Dict.847 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16; -procedure Dict.67 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27): +procedure Dict.67 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35): joinpoint Dict.753 Dict.414 Dict.415 Dict.416: let Dict.417 : {U32, U32} = CallByName Dict.22 Dict.414 Dict.416; let Dict.763 : U32 = StructAtIndex 1 Dict.417; @@ -319,7 +319,7 @@ procedure Dict.67 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27): let Dict.754 : List {U32, U32} = CallByName List.3 Dict.414 Dict.416 Dict.415; ret Dict.754; in - jump Dict.753 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + jump Dict.753 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35; procedure Dict.68 (Dict.419, Dict.420): let Dict.749 : U64 = 1i64; @@ -500,7 +500,7 @@ procedure Dict.82 (Dict.702, Dict.480): let Dict.917 : {U64, U64, U64} = CallByName Dict.83 Dict.478 Dict.478 Dict.478 Dict.480 Dict.919 Dict.481; jump Dict.918 Dict.917; -procedure Dict.83 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37, #Derived_gen.38): +procedure Dict.83 (#Derived_gen.36, #Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40, #Derived_gen.41): joinpoint Dict.920 Dict.486 Dict.487 Dict.488 Dict.489 Dict.490 Dict.491: inc 6 Dict.489; let Dict.1027 : U64 = CallByName Dict.91 Dict.489 Dict.490; @@ -562,9 +562,9 @@ procedure Dict.83 (#Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_g let Dict.921 : {U64, U64, U64} = Struct {Dict.922, Dict.923, Dict.498}; ret Dict.921; in - jump Dict.920 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38; + jump Dict.920 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41; -procedure Dict.84 (#Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): +procedure Dict.84 (#Derived_gen.44, #Derived_gen.45, #Derived_gen.46, #Derived_gen.47): joinpoint Dict.973 Dict.499 Dict.500 Dict.501 Dict.502: inc 2 Dict.500; let Dict.993 : U64 = CallByName Dict.91 Dict.500 Dict.501; @@ -596,7 +596,7 @@ procedure Dict.84 (#Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_g else jump Dict.973 Dict.503 Dict.500 Dict.505 Dict.504; in - jump Dict.973 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; + jump Dict.973 #Derived_gen.44 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47; procedure Dict.85 (): let Dict.910 : U64 = 11562461410679940143i64; @@ -880,168 +880,168 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.11 (List.136, List.137): - let List.633 : List {U32, U32} = CallByName List.68 List.137; - let List.632 : List {U32, U32} = CallByName List.88 List.136 List.137 List.633; - ret List.632; - -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; - -procedure List.18 (List.158, List.159, List.160): - let List.636 : U64 = 0i64; - let List.637 : U64 = CallByName List.6 List.158; - let List.635 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.636 List.637; - ret List.635; - -procedure List.3 (List.114, List.115, List.116): - let List.597 : {List {U32, U32}, {U32, U32}} = CallByName List.64 List.114 List.115 List.116; - let List.596 : List {U32, U32} = StructAtIndex 0 List.597; - ret List.596; - -procedure List.3 (List.114, List.115, List.116): - let List.599 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.114 List.115 List.116; - let List.598 : List {Str, I64} = StructAtIndex 0 List.599; - let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.599; +procedure List.11 (List.137, List.138): + let List.634 : List {U32, U32} = CallByName List.68 List.138; + let List.633 : List {U32, U32} = CallByName List.89 List.137 List.138 List.634; + ret List.633; + +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; + +procedure List.18 (List.159, List.160, List.161): + let List.637 : U64 = 0i64; + let List.638 : U64 = CallByName List.6 List.159; + let List.636 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.637 List.638; + ret List.636; + +procedure List.3 (List.115, List.116, List.117): + let List.598 : {List {U32, U32}, {U32, U32}} = CallByName List.64 List.115 List.116 List.117; + let List.597 : List {U32, U32} = StructAtIndex 0 List.598; + ret List.597; + +procedure List.3 (List.115, List.116, List.117): + let List.600 : {List {Str, I64}, {Str, I64}} = CallByName List.64 List.115 List.116 List.117; + let List.599 : List {Str, I64} = StructAtIndex 0 List.600; + let #Derived_gen.71 : {Str, I64} = StructAtIndex 1 List.600; dec #Derived_gen.71; - ret List.598; + ret List.599; -procedure List.4 (List.122, List.123): - let List.608 : U64 = 1i64; - let List.606 : List {Str, I64} = CallByName List.70 List.122 List.608; - let List.605 : List {Str, I64} = CallByName List.71 List.606 List.123; - ret List.605; +procedure List.4 (List.123, List.124): + let List.609 : U64 = 1i64; + let List.607 : List {Str, I64} = CallByName List.70 List.123 List.609; + let List.606 : List {Str, I64} = CallByName List.71 List.607 List.124; + ret List.606; procedure List.6 (#Attr.2): - let List.587 : U64 = lowlevel ListLen #Attr.2; - ret List.587; + let List.588 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.588; procedure List.6 (#Attr.2): - let List.634 : U64 = lowlevel ListLen #Attr.2; - ret List.634; + let List.635 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.635; procedure List.6 (#Attr.2): - let List.646 : U64 = lowlevel ListLen #Attr.2; - ret List.646; - -procedure List.64 (List.111, List.112, List.113): - let List.595 : U64 = CallByName List.6 List.111; - let List.592 : Int1 = CallByName Num.22 List.112 List.595; - if List.592 then - let List.593 : {List {U32, U32}, {U32, U32}} = CallByName List.67 List.111 List.112 List.113; - ret List.593; + let List.647 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.647; + +procedure List.64 (List.112, List.113, List.114): + let List.596 : U64 = CallByName List.6 List.112; + let List.593 : Int1 = CallByName Num.22 List.113 List.596; + if List.593 then + let List.594 : {List {U32, U32}, {U32, U32}} = CallByName List.67 List.112 List.113 List.114; + ret List.594; else - let List.591 : {List {U32, U32}, {U32, U32}} = Struct {List.111, List.113}; - ret List.591; - -procedure List.64 (List.111, List.112, List.113): - let List.604 : U64 = CallByName List.6 List.111; - let List.601 : Int1 = CallByName Num.22 List.112 List.604; - if List.601 then - let List.602 : {List {Str, I64}, {Str, I64}} = CallByName List.67 List.111 List.112 List.113; - ret List.602; + let List.592 : {List {U32, U32}, {U32, U32}} = Struct {List.112, List.114}; + ret List.592; + +procedure List.64 (List.112, List.113, List.114): + let List.605 : U64 = CallByName List.6 List.112; + let List.602 : Int1 = CallByName Num.22 List.113 List.605; + if List.602 then + let List.603 : {List {Str, I64}, {Str, I64}} = CallByName List.67 List.112 List.113 List.114; + ret List.603; else - let List.600 : {List {Str, I64}, {Str, I64}} = Struct {List.111, List.113}; - ret List.600; + let List.601 : {List {Str, I64}, {Str, I64}} = Struct {List.112, List.114}; + ret List.601; procedure List.66 (#Attr.2, #Attr.3): - let List.645 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.645; + let List.646 : {Str, I64} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.646; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.594 : {List {U32, U32}, {U32, U32}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.594; + let List.595 : {List {U32, U32}, {U32, U32}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.595; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.603 : {List {Str, I64}, {Str, I64}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.603; + let List.604 : {List {Str, I64}, {Str, I64}} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.604; procedure List.68 (#Attr.2): - let List.631 : List {U32, U32} = lowlevel ListWithCapacity #Attr.2; - ret List.631; + let List.632 : List {U32, U32} = lowlevel ListWithCapacity #Attr.2; + ret List.632; procedure List.70 (#Attr.2, #Attr.3): - let List.609 : List {Str, I64} = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.609; + let List.610 : List {Str, I64} = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.610; procedure List.71 (#Attr.2, #Attr.3): - let List.607 : List {Str, I64} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.607; + let List.608 : List {Str, I64} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.71 (#Attr.2, #Attr.3): - let List.628 : List {U32, U32} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.628; - -procedure List.83 (List.167, List.168, List.169): - let List.611 : U64 = 0i64; - let List.612 : U64 = CallByName List.6 List.167; - let List.610 : List {U32, U32} = CallByName List.91 List.167 List.168 List.169 List.611 List.612; - ret List.610; - -procedure List.88 (#Derived_gen.55, #Derived_gen.56, #Derived_gen.57): - joinpoint List.622 List.138 List.139 List.140: - let List.630 : U64 = 0i64; - let List.624 : Int1 = CallByName Num.24 List.139 List.630; - if List.624 then - let List.629 : U64 = 1i64; - let List.626 : U64 = CallByName Num.75 List.139 List.629; - let List.627 : List {U32, U32} = CallByName List.71 List.140 List.138; - jump List.622 List.138 List.626 List.627; + let List.629 : List {U32, U32} = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.629; + +procedure List.83 (List.168, List.169, List.170): + let List.612 : U64 = 0i64; + let List.613 : U64 = CallByName List.6 List.168; + let List.611 : List {U32, U32} = CallByName List.92 List.168 List.169 List.170 List.612 List.613; + ret List.611; + +procedure List.89 (#Derived_gen.30, #Derived_gen.31, #Derived_gen.32): + joinpoint List.623 List.139 List.140 List.141: + let List.631 : U64 = 0i64; + let List.625 : Int1 = CallByName Num.24 List.140 List.631; + if List.625 then + let List.630 : U64 = 1i64; + let List.627 : U64 = CallByName Num.75 List.140 List.630; + let List.628 : List {U32, U32} = CallByName List.71 List.141 List.139; + jump List.623 List.139 List.627 List.628; else - ret List.140; + ret List.141; in - jump List.622 #Derived_gen.55 #Derived_gen.56 #Derived_gen.57; - -procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : {Str, I64} = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.152 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + jump List.623 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32; + +procedure List.91 (#Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : {Str, I64} = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : {List {U32, U32}, List {Str, I64}, U64, Float32, U8} = CallByName Dict.152 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; - -procedure List.90 (#Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32): - joinpoint List.638 List.161 List.162 List.163 List.164 List.165: - let List.640 : Int1 = CallByName Num.22 List.164 List.165; - if List.640 then - let List.644 : {Str, I64} = CallByName List.66 List.161 List.164; - inc List.644; - let List.166 : {Str, Int1} = CallByName Dict.181 List.162 List.644 List.163; - let List.643 : U64 = 1i64; - let List.642 : U64 = CallByName Num.51 List.164 List.643; - jump List.638 List.161 List.166 List.163 List.642 List.165; + jump List.575 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29; + +procedure List.91 (#Derived_gen.53, #Derived_gen.54, #Derived_gen.55, #Derived_gen.56, #Derived_gen.57): + joinpoint List.639 List.162 List.163 List.164 List.165 List.166: + let List.641 : Int1 = CallByName Num.22 List.165 List.166; + if List.641 then + let List.645 : {Str, I64} = CallByName List.66 List.162 List.165; + inc List.645; + let List.167 : {Str, Int1} = CallByName Dict.181 List.163 List.645 List.164; + let List.644 : U64 = 1i64; + let List.643 : U64 = CallByName Num.51 List.165 List.644; + jump List.639 List.162 List.167 List.164 List.643 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.638 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32; - -procedure List.91 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49): - joinpoint List.613 List.170 List.171 List.172 List.173 List.174: - let List.615 : Int1 = CallByName Num.22 List.173 List.174; - if List.615 then - let List.619 : {Str, I64} = CallByName List.66 List.170 List.173; - inc List.619; - let List.175 : List {U32, U32} = CallByName Dict.398 List.171 List.619 List.173 List.172; - let List.618 : U64 = 1i64; - let List.617 : U64 = CallByName Num.51 List.173 List.618; - jump List.613 List.170 List.175 List.172 List.617 List.174; + jump List.639 #Derived_gen.53 #Derived_gen.54 #Derived_gen.55 #Derived_gen.56 #Derived_gen.57; + +procedure List.92 (#Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13): + joinpoint List.614 List.171 List.172 List.173 List.174 List.175: + let List.616 : Int1 = CallByName Num.22 List.174 List.175; + if List.616 then + let List.620 : {Str, I64} = CallByName List.66 List.171 List.174; + inc List.620; + let List.176 : List {U32, U32} = CallByName Dict.398 List.172 List.620 List.174 List.173; + let List.619 : U64 = 1i64; + let List.618 : U64 = CallByName Num.51 List.174 List.619; + jump List.614 List.171 List.176 List.173 List.618 List.175; else - dec List.170; - ret List.171; + dec List.171; + ret List.172; in - jump List.613 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49; + jump List.614 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13; procedure Num.131 (#Attr.2): let Num.275 : U32 = lowlevel NumIntCast #Attr.2; diff --git a/crates/compiler/test_mono/generated/inspect_derived_list.txt b/crates/compiler/test_mono/generated/inspect_derived_list.txt index 2390072f559..8d3ef195ad5 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_list.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_list.txt @@ -125,34 +125,34 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : I64 = CallByName List.66 List.161 List.164; - let List.166 : {Str, Int1} = CallByName Inspect.156 List.162 List.580 List.163; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : I64 = CallByName List.66 List.162 List.165; + let List.167 : {Str, Int1} = CallByName Inspect.156 List.163 List.581 List.164; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16; + jump List.575 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; procedure Num.22 (#Attr.2, #Attr.3): let Num.269 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 f802203459d..0d92ec94fc4 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 @@ -200,65 +200,65 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; - -procedure List.18 (List.158, List.159, List.160): - let List.584 : U64 = 0i64; - let List.585 : U64 = CallByName List.6 List.158; - let List.583 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.584 List.585; - ret List.583; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; + +procedure List.18 (List.159, List.160, List.161): + let List.585 : U64 = 0i64; + let List.586 : U64 = CallByName List.6 List.159; + let List.584 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.585 List.586; + ret List.584; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.6 (#Attr.2): - let List.594 : U64 = lowlevel ListLen #Attr.2; - ret List.594; + let List.595 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.595; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; + let List.582 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; procedure List.66 (#Attr.2, #Attr.3): - let List.593 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.593; - -procedure List.90 (#Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35, #Derived_gen.36): - joinpoint List.586 List.161 List.162 List.163 List.164 List.165: - let List.588 : Int1 = CallByName Num.22 List.164 List.165; - if List.588 then - let List.592 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.592; - let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.592; - let List.591 : U64 = 1i64; - let List.590 : U64 = CallByName Num.51 List.164 List.591; - jump List.586 List.161 List.166 List.163 List.590 List.165; + let List.594 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.594; + +procedure List.91 (#Derived_gen.34, #Derived_gen.35, #Derived_gen.36, #Derived_gen.37, #Derived_gen.38): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : {Str, Int1} = CallByName Inspect.229 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.586 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36; - -procedure List.90 (#Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40, #Derived_gen.41): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + jump List.575 #Derived_gen.34 #Derived_gen.35 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38; + +procedure List.91 (#Derived_gen.39, #Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43): + joinpoint List.587 List.162 List.163 List.164 List.165 List.166: + let List.589 : Int1 = CallByName Num.22 List.165 List.166; + if List.589 then + let List.593 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.593; + let List.167 : {Str, Int1} = CallByName Inspect.229 List.163 List.593; + let List.592 : U64 = 1i64; + let List.591 : U64 = CallByName Num.51 List.165 List.592; + jump List.587 List.162 List.167 List.164 List.591 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41; + jump List.587 #Derived_gen.39 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43; procedure Num.22 (#Attr.2, #Attr.3): let Num.270 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/inspect_derived_record.txt b/crates/compiler/test_mono/generated/inspect_derived_record.txt index 78ec3954376..166bd1ffacf 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record.txt @@ -150,35 +150,35 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : {[C I64, C Decimal], Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : {[C I64, C Decimal], Str} = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : {[C I64, C Decimal], Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : {[C I64, C Decimal], Str} = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : {Str, Int1} = CallByName Inspect.229 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; + jump List.575 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.22 (#Attr.2, #Attr.3): let Num.270 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 7accd4c2231..297337b44c7 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 @@ -127,35 +127,35 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : {Str, Int1} = CallByName Inspect.229 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; + jump List.575 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 21e08c98ed5..55080253489 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 @@ -134,35 +134,35 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : {Str, Int1} = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : {Str, Int1} = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : {Str, Str} = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : {Str, Int1} = CallByName Inspect.229 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : {Str, Int1} = CallByName Inspect.229 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; + jump List.575 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 3f9d0d32858..03f6666568a 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 @@ -122,42 +122,42 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.1 (List.105): - let List.584 : U64 = CallByName List.6 List.105; - dec List.105; - let List.585 : U64 = 0i64; - let List.583 : Int1 = CallByName Bool.11 List.584 List.585; - ret List.583; - -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : Str = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.1 (List.106): + let List.585 : U64 = CallByName List.6 List.106; + dec List.106; + let List.586 : U64 = 0i64; + let List.584 : Int1 = CallByName Bool.11 List.585 List.586; + ret List.584; + +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : Str = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : Str = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : Str = CallByName Inspect.206 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : Str = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : Str = CallByName Inspect.206 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; + jump List.575 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 d3e47db5be3..8a6ecbb65bd 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 @@ -125,42 +125,42 @@ procedure Inspect.59 (Inspect.296, Inspect.292): procedure Inspect.60 (Inspect.298): ret Inspect.298; -procedure List.1 (List.105): - let List.584 : U64 = CallByName List.6 List.105; - dec List.105; - let List.585 : U64 = 0i64; - let List.583 : Int1 = CallByName Bool.11 List.584 List.585; - ret List.583; - -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : Str = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.1 (List.106): + let List.585 : U64 = CallByName List.6 List.106; + dec List.106; + let List.586 : U64 = 0i64; + let List.584 : Int1 = CallByName Bool.11 List.585 List.586; + ret List.584; + +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : Str = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; - -procedure List.90 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : Str = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : Str = CallByName Inspect.206 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; + let List.582 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; + +procedure List.91 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : Str = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : Str = CallByName Inspect.206 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; + jump List.575 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/ir_int_add.txt b/crates/compiler/test_mono/generated/ir_int_add.txt index 509553189d3..6733b015022 100644 --- a/crates/compiler/test_mono/generated/ir_int_add.txt +++ b/crates/compiler/test_mono/generated/ir_int_add.txt @@ -1,6 +1,6 @@ procedure List.6 (#Attr.2): - let List.571 : U64 = lowlevel ListLen #Attr.2; - ret List.571; + let List.572 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.572; procedure Num.19 (#Attr.2, #Attr.3): let Num.269 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; 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 2436b18d1f9..f85d0eb427f 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 @@ -6,42 +6,42 @@ procedure Bool.2 (): let Bool.23 : Int1 = true; ret Bool.23; -procedure List.2 (List.106, List.107): - let List.585 : U64 = CallByName List.6 List.106; - let List.581 : Int1 = CallByName Num.22 List.107 List.585; - if List.581 then - let List.583 : I64 = CallByName List.66 List.106 List.107; - dec List.106; - let List.582 : [C {}, C I64] = TagId(1) List.583; - ret List.582; +procedure List.2 (List.107, List.108): + let List.586 : U64 = CallByName List.6 List.107; + let List.582 : Int1 = CallByName Num.22 List.108 List.586; + if List.582 then + let List.584 : I64 = CallByName List.66 List.107 List.108; + dec List.107; + let List.583 : [C {}, C I64] = TagId(1) List.584; + ret List.583; else - dec List.106; - let List.580 : {} = Struct {}; - let List.579 : [C {}, C I64] = TagId(0) List.580; - ret List.579; + dec List.107; + let List.581 : {} = Struct {}; + let List.580 : [C {}, C I64] = TagId(0) List.581; + ret List.580; procedure List.6 (#Attr.2): - let List.586 : U64 = lowlevel ListLen #Attr.2; - ret List.586; + let List.587 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.587; procedure List.66 (#Attr.2, #Attr.3): - let List.584 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.584; + let List.585 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.585; -procedure List.9 (List.333): - let List.578 : U64 = 0i64; - let List.571 : [C {}, C I64] = CallByName List.2 List.333 List.578; - let List.575 : U8 = 1i64; - let List.576 : U8 = GetTagId List.571; - let List.577 : Int1 = lowlevel Eq List.575 List.576; - if List.577 then - let List.334 : I64 = UnionAtIndex (Id 1) (Index 0) List.571; - let List.572 : [C Int1, C I64] = TagId(1) List.334; - ret List.572; - else - let List.574 : Int1 = true; - let List.573 : [C Int1, C I64] = TagId(0) List.574; +procedure List.9 (List.334): + let List.579 : U64 = 0i64; + let List.572 : [C {}, C I64] = CallByName List.2 List.334 List.579; + let List.576 : U8 = 1i64; + let List.577 : U8 = GetTagId List.572; + let List.578 : Int1 = lowlevel Eq List.576 List.577; + if List.578 then + let List.335 : I64 = UnionAtIndex (Id 1) (Index 0) List.572; + let List.573 : [C Int1, C I64] = TagId(1) List.335; ret List.573; + else + let List.575 : Int1 = true; + let List.574 : [C Int1, C I64] = TagId(0) List.575; + ret List.574; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt index 337d2f5d827..2aa85b731cf 100644 --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -64,119 +64,119 @@ procedure Decode.27 (Decode.107, Decode.108): let Decode.123 : [C [C List U8, C ], C Str] = TagId(0) Decode.124; ret Decode.123; -procedure List.1 (List.105): - let List.625 : U64 = CallByName List.6 List.105; - dec List.105; - let List.626 : U64 = 0i64; - let List.624 : Int1 = CallByName Bool.11 List.625 List.626; - ret List.624; - -procedure List.102 (List.486, List.487, List.488): - let List.634 : U64 = 0i64; - let List.635 : U64 = CallByName List.6 List.486; - let List.633 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.486 List.487 List.488 List.634 List.635; - ret List.633; - -procedure List.2 (List.106, List.107): - let List.616 : U64 = CallByName List.6 List.106; - let List.613 : Int1 = CallByName Num.22 List.107 List.616; - if List.613 then - let List.615 : U8 = CallByName List.66 List.106 List.107; - dec List.106; - let List.614 : [C {}, C U8] = TagId(1) List.615; - ret List.614; +procedure List.1 (List.106): + let List.626 : U64 = CallByName List.6 List.106; + dec List.106; + let List.627 : U64 = 0i64; + let List.625 : Int1 = CallByName Bool.11 List.626 List.627; + ret List.625; + +procedure List.103 (List.487, List.488, List.489): + let List.635 : U64 = 0i64; + let List.636 : U64 = CallByName List.6 List.487; + let List.634 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.487 List.488 List.489 List.635 List.636; + ret List.634; + +procedure List.2 (List.107, List.108): + let List.617 : U64 = CallByName List.6 List.107; + let List.614 : Int1 = CallByName Num.22 List.108 List.617; + if List.614 then + let List.616 : U8 = CallByName List.66 List.107 List.108; + dec List.107; + let List.615 : [C {}, C U8] = TagId(1) List.616; + ret List.615; else - dec List.106; - let List.612 : {} = Struct {}; - let List.611 : [C {}, C U8] = TagId(0) List.612; - ret List.611; - -procedure List.26 (List.199, List.200, List.201): - let List.627 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.102 List.199 List.200 List.201; - let List.630 : U8 = 1i64; - let List.631 : U8 = GetTagId List.627; - let List.632 : Int1 = lowlevel Eq List.630 List.631; - if List.632 then - let List.202 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.627; - ret List.202; - else - let List.203 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.627; + dec List.107; + let List.613 : {} = Struct {}; + let List.612 : [C {}, C U8] = TagId(0) List.613; + ret List.612; + +procedure List.26 (List.200, List.201, List.202): + let List.628 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.103 List.200 List.201 List.202; + let List.631 : U8 = 1i64; + let List.632 : U8 = GetTagId List.628; + let List.633 : Int1 = lowlevel Eq List.631 List.632; + if List.633 then + let List.203 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.628; ret List.203; - -procedure List.38 (List.342, List.343): - let List.593 : U64 = CallByName List.6 List.342; - let List.344 : U64 = CallByName Num.77 List.593 List.343; - let List.592 : List U8 = CallByName List.43 List.342 List.344; - ret List.592; - -procedure List.4 (List.122, List.123): - let List.603 : U64 = 1i64; - let List.602 : List U8 = CallByName List.70 List.122 List.603; - let List.601 : List U8 = CallByName List.71 List.602 List.123; - ret List.601; - -procedure List.43 (List.340, List.341): - let List.583 : U64 = CallByName List.6 List.340; - let List.582 : U64 = CallByName Num.77 List.583 List.341; - let List.577 : {U64, U64} = Struct {List.341, List.582}; - let List.576 : List U8 = CallByName List.49 List.340 List.577; - ret List.576; - -procedure List.49 (List.418, List.419): - let List.621 : U64 = StructAtIndex 1 List.419; - let List.622 : U64 = StructAtIndex 0 List.419; - let List.620 : List U8 = CallByName List.72 List.418 List.621 List.622; - ret List.620; + else + let List.204 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.628; + ret List.204; + +procedure List.38 (List.343, List.344): + let List.594 : U64 = CallByName List.6 List.343; + let List.345 : U64 = CallByName Num.77 List.594 List.344; + let List.593 : List U8 = CallByName List.43 List.343 List.345; + ret List.593; + +procedure List.4 (List.123, List.124): + let List.604 : U64 = 1i64; + let List.603 : List U8 = CallByName List.70 List.123 List.604; + let List.602 : List U8 = CallByName List.71 List.603 List.124; + ret List.602; + +procedure List.43 (List.341, List.342): + let List.584 : U64 = CallByName List.6 List.341; + let List.583 : U64 = CallByName Num.77 List.584 List.342; + let List.578 : {U64, U64} = Struct {List.342, List.583}; + let List.577 : List U8 = CallByName List.49 List.341 List.578; + ret List.577; + +procedure List.49 (List.419, List.420): + let List.622 : U64 = StructAtIndex 1 List.420; + let List.623 : U64 = StructAtIndex 0 List.420; + let List.621 : List U8 = CallByName List.72 List.419 List.622 List.623; + ret List.621; procedure List.6 (#Attr.2): - let List.648 : U64 = lowlevel ListLen #Attr.2; - ret List.648; + let List.649 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.649; procedure List.66 (#Attr.2, #Attr.3): - let List.609 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.609; + let List.610 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.610; procedure List.70 (#Attr.2, #Attr.3): - let List.600 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.600; + let List.601 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.601; procedure List.71 (#Attr.2, #Attr.3): - let List.598 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.598; + let List.599 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.599; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.581 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.581; + let List.582 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.582; procedure List.8 (#Attr.2, #Attr.3): - let List.595 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.595; + let List.596 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.596; procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5): - joinpoint List.636 List.489 List.490 List.491 List.492 List.493: - let List.638 : Int1 = CallByName Num.22 List.492 List.493; - if List.638 then - let List.647 : U8 = CallByName List.66 List.489 List.492; - let List.639 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.61 List.490 List.647; - let List.644 : U8 = 1i64; - let List.645 : U8 = GetTagId List.639; - let List.646 : Int1 = lowlevel Eq List.644 List.645; - if List.646 then - let List.494 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.639; - let List.642 : U64 = 1i64; - let List.641 : U64 = CallByName Num.51 List.492 List.642; - jump List.636 List.489 List.494 List.491 List.641 List.493; + joinpoint List.637 List.490 List.491 List.492 List.493 List.494: + let List.639 : Int1 = CallByName Num.22 List.493 List.494; + if List.639 then + let List.648 : U8 = CallByName List.66 List.490 List.493; + let List.640 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.61 List.491 List.648; + let List.645 : U8 = 1i64; + let List.646 : U8 = GetTagId List.640; + let List.647 : Int1 = lowlevel Eq List.645 List.646; + if List.647 then + let List.495 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.640; + let List.643 : U64 = 1i64; + let List.642 : U64 = CallByName Num.51 List.493 List.643; + jump List.637 List.490 List.495 List.492 List.642 List.494; else - dec List.489; - let List.495 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.639; - let List.643 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.495; - ret List.643; + dec List.490; + let List.496 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.640; + let List.644 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.496; + ret List.644; else - dec List.489; - let List.637 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.490; - ret List.637; + dec List.490; + let List.638 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.491; + ret List.638; in - jump List.636 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; + jump List.637 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure Num.19 (#Attr.2, #Attr.3): let Num.270 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; @@ -299,7 +299,7 @@ procedure TotallyNotJson.488 (TotallyNotJson.489, TotallyNotJson.973): let TotallyNotJson.981 : {List U8, [C {}, C Str]} = Struct {TotallyNotJson.489, TotallyNotJson.982}; ret TotallyNotJson.981; in - let TotallyNotJson.1255 : U64 = lowlevel ListLen TotallyNotJson.489; + let TotallyNotJson.1255 : U64 = lowlevel ListLenUsize TotallyNotJson.489; let TotallyNotJson.1256 : U64 = 4i64; let TotallyNotJson.1262 : Int1 = lowlevel NumGte TotallyNotJson.1255 TotallyNotJson.1256; if TotallyNotJson.1262 then @@ -756,7 +756,7 @@ procedure TotallyNotJson.69 (#Derived_gen.0): joinpoint TotallyNotJson.1096 TotallyNotJson.1078: if TotallyNotJson.1078 then dec TotallyNotJson.563; - let TotallyNotJson.1054 : U64 = lowlevel ListLen TotallyNotJson.567; + let TotallyNotJson.1054 : U64 = lowlevel ListLenUsize TotallyNotJson.567; let TotallyNotJson.1055 : U64 = 4i64; let TotallyNotJson.1056 : Int1 = lowlevel NumGte TotallyNotJson.1054 TotallyNotJson.1055; if TotallyNotJson.1056 then diff --git a/crates/compiler/test_mono/generated/issue_4770.txt b/crates/compiler/test_mono/generated/issue_4770.txt index a9af9a7df21..9c0ecdda2ac 100644 --- a/crates/compiler/test_mono/generated/issue_4770.txt +++ b/crates/compiler/test_mono/generated/issue_4770.txt @@ -6,80 +6,80 @@ procedure Bool.2 (): let Bool.24 : Int1 = true; ret Bool.24; -procedure List.102 (List.486, List.487, List.488): - let List.585 : U64 = 0i64; - let List.586 : U64 = CallByName List.6 List.486; - let List.584 : [C {}, C {}] = CallByName List.80 List.486 List.487 List.488 List.585 List.586; - ret List.584; +procedure List.103 (List.487, List.488, List.489): + let List.586 : U64 = 0i64; + let List.587 : U64 = CallByName List.6 List.487; + let List.585 : [C {}, C {}] = CallByName List.80 List.487 List.488 List.489 List.586 List.587; + ret List.585; procedure List.23 (#Attr.2, #Attr.3, #Attr.4): - let List.606 : List {[C I64, C List *self], [C I64, C List *self]} = lowlevel ListMap2 { xs: `#Attr.#arg1`, ys: `#Attr.#arg2` } #Attr.2 #Attr.3 Test.15 #Attr.4; + let List.607 : List {[C I64, C List *self], [C I64, C List *self]} = lowlevel ListMap2 { xs: `#Attr.#arg1`, ys: `#Attr.#arg2` } #Attr.2 #Attr.3 Test.15 #Attr.4; decref #Attr.3; decref #Attr.2; - ret List.606; + ret List.607; -procedure List.234 (List.573, List.235, List.233): - let List.603 : Int1 = CallByName Test.1 List.235; - if List.603 then - let List.605 : {} = Struct {}; - let List.604 : [C {}, C {}] = TagId(1) List.605; - ret List.604; +procedure List.235 (List.574, List.236, List.234): + let List.604 : Int1 = CallByName Test.1 List.236; + if List.604 then + let List.606 : {} = Struct {}; + let List.605 : [C {}, C {}] = TagId(1) List.606; + ret List.605; else - let List.602 : {} = Struct {}; - let List.601 : [C {}, C {}] = TagId(0) List.602; - ret List.601; + let List.603 : {} = Struct {}; + let List.602 : [C {}, C {}] = TagId(0) List.603; + ret List.602; -procedure List.56 (List.232, List.233): - let List.582 : {} = Struct {}; - let List.574 : [C {}, C {}] = CallByName List.102 List.232 List.582 List.233; - let List.579 : U8 = 1i64; - let List.580 : U8 = GetTagId List.574; - let List.581 : Int1 = lowlevel Eq List.579 List.580; - if List.581 then - let List.575 : Int1 = CallByName Bool.2; - ret List.575; - else - let List.576 : Int1 = CallByName Bool.1; +procedure List.56 (List.233, List.234): + let List.583 : {} = Struct {}; + let List.575 : [C {}, C {}] = CallByName List.103 List.233 List.583 List.234; + let List.580 : U8 = 1i64; + let List.581 : U8 = GetTagId List.575; + let List.582 : Int1 = lowlevel Eq List.580 List.581; + if List.582 then + let List.576 : Int1 = CallByName Bool.2; ret List.576; + else + let List.577 : Int1 = CallByName Bool.1; + ret List.577; procedure List.6 (#Attr.2): - let List.572 : U64 = lowlevel ListLen #Attr.2; - ret List.572; + let List.573 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.573; procedure List.6 (#Attr.2): - let List.600 : U64 = lowlevel ListLen #Attr.2; - ret List.600; + let List.601 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.601; procedure List.66 (#Attr.2, #Attr.3): - let List.599 : {[C I64, C List *self], [C I64, C List *self]} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.599; + let List.600 : {[C I64, C List *self], [C I64, C List *self]} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.600; procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5): - joinpoint List.587 List.489 List.490 List.491 List.492 List.493: - let List.589 : Int1 = CallByName Num.22 List.492 List.493; - if List.589 then - let List.598 : {[C I64, C List *self], [C I64, C List *self]} = CallByName List.66 List.489 List.492; - inc List.598; - let List.590 : [C {}, C {}] = CallByName List.234 List.490 List.598 List.491; - let List.595 : U8 = 1i64; - let List.596 : U8 = GetTagId List.590; - let List.597 : Int1 = lowlevel Eq List.595 List.596; - if List.597 then - let List.494 : {} = UnionAtIndex (Id 1) (Index 0) List.590; - let List.593 : U64 = 1i64; - let List.592 : U64 = CallByName Num.51 List.492 List.593; - jump List.587 List.489 List.494 List.491 List.592 List.493; + joinpoint List.588 List.490 List.491 List.492 List.493 List.494: + let List.590 : Int1 = CallByName Num.22 List.493 List.494; + if List.590 then + let List.599 : {[C I64, C List *self], [C I64, C List *self]} = CallByName List.66 List.490 List.493; + inc List.599; + let List.591 : [C {}, C {}] = CallByName List.235 List.491 List.599 List.492; + let List.596 : U8 = 1i64; + let List.597 : U8 = GetTagId List.591; + let List.598 : Int1 = lowlevel Eq List.596 List.597; + if List.598 then + let List.495 : {} = UnionAtIndex (Id 1) (Index 0) List.591; + let List.594 : U64 = 1i64; + let List.593 : U64 = CallByName Num.51 List.493 List.594; + jump List.588 List.490 List.495 List.492 List.593 List.494; else - dec List.489; - let List.495 : {} = UnionAtIndex (Id 0) (Index 0) List.590; - let List.594 : [C {}, C {}] = TagId(0) List.495; - ret List.594; + dec List.490; + let List.496 : {} = UnionAtIndex (Id 0) (Index 0) List.591; + let List.595 : [C {}, C {}] = TagId(0) List.496; + ret List.595; else - dec List.489; - let List.588 : [C {}, C {}] = TagId(1) List.490; - ret List.588; + dec List.490; + let List.589 : [C {}, C {}] = TagId(1) List.491; + ret List.589; in - jump List.587 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; + jump List.588 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 c89eb1e4f3a..8f8e38d68aa 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 @@ -38,119 +38,119 @@ procedure Decode.26 (Decode.105, Decode.106): let Decode.122 : {List U8, [C {}, C Str]} = CallByName Decode.25 Decode.105 Decode.123 Decode.106; ret Decode.122; -procedure List.1 (List.105): - let List.621 : U64 = CallByName List.6 List.105; - dec List.105; - let List.622 : U64 = 0i64; - let List.620 : Int1 = CallByName Bool.11 List.621 List.622; - ret List.620; - -procedure List.102 (List.486, List.487, List.488): - let List.630 : U64 = 0i64; - let List.631 : U64 = CallByName List.6 List.486; - let List.629 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.486 List.487 List.488 List.630 List.631; - ret List.629; - -procedure List.2 (List.106, List.107): - let List.612 : U64 = CallByName List.6 List.106; - let List.609 : Int1 = CallByName Num.22 List.107 List.612; - if List.609 then - let List.611 : U8 = CallByName List.66 List.106 List.107; - dec List.106; - let List.610 : [C {}, C U8] = TagId(1) List.611; - ret List.610; +procedure List.1 (List.106): + let List.622 : U64 = CallByName List.6 List.106; + dec List.106; + let List.623 : U64 = 0i64; + let List.621 : Int1 = CallByName Bool.11 List.622 List.623; + ret List.621; + +procedure List.103 (List.487, List.488, List.489): + let List.631 : U64 = 0i64; + let List.632 : U64 = CallByName List.6 List.487; + let List.630 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.80 List.487 List.488 List.489 List.631 List.632; + ret List.630; + +procedure List.2 (List.107, List.108): + let List.613 : U64 = CallByName List.6 List.107; + let List.610 : Int1 = CallByName Num.22 List.108 List.613; + if List.610 then + let List.612 : U8 = CallByName List.66 List.107 List.108; + dec List.107; + let List.611 : [C {}, C U8] = TagId(1) List.612; + ret List.611; else - dec List.106; - let List.608 : {} = Struct {}; - let List.607 : [C {}, C U8] = TagId(0) List.608; - ret List.607; - -procedure List.26 (List.199, List.200, List.201): - let List.623 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.102 List.199 List.200 List.201; - let List.626 : U8 = 1i64; - let List.627 : U8 = GetTagId List.623; - let List.628 : Int1 = lowlevel Eq List.626 List.627; - if List.628 then - let List.202 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.623; - ret List.202; - else - let List.203 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.623; + dec List.107; + let List.609 : {} = Struct {}; + let List.608 : [C {}, C U8] = TagId(0) List.609; + ret List.608; + +procedure List.26 (List.200, List.201, List.202): + let List.624 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName List.103 List.200 List.201 List.202; + let List.627 : U8 = 1i64; + let List.628 : U8 = GetTagId List.624; + let List.629 : Int1 = lowlevel Eq List.627 List.628; + if List.629 then + let List.203 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.624; ret List.203; - -procedure List.38 (List.342, List.343): - let List.589 : U64 = CallByName List.6 List.342; - let List.344 : U64 = CallByName Num.77 List.589 List.343; - let List.588 : List U8 = CallByName List.43 List.342 List.344; - ret List.588; - -procedure List.4 (List.122, List.123): - let List.599 : U64 = 1i64; - let List.598 : List U8 = CallByName List.70 List.122 List.599; - let List.597 : List U8 = CallByName List.71 List.598 List.123; - ret List.597; - -procedure List.43 (List.340, List.341): - let List.579 : U64 = CallByName List.6 List.340; - let List.578 : U64 = CallByName Num.77 List.579 List.341; - let List.573 : {U64, U64} = Struct {List.341, List.578}; - let List.572 : List U8 = CallByName List.49 List.340 List.573; - ret List.572; - -procedure List.49 (List.418, List.419): - let List.617 : U64 = StructAtIndex 1 List.419; - let List.618 : U64 = StructAtIndex 0 List.419; - let List.616 : List U8 = CallByName List.72 List.418 List.617 List.618; - ret List.616; + else + let List.204 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.624; + ret List.204; + +procedure List.38 (List.343, List.344): + let List.590 : U64 = CallByName List.6 List.343; + let List.345 : U64 = CallByName Num.77 List.590 List.344; + let List.589 : List U8 = CallByName List.43 List.343 List.345; + ret List.589; + +procedure List.4 (List.123, List.124): + let List.600 : U64 = 1i64; + let List.599 : List U8 = CallByName List.70 List.123 List.600; + let List.598 : List U8 = CallByName List.71 List.599 List.124; + ret List.598; + +procedure List.43 (List.341, List.342): + let List.580 : U64 = CallByName List.6 List.341; + let List.579 : U64 = CallByName Num.77 List.580 List.342; + let List.574 : {U64, U64} = Struct {List.342, List.579}; + let List.573 : List U8 = CallByName List.49 List.341 List.574; + ret List.573; + +procedure List.49 (List.419, List.420): + let List.618 : U64 = StructAtIndex 1 List.420; + let List.619 : U64 = StructAtIndex 0 List.420; + let List.617 : List U8 = CallByName List.72 List.419 List.618 List.619; + ret List.617; procedure List.6 (#Attr.2): - let List.644 : U64 = lowlevel ListLen #Attr.2; - ret List.644; + let List.645 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.645; procedure List.66 (#Attr.2, #Attr.3): - let List.605 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.605; + let List.606 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.606; procedure List.70 (#Attr.2, #Attr.3): - let List.596 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.596; + let List.597 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.597; procedure List.71 (#Attr.2, #Attr.3): - let List.594 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.594; + let List.595 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.595; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.577 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.577; + let List.578 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.578; procedure List.8 (#Attr.2, #Attr.3): - let List.591 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.591; + let List.592 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.592; procedure List.80 (#Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4, #Derived_gen.5): - joinpoint List.632 List.489 List.490 List.491 List.492 List.493: - let List.634 : Int1 = CallByName Num.22 List.492 List.493; - if List.634 then - let List.643 : U8 = CallByName List.66 List.489 List.492; - let List.635 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.61 List.490 List.643; - let List.640 : U8 = 1i64; - let List.641 : U8 = GetTagId List.635; - let List.642 : Int1 = lowlevel Eq List.640 List.641; - if List.642 then - let List.494 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.635; - let List.638 : U64 = 1i64; - let List.637 : U64 = CallByName Num.51 List.492 List.638; - jump List.632 List.489 List.494 List.491 List.637 List.493; + joinpoint List.633 List.490 List.491 List.492 List.493 List.494: + let List.635 : Int1 = CallByName Num.22 List.493 List.494; + if List.635 then + let List.644 : U8 = CallByName List.66 List.490 List.493; + let List.636 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = CallByName TotallyNotJson.61 List.491 List.644; + let List.641 : U8 = 1i64; + let List.642 : U8 = GetTagId List.636; + let List.643 : Int1 = lowlevel Eq List.641 List.642; + if List.643 then + let List.495 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 1) (Index 0) List.636; + let List.639 : U64 = 1i64; + let List.638 : U64 = CallByName Num.51 List.493 List.639; + jump List.633 List.490 List.495 List.492 List.638 List.494; else - dec List.489; - let List.495 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.635; - let List.639 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.495; - ret List.639; + dec List.490; + let List.496 : [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64] = UnionAtIndex (Id 0) (Index 0) List.636; + let List.640 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(0) List.496; + ret List.640; else - dec List.489; - let List.633 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.490; - ret List.633; + dec List.490; + let List.634 : [C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64], C [C U64, C U64, C U64, C , C , C U64, C U64, C U64, C U64]] = TagId(1) List.491; + ret List.634; in - jump List.632 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; + jump List.633 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4 #Derived_gen.5; procedure Num.19 (#Attr.2, #Attr.3): let Num.270 : U8 = lowlevel NumAdd #Attr.2 #Attr.3; @@ -331,7 +331,7 @@ procedure TotallyNotJson.488 (TotallyNotJson.489, TotallyNotJson.973): let TotallyNotJson.981 : {List U8, [C {}, C Str]} = Struct {TotallyNotJson.489, TotallyNotJson.982}; ret TotallyNotJson.981; in - let TotallyNotJson.1255 : U64 = lowlevel ListLen TotallyNotJson.489; + let TotallyNotJson.1255 : U64 = lowlevel ListLenUsize TotallyNotJson.489; let TotallyNotJson.1256 : U64 = 4i64; let TotallyNotJson.1262 : Int1 = lowlevel NumGte TotallyNotJson.1255 TotallyNotJson.1256; if TotallyNotJson.1262 then @@ -788,7 +788,7 @@ procedure TotallyNotJson.69 (#Derived_gen.0): joinpoint TotallyNotJson.1096 TotallyNotJson.1078: if TotallyNotJson.1078 then dec TotallyNotJson.563; - let TotallyNotJson.1054 : U64 = lowlevel ListLen TotallyNotJson.567; + let TotallyNotJson.1054 : U64 = lowlevel ListLenUsize TotallyNotJson.567; let TotallyNotJson.1055 : U64 = 4i64; let TotallyNotJson.1056 : Int1 = lowlevel NumGte TotallyNotJson.1054 TotallyNotJson.1055; if TotallyNotJson.1056 then diff --git a/crates/compiler/test_mono/generated/issue_6196.txt b/crates/compiler/test_mono/generated/issue_6196.txt index 4fc4169e965..67c0c631b3b 100644 --- a/crates/compiler/test_mono/generated/issue_6196.txt +++ b/crates/compiler/test_mono/generated/issue_6196.txt @@ -6,7 +6,7 @@ procedure Test.1 (#Derived_gen.0, #Derived_gen.1): joinpoint Test.12 Test.2 Test.3: let Test.13 : {List Str, U64} = Struct {Test.2, Test.3}; let Test.31 : List Str = StructAtIndex 0 Test.13; - let Test.32 : U64 = lowlevel ListLen Test.31; + let Test.32 : U64 = lowlevel ListLenUsize Test.31; let Test.33 : U64 = 1i64; let Test.34 : Int1 = lowlevel NumGte Test.32 Test.33; if Test.34 then @@ -24,7 +24,7 @@ procedure Test.1 (#Derived_gen.0, #Derived_gen.1): else let Test.23 : List Str = StructAtIndex 0 Test.13; let Test.24 : U64 = 1i64; - let Test.25 : U64 = lowlevel ListLen Test.23; + let Test.25 : U64 = lowlevel ListLenUsize Test.23; let Test.26 : U64 = lowlevel NumSub Test.25 Test.24; let Test.27 : U64 = 1i64; let Test.8 : List Str = lowlevel ListSublist Test.23 Test.27 Test.26; diff --git a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt index 72a1cfb19e6..3103bc067a4 100644 --- a/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt +++ b/crates/compiler/test_mono/generated/layout_cache_structure_with_multiple_recursive_structures.txt @@ -1,32 +1,32 @@ -procedure List.18 (List.158, List.159, List.160): - let List.572 : U64 = 0i64; - let List.573 : U64 = CallByName List.6 List.158; - let List.571 : [, C {[C *self, ], *self}] = CallByName List.90 List.158 List.159 List.160 List.572 List.573; - ret List.571; +procedure List.18 (List.159, List.160, List.161): + let List.573 : U64 = 0i64; + let List.574 : U64 = CallByName List.6 List.159; + let List.572 : [, C {[C *self, ], *self}] = CallByName List.91 List.159 List.160 List.161 List.573 List.574; + ret List.572; procedure List.6 (#Attr.2): - let List.582 : U64 = lowlevel ListLen #Attr.2; - ret List.582; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.581 : [C *self, ] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.581; + let List.582 : [C *self, ] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.582; -procedure List.90 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.574 List.161 List.162 List.163 List.164 List.165: - let List.576 : Int1 = CallByName Num.22 List.164 List.165; - if List.576 then - let List.580 : [C *self, ] = CallByName List.66 List.161 List.164; - inc List.580; - let List.166 : [, C {[C *self, ], *self}] = CallByName Test.7 List.162 List.580; - let List.579 : U64 = 1i64; - let List.578 : U64 = CallByName Num.51 List.164 List.579; - jump List.574 List.161 List.166 List.163 List.578 List.165; +procedure List.91 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): + joinpoint List.575 List.162 List.163 List.164 List.165 List.166: + let List.577 : Int1 = CallByName Num.22 List.165 List.166; + if List.577 then + let List.581 : [C *self, ] = CallByName List.66 List.162 List.165; + inc List.581; + let List.167 : [, C {[C *self, ], *self}] = CallByName Test.7 List.163 List.581; + let List.580 : U64 = 1i64; + let List.579 : U64 = CallByName Num.51 List.165 List.580; + jump List.575 List.162 List.167 List.164 List.579 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.574 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.575 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): let Num.268 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/list_append.txt b/crates/compiler/test_mono/generated/list_append.txt index 43dc4b24409..e88fb7145a8 100644 --- a/crates/compiler/test_mono/generated/list_append.txt +++ b/crates/compiler/test_mono/generated/list_append.txt @@ -1,16 +1,16 @@ -procedure List.4 (List.122, List.123): - let List.574 : U64 = 1i64; - let List.572 : List I64 = CallByName List.70 List.122 List.574; - let List.571 : List I64 = CallByName List.71 List.572 List.123; - ret List.571; +procedure List.4 (List.123, List.124): + let List.575 : U64 = 1i64; + let List.573 : List I64 = CallByName List.70 List.123 List.575; + let List.572 : List I64 = CallByName List.71 List.573 List.124; + ret List.572; procedure List.70 (#Attr.2, #Attr.3): - let List.575 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.575; + let List.576 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.573 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.573; + let List.574 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure Test.0 (): let Test.2 : List I64 = Array [1i64]; diff --git a/crates/compiler/test_mono/generated/list_append_closure.txt b/crates/compiler/test_mono/generated/list_append_closure.txt index af9f28c7fab..e5c0f370cfa 100644 --- a/crates/compiler/test_mono/generated/list_append_closure.txt +++ b/crates/compiler/test_mono/generated/list_append_closure.txt @@ -1,16 +1,16 @@ -procedure List.4 (List.122, List.123): - let List.574 : U64 = 1i64; - let List.572 : List I64 = CallByName List.70 List.122 List.574; - let List.571 : List I64 = CallByName List.71 List.572 List.123; - ret List.571; +procedure List.4 (List.123, List.124): + let List.575 : U64 = 1i64; + let List.573 : List I64 = CallByName List.70 List.123 List.575; + let List.572 : List I64 = CallByName List.71 List.573 List.124; + ret List.572; procedure List.70 (#Attr.2, #Attr.3): - let List.575 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.575; + let List.576 : List I64 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.573 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.573; + let List.574 : List I64 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure Test.1 (Test.2): let Test.6 : I64 = 42i64; diff --git a/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt b/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt index ccc830cc7be..6b6d73b1cc8 100644 --- a/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt +++ b/crates/compiler/test_mono/generated/list_cannot_update_inplace.txt @@ -1,25 +1,25 @@ -procedure List.3 (List.114, List.115, List.116): - let List.574 : {List I64, I64} = CallByName List.64 List.114 List.115 List.116; - let List.573 : List I64 = StructAtIndex 0 List.574; - ret List.573; +procedure List.3 (List.115, List.116, List.117): + let List.575 : {List I64, I64} = CallByName List.64 List.115 List.116 List.117; + let List.574 : List I64 = StructAtIndex 0 List.575; + ret List.574; procedure List.6 (#Attr.2): - let List.572 : U64 = lowlevel ListLen #Attr.2; - ret List.572; - -procedure List.64 (List.111, List.112, List.113): - let List.579 : U64 = CallByName List.6 List.111; - let List.576 : Int1 = CallByName Num.22 List.112 List.579; - if List.576 then - let List.577 : {List I64, I64} = CallByName List.67 List.111 List.112 List.113; - ret List.577; + let List.573 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.573; + +procedure List.64 (List.112, List.113, List.114): + let List.580 : U64 = CallByName List.6 List.112; + let List.577 : Int1 = CallByName Num.22 List.113 List.580; + if List.577 then + let List.578 : {List I64, I64} = CallByName List.67 List.112 List.113 List.114; + ret List.578; else - let List.575 : {List I64, I64} = Struct {List.111, List.113}; - ret List.575; + let List.576 : {List I64, I64} = Struct {List.112, List.114}; + ret List.576; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.578 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.578; + let List.579 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.579; procedure Num.19 (#Attr.2, #Attr.3): let Num.267 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/list_get.txt b/crates/compiler/test_mono/generated/list_get.txt index 8dfd38435b6..c515c10268b 100644 --- a/crates/compiler/test_mono/generated/list_get.txt +++ b/crates/compiler/test_mono/generated/list_get.txt @@ -1,24 +1,24 @@ -procedure List.2 (List.106, List.107): - let List.577 : U64 = CallByName List.6 List.106; - let List.573 : Int1 = CallByName Num.22 List.107 List.577; - if List.573 then - let List.575 : I64 = CallByName List.66 List.106 List.107; - dec List.106; - let List.574 : [C {}, C I64] = TagId(1) List.575; - ret List.574; +procedure List.2 (List.107, List.108): + let List.578 : U64 = CallByName List.6 List.107; + let List.574 : Int1 = CallByName Num.22 List.108 List.578; + if List.574 then + let List.576 : I64 = CallByName List.66 List.107 List.108; + dec List.107; + let List.575 : [C {}, C I64] = TagId(1) List.576; + ret List.575; else - dec List.106; - let List.572 : {} = Struct {}; - let List.571 : [C {}, C I64] = TagId(0) List.572; - ret List.571; + dec List.107; + let List.573 : {} = Struct {}; + let List.572 : [C {}, C I64] = TagId(0) List.573; + ret List.572; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; procedure List.66 (#Attr.2, #Attr.3): - let List.576 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.576; + let List.577 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/list_len.txt b/crates/compiler/test_mono/generated/list_len.txt index b93cea059b6..8502da9d0da 100644 --- a/crates/compiler/test_mono/generated/list_len.txt +++ b/crates/compiler/test_mono/generated/list_len.txt @@ -1,10 +1,10 @@ procedure List.6 (#Attr.2): - let List.571 : U64 = lowlevel ListLen #Attr.2; - ret List.571; + let List.572 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.572; procedure List.6 (#Attr.2): - let List.572 : U64 = lowlevel ListLen #Attr.2; - ret List.572; + let List.573 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.573; procedure Num.19 (#Attr.2, #Attr.3): let Num.267 : U64 = lowlevel NumAdd #Attr.2 #Attr.3; 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 63c8fa57d92..ba0cc7bab0e 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt @@ -1,30 +1,30 @@ -procedure List.2 (List.106, List.107): - let List.577 : U64 = CallByName List.6 List.106; - let List.573 : Int1 = CallByName Num.22 List.107 List.577; - if List.573 then - let List.575 : Str = CallByName List.66 List.106 List.107; - inc List.575; - dec List.106; - let List.574 : [C {}, C Str] = TagId(1) List.575; - ret List.574; +procedure List.2 (List.107, List.108): + let List.578 : U64 = CallByName List.6 List.107; + let List.574 : Int1 = CallByName Num.22 List.108 List.578; + if List.574 then + let List.576 : Str = CallByName List.66 List.107 List.108; + inc List.576; + dec List.107; + let List.575 : [C {}, C Str] = TagId(1) List.576; + ret List.575; else - dec List.106; - let List.572 : {} = Struct {}; - let List.571 : [C {}, C Str] = TagId(0) List.572; - ret List.571; + dec List.107; + let List.573 : {} = Struct {}; + let List.572 : [C {}, C Str] = TagId(0) List.573; + ret List.572; procedure List.5 (#Attr.2, #Attr.3): - let List.579 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.3 #Attr.3; + let List.580 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.3 #Attr.3; decref #Attr.2; - ret List.579; + ret List.580; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; procedure List.66 (#Attr.2, #Attr.3): - let List.576 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.576; + let List.577 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; 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 8017dba199f..70b7e684006 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_owns.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_owns.txt @@ -1,30 +1,30 @@ -procedure List.2 (List.106, List.107): - let List.577 : U64 = CallByName List.6 List.106; - let List.573 : Int1 = CallByName Num.22 List.107 List.577; - if List.573 then - let List.575 : Str = CallByName List.66 List.106 List.107; - inc List.575; - dec List.106; - let List.574 : [C {}, C Str] = TagId(1) List.575; - ret List.574; +procedure List.2 (List.107, List.108): + let List.578 : U64 = CallByName List.6 List.107; + let List.574 : Int1 = CallByName Num.22 List.108 List.578; + if List.574 then + let List.576 : Str = CallByName List.66 List.107 List.108; + inc List.576; + dec List.107; + let List.575 : [C {}, C Str] = TagId(1) List.576; + ret List.575; else - dec List.106; - let List.572 : {} = Struct {}; - let List.571 : [C {}, C Str] = TagId(0) List.572; - ret List.571; + dec List.107; + let List.573 : {} = Struct {}; + let List.572 : [C {}, C Str] = TagId(0) List.573; + ret List.572; procedure List.5 (#Attr.2, #Attr.3): - let List.579 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.3 #Attr.3; + let List.580 : List Str = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.3 #Attr.3; decref #Attr.2; - ret List.579; + ret List.580; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; procedure List.66 (#Attr.2, #Attr.3): - let List.576 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.576; + let List.577 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt b/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt index c6f0f544c38..adbe193ddac 100644 --- a/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt +++ b/crates/compiler/test_mono/generated/list_map_take_capturing_or_noncapturing.txt @@ -1,23 +1,23 @@ procedure List.5 (#Attr.2, #Attr.3): - let List.572 : U8 = GetTagId #Attr.3; - joinpoint List.573 List.571: - ret List.571; + let List.573 : U8 = GetTagId #Attr.3; + joinpoint List.574 List.572: + ret List.572; in - switch List.572: + switch List.573: case 0: - let List.574 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.4 #Attr.3; + let List.575 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.4 #Attr.3; decref #Attr.2; - jump List.573 List.574; + jump List.574 List.575; case 1: - let List.575 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.6 #Attr.3; + let List.576 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.6 #Attr.3; decref #Attr.2; - jump List.573 List.575; + jump List.574 List.576; default: - let List.576 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.8 #Attr.3; + let List.577 : List U8 = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.8 #Attr.3; decref #Attr.2; - jump List.573 List.576; + jump List.574 List.577; procedure Num.19 (#Attr.2, #Attr.3): diff --git a/crates/compiler/test_mono/generated/list_one_vs_one_spread_issue_4685.txt b/crates/compiler/test_mono/generated/list_one_vs_one_spread_issue_4685.txt index 29f55a68894..417eaf647ba 100644 --- a/crates/compiler/test_mono/generated/list_one_vs_one_spread_issue_4685.txt +++ b/crates/compiler/test_mono/generated/list_one_vs_one_spread_issue_4685.txt @@ -1,7 +1,7 @@ procedure Test.0 (): let Test.11 : Str = ""; let Test.1 : List Str = Array [Test.11]; - let Test.8 : U64 = lowlevel ListLen Test.1; + let Test.8 : U64 = lowlevel ListLenUsize Test.1; let Test.9 : U64 = 1i64; let Test.10 : Int1 = lowlevel Eq Test.8 Test.9; if Test.10 then @@ -10,7 +10,7 @@ procedure Test.0 (): let Test.3 : Str = "B"; ret Test.3; else - let Test.5 : U64 = lowlevel ListLen Test.1; + let Test.5 : U64 = lowlevel ListLenUsize Test.1; dec Test.1; let Test.6 : U64 = 1i64; let Test.7 : Int1 = lowlevel NumGte Test.5 Test.6; diff --git a/crates/compiler/test_mono/generated/list_pass_to_function.txt b/crates/compiler/test_mono/generated/list_pass_to_function.txt index e22435bd101..bf02e1d6c20 100644 --- a/crates/compiler/test_mono/generated/list_pass_to_function.txt +++ b/crates/compiler/test_mono/generated/list_pass_to_function.txt @@ -1,25 +1,25 @@ -procedure List.3 (List.114, List.115, List.116): - let List.572 : {List I64, I64} = CallByName List.64 List.114 List.115 List.116; - let List.571 : List I64 = StructAtIndex 0 List.572; - ret List.571; +procedure List.3 (List.115, List.116, List.117): + let List.573 : {List I64, I64} = CallByName List.64 List.115 List.116 List.117; + let List.572 : List I64 = StructAtIndex 0 List.573; + ret List.572; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; -procedure List.64 (List.111, List.112, List.113): - let List.577 : U64 = CallByName List.6 List.111; - let List.574 : Int1 = CallByName Num.22 List.112 List.577; - if List.574 then - let List.575 : {List I64, I64} = CallByName List.67 List.111 List.112 List.113; - ret List.575; +procedure List.64 (List.112, List.113, List.114): + let List.578 : U64 = CallByName List.6 List.112; + let List.575 : Int1 = CallByName Num.22 List.113 List.578; + if List.575 then + let List.576 : {List I64, I64} = CallByName List.67 List.112 List.113 List.114; + ret List.576; else - let List.573 : {List I64, I64} = Struct {List.111, List.113}; - ret List.573; + let List.574 : {List I64, I64} = Struct {List.112, List.114}; + ret List.574; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.576 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.576; + let List.577 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/list_sort_asc.txt b/crates/compiler/test_mono/generated/list_sort_asc.txt index 4563ffe1707..ce1f4c162be 100644 --- a/crates/compiler/test_mono/generated/list_sort_asc.txt +++ b/crates/compiler/test_mono/generated/list_sort_asc.txt @@ -1,11 +1,11 @@ procedure List.28 (#Attr.2, #Attr.3): - let List.573 : List I64 = lowlevel ListSortWith { xs: `#Attr.#arg1` } #Attr.2 Num.46 #Attr.3; - ret List.573; + let List.574 : List I64 = lowlevel ListSortWith { xs: `#Attr.#arg1` } #Attr.2 Num.46 #Attr.3; + ret List.574; -procedure List.59 (List.328): - let List.572 : {} = Struct {}; - let List.571 : List I64 = CallByName List.28 List.328 List.572; - ret List.571; +procedure List.59 (List.329): + let List.573 : {} = Struct {}; + let List.572 : List I64 = CallByName List.28 List.329 List.573; + ret List.572; procedure Num.46 (#Attr.2, #Attr.3): let Num.267 : U8 = lowlevel NumCompare #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/match_list.txt b/crates/compiler/test_mono/generated/match_list.txt index 8259111a72a..be879b34d91 100644 --- a/crates/compiler/test_mono/generated/match_list.txt +++ b/crates/compiler/test_mono/generated/match_list.txt @@ -6,7 +6,7 @@ procedure Test.0 (): let Test.8 : Str = "E"; ret Test.8; in - let Test.28 : U64 = lowlevel ListLen Test.1; + let Test.28 : U64 = lowlevel ListLenUsize Test.1; let Test.29 : U64 = 2i64; let Test.30 : Int1 = lowlevel NumGte Test.28 Test.29; if Test.30 then @@ -30,7 +30,7 @@ procedure Test.0 (): dec Test.1; jump Test.9; else - let Test.25 : U64 = lowlevel ListLen Test.1; + let Test.25 : U64 = lowlevel ListLenUsize Test.1; let Test.26 : U64 = 1i64; let Test.27 : Int1 = lowlevel Eq Test.25 Test.26; if Test.27 then @@ -45,7 +45,7 @@ procedure Test.0 (): else jump Test.9; else - let Test.22 : U64 = lowlevel ListLen Test.1; + let Test.22 : U64 = lowlevel ListLenUsize Test.1; dec Test.1; let Test.23 : U64 = 1i64; let Test.24 : Int1 = lowlevel NumGte Test.22 Test.23; diff --git a/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt b/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt index 746636d1be3..43d46d8add3 100644 --- a/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt +++ b/crates/compiler/test_mono/generated/nested_optional_field_with_binary_op.txt @@ -9,7 +9,7 @@ procedure Test.0 (): let Test.14 : {List {}, Str} = Struct {Test.15, Test.16}; let Test.10 : List {} = StructAtIndex 0 Test.14; dec Test.16; - let Test.11 : U64 = lowlevel ListLen Test.10; + let Test.11 : U64 = lowlevel ListLenUsize Test.10; dec Test.10; let Test.12 : U64 = 1i64; let Test.13 : Int1 = lowlevel Eq Test.11 Test.12; diff --git a/crates/compiler/test_mono/generated/order_list_size_tests_issue_4732.txt b/crates/compiler/test_mono/generated/order_list_size_tests_issue_4732.txt index a3e7838443d..323e8444446 100644 --- a/crates/compiler/test_mono/generated/order_list_size_tests_issue_4732.txt +++ b/crates/compiler/test_mono/generated/order_list_size_tests_issue_4732.txt @@ -16,7 +16,7 @@ procedure Test.0 (): let Test.2 : Str = "B1"; ret Test.2; in - let Test.73 : U64 = lowlevel ListLen Test.1; + let Test.73 : U64 = lowlevel ListLenUsize Test.1; let Test.74 : U64 = 4i64; let Test.75 : Int1 = lowlevel NumGte Test.73 Test.74; if Test.75 then @@ -96,7 +96,7 @@ procedure Test.0 (): jump Test.10; else - let Test.70 : U64 = lowlevel ListLen Test.1; + let Test.70 : U64 = lowlevel ListLenUsize Test.1; let Test.71 : U64 = 3i64; let Test.72 : Int1 = lowlevel NumGte Test.70 Test.71; if Test.72 then @@ -145,7 +145,7 @@ procedure Test.0 (): jump Test.10; else - let Test.67 : U64 = lowlevel ListLen Test.1; + let Test.67 : U64 = lowlevel ListLenUsize Test.1; let Test.68 : U64 = 2i64; let Test.69 : Int1 = lowlevel NumGte Test.67 Test.68; if Test.69 then @@ -172,7 +172,7 @@ procedure Test.0 (): jump Test.10; else - let Test.64 : U64 = lowlevel ListLen Test.1; + let Test.64 : U64 = lowlevel ListLenUsize Test.1; let Test.65 : U64 = 1i64; let Test.66 : Int1 = lowlevel NumGte Test.64 Test.65; if Test.66 then diff --git a/crates/compiler/test_mono/generated/quicksort_swap.txt b/crates/compiler/test_mono/generated/quicksort_swap.txt index e4f8e6642ef..7eb575df75a 100644 --- a/crates/compiler/test_mono/generated/quicksort_swap.txt +++ b/crates/compiler/test_mono/generated/quicksort_swap.txt @@ -1,43 +1,43 @@ -procedure List.2 (List.106, List.107): - let List.593 : U64 = CallByName List.6 List.106; - let List.590 : Int1 = CallByName Num.22 List.107 List.593; - if List.590 then - let List.592 : I64 = CallByName List.66 List.106 List.107; - dec List.106; - let List.591 : [C {}, C I64] = TagId(1) List.592; - ret List.591; +procedure List.2 (List.107, List.108): + let List.594 : U64 = CallByName List.6 List.107; + let List.591 : Int1 = CallByName Num.22 List.108 List.594; + if List.591 then + let List.593 : I64 = CallByName List.66 List.107 List.108; + dec List.107; + let List.592 : [C {}, C I64] = TagId(1) List.593; + ret List.592; else - dec List.106; - let List.589 : {} = Struct {}; - let List.588 : [C {}, C I64] = TagId(0) List.589; - ret List.588; + dec List.107; + let List.590 : {} = Struct {}; + let List.589 : [C {}, C I64] = TagId(0) List.590; + ret List.589; -procedure List.3 (List.114, List.115, List.116): - let List.580 : {List I64, I64} = CallByName List.64 List.114 List.115 List.116; - let List.579 : List I64 = StructAtIndex 0 List.580; - ret List.579; +procedure List.3 (List.115, List.116, List.117): + let List.581 : {List I64, I64} = CallByName List.64 List.115 List.116 List.117; + let List.580 : List I64 = StructAtIndex 0 List.581; + ret List.580; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; -procedure List.64 (List.111, List.112, List.113): - let List.577 : U64 = CallByName List.6 List.111; - let List.574 : Int1 = CallByName Num.22 List.112 List.577; - if List.574 then - let List.575 : {List I64, I64} = CallByName List.67 List.111 List.112 List.113; - ret List.575; +procedure List.64 (List.112, List.113, List.114): + let List.578 : U64 = CallByName List.6 List.112; + let List.575 : Int1 = CallByName Num.22 List.113 List.578; + if List.575 then + let List.576 : {List I64, I64} = CallByName List.67 List.112 List.113 List.114; + ret List.576; else - let List.573 : {List I64, I64} = Struct {List.111, List.113}; - ret List.573; + let List.574 : {List I64, I64} = Struct {List.112, List.114}; + ret List.574; procedure List.66 (#Attr.2, #Attr.3): - let List.586 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.586; + let List.587 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.587; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.576 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.576; + let List.577 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.269 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/record_update.txt b/crates/compiler/test_mono/generated/record_update.txt index 00abd349820..2fe546ae82b 100644 --- a/crates/compiler/test_mono/generated/record_update.txt +++ b/crates/compiler/test_mono/generated/record_update.txt @@ -1,25 +1,25 @@ -procedure List.3 (List.114, List.115, List.116): - let List.580 : {List U64, U64} = CallByName List.64 List.114 List.115 List.116; - let List.579 : List U64 = StructAtIndex 0 List.580; - ret List.579; +procedure List.3 (List.115, List.116, List.117): + let List.581 : {List U64, U64} = CallByName List.64 List.115 List.116 List.117; + let List.580 : List U64 = StructAtIndex 0 List.581; + ret List.580; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; -procedure List.64 (List.111, List.112, List.113): - let List.577 : U64 = CallByName List.6 List.111; - let List.574 : Int1 = CallByName Num.22 List.112 List.577; - if List.574 then - let List.575 : {List U64, U64} = CallByName List.67 List.111 List.112 List.113; - ret List.575; +procedure List.64 (List.112, List.113, List.114): + let List.578 : U64 = CallByName List.6 List.112; + let List.575 : Int1 = CallByName Num.22 List.113 List.578; + if List.575 then + let List.576 : {List U64, U64} = CallByName List.67 List.112 List.113 List.114; + ret List.576; else - let List.573 : {List U64, U64} = Struct {List.111, List.113}; - ret List.573; + let List.574 : {List U64, U64} = Struct {List.112, List.114}; + ret List.574; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.576 : {List U64, U64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.576; + let List.577 : {List U64, U64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; diff --git a/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt b/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt index 5b01a4ab339..e4c9027ff77 100644 --- a/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt +++ b/crates/compiler/test_mono/generated/recursive_function_and_union_with_inference_hole.txt @@ -1,7 +1,7 @@ procedure List.5 (#Attr.2, #Attr.3): - let List.571 : List [C List *self] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; + let List.572 : List [C List *self] = lowlevel ListMap { xs: `#Attr.#arg1` } #Attr.2 Test.2 #Attr.3; decref #Attr.2; - ret List.571; + ret List.572; procedure Test.2 (Test.5): let Test.6 : List [C List *self] = UnionAtIndex (Id 0) (Index 0) Test.5; diff --git a/crates/compiler/test_mono/generated/rigids.txt b/crates/compiler/test_mono/generated/rigids.txt index bac11978954..272d8fdd57c 100644 --- a/crates/compiler/test_mono/generated/rigids.txt +++ b/crates/compiler/test_mono/generated/rigids.txt @@ -1,43 +1,43 @@ -procedure List.2 (List.106, List.107): - let List.593 : U64 = CallByName List.6 List.106; - let List.590 : Int1 = CallByName Num.22 List.107 List.593; - if List.590 then - let List.592 : I64 = CallByName List.66 List.106 List.107; - dec List.106; - let List.591 : [C {}, C I64] = TagId(1) List.592; - ret List.591; +procedure List.2 (List.107, List.108): + let List.594 : U64 = CallByName List.6 List.107; + let List.591 : Int1 = CallByName Num.22 List.108 List.594; + if List.591 then + let List.593 : I64 = CallByName List.66 List.107 List.108; + dec List.107; + let List.592 : [C {}, C I64] = TagId(1) List.593; + ret List.592; else - dec List.106; - let List.589 : {} = Struct {}; - let List.588 : [C {}, C I64] = TagId(0) List.589; - ret List.588; + dec List.107; + let List.590 : {} = Struct {}; + let List.589 : [C {}, C I64] = TagId(0) List.590; + ret List.589; -procedure List.3 (List.114, List.115, List.116): - let List.580 : {List I64, I64} = CallByName List.64 List.114 List.115 List.116; - let List.579 : List I64 = StructAtIndex 0 List.580; - ret List.579; +procedure List.3 (List.115, List.116, List.117): + let List.581 : {List I64, I64} = CallByName List.64 List.115 List.116 List.117; + let List.580 : List I64 = StructAtIndex 0 List.581; + ret List.580; procedure List.6 (#Attr.2): - let List.578 : U64 = lowlevel ListLen #Attr.2; - ret List.578; + let List.579 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.579; -procedure List.64 (List.111, List.112, List.113): - let List.577 : U64 = CallByName List.6 List.111; - let List.574 : Int1 = CallByName Num.22 List.112 List.577; - if List.574 then - let List.575 : {List I64, I64} = CallByName List.67 List.111 List.112 List.113; - ret List.575; +procedure List.64 (List.112, List.113, List.114): + let List.578 : U64 = CallByName List.6 List.112; + let List.575 : Int1 = CallByName Num.22 List.113 List.578; + if List.575 then + let List.576 : {List I64, I64} = CallByName List.67 List.112 List.113 List.114; + ret List.576; else - let List.573 : {List I64, I64} = Struct {List.111, List.113}; - ret List.573; + let List.574 : {List I64, I64} = Struct {List.112, List.114}; + ret List.574; procedure List.66 (#Attr.2, #Attr.3): - let List.586 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.586; + let List.587 : I64 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.587; procedure List.67 (#Attr.2, #Attr.3, #Attr.4): - let List.576 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; - ret List.576; + let List.577 : {List I64, I64} = lowlevel ListReplaceUnsafe #Attr.2 #Attr.3 #Attr.4; + ret List.577; procedure Num.22 (#Attr.2, #Attr.3): let Num.269 : Int1 = lowlevel NumLt #Attr.2 #Attr.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 ccd20da4826..58c15be82cf 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 @@ -29,159 +29,159 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.102 (List.486, List.487, List.488): - let List.654 : U64 = 0i64; - let List.655 : U64 = CallByName List.6 List.486; - let List.653 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.486 List.487 List.488 List.654 List.655; - ret List.653; - -procedure List.18 (List.158, List.159, List.160): - let List.598 : U64 = 0i64; - let List.599 : U64 = CallByName List.6 List.158; - let List.597 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.598 List.599; - ret List.597; - -procedure List.18 (List.158, List.159, List.160): - let List.610 : U64 = 0i64; - let List.611 : U64 = CallByName List.6 List.158; - let List.609 : List U8 = CallByName List.90 List.158 List.159 List.160 List.610 List.611; - ret List.609; - -procedure List.26 (List.199, List.200, List.201): - let List.647 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.102 List.199 List.200 List.201; - let List.650 : U8 = 1i64; - let List.651 : U8 = GetTagId List.647; - let List.652 : Int1 = lowlevel Eq List.650 List.651; - if List.652 then - let List.202 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.647; - ret List.202; - else - let List.203 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.647; +procedure List.103 (List.487, List.488, List.489): + let List.655 : U64 = 0i64; + let List.656 : U64 = CallByName List.6 List.487; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.655 List.656; + ret List.654; + +procedure List.18 (List.159, List.160, List.161): + let List.599 : U64 = 0i64; + let List.600 : U64 = CallByName List.6 List.159; + let List.598 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.599 List.600; + ret List.598; + +procedure List.18 (List.159, List.160, List.161): + let List.611 : U64 = 0i64; + let List.612 : U64 = CallByName List.6 List.159; + let List.610 : List U8 = CallByName List.91 List.159 List.160 List.161 List.611 List.612; + ret List.610; + +procedure List.26 (List.200, List.201, List.202): + let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.651 : U8 = 1i64; + let List.652 : U8 = GetTagId List.648; + let List.653 : Int1 = lowlevel Eq List.651 List.652; + if List.653 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648; ret List.203; - -procedure List.4 (List.122, List.123): - let List.596 : U64 = 1i64; - let List.595 : List U8 = CallByName List.70 List.122 List.596; - let List.594 : List U8 = CallByName List.71 List.595 List.123; - ret List.594; - -procedure List.49 (List.418, List.419): - let List.638 : U64 = StructAtIndex 1 List.419; - let List.639 : U64 = StructAtIndex 0 List.419; - let List.637 : List U8 = CallByName List.72 List.418 List.638 List.639; - ret List.637; - -procedure List.52 (List.433, List.434): - let List.435 : U64 = CallByName List.6 List.433; - joinpoint List.645 List.436: - let List.643 : U64 = 0i64; - let List.642 : {U64, U64} = Struct {List.436, List.643}; - inc List.433; - let List.437 : List U8 = CallByName List.49 List.433 List.642; - let List.641 : U64 = CallByName Num.75 List.435 List.436; - let List.636 : {U64, U64} = Struct {List.641, List.436}; - let List.438 : List U8 = CallByName List.49 List.433 List.636; - let List.635 : {List U8, List U8} = Struct {List.437, List.438}; - ret List.635; + else + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648; + ret List.204; + +procedure List.4 (List.123, List.124): + let List.597 : U64 = 1i64; + let List.596 : List U8 = CallByName List.70 List.123 List.597; + let List.595 : List U8 = CallByName List.71 List.596 List.124; + ret List.595; + +procedure List.49 (List.419, List.420): + let List.639 : U64 = StructAtIndex 1 List.420; + let List.640 : U64 = StructAtIndex 0 List.420; + let List.638 : List U8 = CallByName List.72 List.419 List.639 List.640; + ret List.638; + +procedure List.52 (List.434, List.435): + let List.436 : U64 = CallByName List.6 List.434; + joinpoint List.646 List.437: + let List.644 : U64 = 0i64; + let List.643 : {U64, U64} = Struct {List.437, List.644}; + inc List.434; + let List.438 : List U8 = CallByName List.49 List.434 List.643; + let List.642 : U64 = CallByName Num.75 List.436 List.437; + let List.637 : {U64, U64} = Struct {List.642, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.637; + let List.636 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.636; in - let List.646 : Int1 = CallByName Num.24 List.435 List.434; - if List.646 then - jump List.645 List.434; + let List.647 : Int1 = CallByName Num.24 List.436 List.435; + if List.647 then + jump List.646 List.435; else - jump List.645 List.435; + jump List.646 List.436; procedure List.6 (#Attr.2): - let List.621 : U64 = lowlevel ListLen #Attr.2; - ret List.621; + let List.622 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.622; procedure List.6 (#Attr.2): - let List.623 : U64 = lowlevel ListLen #Attr.2; - ret List.623; + let List.624 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.624; procedure List.66 (#Attr.2, #Attr.3): - let List.607 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.607; + let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.66 (#Attr.2, #Attr.3): - let List.619 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.619; + let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.620; procedure List.68 (#Attr.2): - let List.634 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.634; + let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.635; procedure List.70 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.575; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.573 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.573; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.640 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.640; + let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.641; procedure List.8 (#Attr.2, #Attr.3): - let List.632 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.632; - -procedure List.80 (#Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10): - joinpoint List.656 List.489 List.490 List.491 List.492 List.493: - let List.658 : Int1 = CallByName Num.22 List.492 List.493; - if List.658 then - let List.667 : U8 = CallByName List.66 List.489 List.492; - let List.659 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.490 List.667; - let List.664 : U8 = 1i64; - let List.665 : U8 = GetTagId List.659; - let List.666 : Int1 = lowlevel Eq List.664 List.665; - if List.666 then - let List.494 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.659; - let List.662 : U64 = 1i64; - let List.661 : U64 = CallByName Num.51 List.492 List.662; - jump List.656 List.489 List.494 List.491 List.661 List.493; + let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.633; + +procedure List.80 (#Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20): + joinpoint List.657 List.490 List.491 List.492 List.493 List.494: + let List.659 : Int1 = CallByName Num.22 List.493 List.494; + if List.659 then + let List.668 : U8 = CallByName List.66 List.490 List.493; + let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.668; + let List.665 : U8 = 1i64; + let List.666 : U8 = GetTagId List.660; + let List.667 : Int1 = lowlevel Eq List.665 List.666; + if List.667 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660; + let List.663 : U64 = 1i64; + let List.662 : U64 = CallByName Num.51 List.493 List.663; + jump List.657 List.490 List.495 List.492 List.662 List.494; else - dec List.489; - let List.495 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.659; - let List.663 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.495; - ret List.663; + dec List.490; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660; + let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.664; else - dec List.489; - let List.657 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.490; - ret List.657; + dec List.490; + let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.658; in - jump List.656 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10; - -procedure List.90 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): - joinpoint List.600 List.161 List.162 List.163 List.164 List.165: - let List.602 : Int1 = CallByName Num.22 List.164 List.165; - if List.602 then - let List.606 : Str = CallByName List.66 List.161 List.164; - inc List.606; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.606; - let List.605 : U64 = 1i64; - let List.604 : U64 = CallByName Num.51 List.164 List.605; - jump List.600 List.161 List.166 List.163 List.604 List.165; + jump List.657 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20; + +procedure List.91 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): + joinpoint List.613 List.162 List.163 List.164 List.165 List.166: + let List.615 : Int1 = CallByName Num.22 List.165 List.166; + if List.615 then + let List.619 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.619; + let List.618 : U64 = 1i64; + let List.617 : U64 = CallByName Num.51 List.165 List.618; + jump List.613 List.162 List.167 List.164 List.617 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.600 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; - -procedure List.90 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint List.612 List.161 List.162 List.163 List.164 List.165: - let List.614 : Int1 = CallByName Num.22 List.164 List.165; - if List.614 then - let List.618 : U8 = CallByName List.66 List.161 List.164; - let List.166 : List U8 = CallByName TotallyNotJson.183 List.162 List.618; - let List.617 : U64 = 1i64; - let List.616 : U64 = CallByName Num.51 List.164 List.617; - jump List.612 List.161 List.166 List.163 List.616 List.165; + jump List.613 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; + +procedure List.91 (#Derived_gen.6, #Derived_gen.7, #Derived_gen.8, #Derived_gen.9, #Derived_gen.10): + joinpoint List.601 List.162 List.163 List.164 List.165 List.166: + let List.603 : Int1 = CallByName Num.22 List.165 List.166; + if List.603 then + let List.607 : Str = CallByName List.66 List.162 List.165; + inc List.607; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.607; + let List.606 : U64 = 1i64; + let List.605 : U64 = CallByName Num.51 List.165 List.606; + jump List.601 List.162 List.167 List.164 List.605 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.612 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + jump List.601 #Derived_gen.6 #Derived_gen.7 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10; procedure Num.127 (#Attr.2): let Num.274 : U8 = lowlevel NumIntCast #Attr.2; 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 8e71857e76f..73397f8f285 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 @@ -81,81 +81,81 @@ procedure Encode.26 (Encode.105, Encode.106): let Encode.108 : List U8 = CallByName Encode.24 Encode.109 Encode.110 Encode.106; ret Encode.108; -procedure List.18 (List.158, List.159, List.160): - let List.598 : U64 = 0i64; - let List.599 : U64 = CallByName List.6 List.158; - let List.597 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.598 List.599; - ret List.597; - -procedure List.18 (List.158, List.159, List.160): - let List.638 : U64 = 0i64; - let List.639 : U64 = CallByName List.6 List.158; - let List.637 : {List U8, U64} = CallByName List.90 List.158 List.159 List.160 List.638 List.639; - ret List.637; - -procedure List.4 (List.122, List.123): - let List.636 : U64 = 1i64; - let List.635 : List U8 = CallByName List.70 List.122 List.636; - let List.634 : List U8 = CallByName List.71 List.635 List.123; - ret List.634; +procedure List.18 (List.159, List.160, List.161): + let List.599 : U64 = 0i64; + let List.600 : U64 = CallByName List.6 List.159; + let List.598 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.599 List.600; + ret List.598; + +procedure List.18 (List.159, List.160, List.161): + let List.639 : U64 = 0i64; + let List.640 : U64 = CallByName List.6 List.159; + let List.638 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.639 List.640; + ret List.638; + +procedure List.4 (List.123, List.124): + let List.637 : U64 = 1i64; + let List.636 : List U8 = CallByName List.70 List.123 List.637; + let List.635 : List U8 = CallByName List.71 List.636 List.124; + ret List.635; procedure List.6 (#Attr.2): - let List.609 : U64 = lowlevel ListLen #Attr.2; - ret List.609; + let List.610 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.610; procedure List.6 (#Attr.2): - let List.649 : U64 = lowlevel ListLen #Attr.2; - ret List.649; + let List.650 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.650; procedure List.66 (#Attr.2, #Attr.3): - let List.607 : [C {}, C {}] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.607; + let List.608 : [C {}, C {}] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.66 (#Attr.2, #Attr.3): - let List.647 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.647; + let List.648 : [] = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.648; procedure List.70 (#Attr.2, #Attr.3): - let List.615 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.615; + let List.616 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.616; procedure List.71 (#Attr.2, #Attr.3): - let List.613 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.613; + let List.614 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.614; procedure List.8 (#Attr.2, #Attr.3): - let List.650 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.650; - -procedure List.90 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): - joinpoint List.640 List.161 List.162 List.163 List.164 List.165: - let List.642 : Int1 = CallByName Num.22 List.164 List.165; - if List.642 then - let List.646 : [] = CallByName List.66 List.161 List.164; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.646; - let List.645 : U64 = 1i64; - let List.644 : U64 = CallByName Num.51 List.164 List.645; - jump List.640 List.161 List.166 List.163 List.644 List.165; + let List.651 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.651; + +procedure List.91 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): + joinpoint List.641 List.162 List.163 List.164 List.165 List.166: + let List.643 : Int1 = CallByName Num.22 List.165 List.166; + if List.643 then + let List.647 : [] = CallByName List.66 List.162 List.165; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.647; + let List.646 : U64 = 1i64; + let List.645 : U64 = CallByName Num.51 List.165 List.646; + jump List.641 List.162 List.167 List.164 List.645 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.640 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; - -procedure List.90 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): - joinpoint List.600 List.161 List.162 List.163 List.164 List.165: - let List.602 : Int1 = CallByName Num.22 List.164 List.165; - if List.602 then - let List.606 : [C {}, C {}] = CallByName List.66 List.161 List.164; - let List.166 : {List U8, U64} = CallByName TotallyNotJson.230 List.162 List.606; - let List.605 : U64 = 1i64; - let List.604 : U64 = CallByName Num.51 List.164 List.605; - jump List.600 List.161 List.166 List.163 List.604 List.165; + jump List.641 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; + +procedure List.91 (#Derived_gen.40, #Derived_gen.41, #Derived_gen.42, #Derived_gen.43, #Derived_gen.44): + joinpoint List.601 List.162 List.163 List.164 List.165 List.166: + let List.603 : Int1 = CallByName Num.22 List.165 List.166; + if List.603 then + let List.607 : [C {}, C {}] = CallByName List.66 List.162 List.165; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.607; + let List.606 : U64 = 1i64; + let List.605 : U64 = CallByName Num.51 List.165 List.606; + jump List.601 List.162 List.167 List.164 List.605 List.166; else - dec List.161; - ret List.162; + dec List.162; + ret List.163; in - jump List.600 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; + jump List.601 #Derived_gen.40 #Derived_gen.41 #Derived_gen.42 #Derived_gen.43 #Derived_gen.44; procedure Num.127 (#Attr.2): let Num.286 : U8 = lowlevel NumIntCast #Attr.2; diff --git a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt index 82a081c6e34..ca6515cb7a3 100644 --- a/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt +++ b/crates/compiler/test_mono/generated/weakening_avoids_overspecialization.txt @@ -2,80 +2,80 @@ procedure Bool.11 (#Attr.2, #Attr.3): let Bool.23 : Int1 = lowlevel Eq #Attr.2 #Attr.3; ret Bool.23; -procedure List.102 (List.486, List.487, List.488): - let List.589 : U64 = 0i64; - let List.590 : U64 = CallByName List.6 List.486; - let List.588 : [C U64, C U64] = CallByName List.80 List.486 List.487 List.488 List.589 List.590; - ret List.588; +procedure List.103 (List.487, List.488, List.489): + let List.590 : U64 = 0i64; + let List.591 : U64 = CallByName List.6 List.487; + let List.589 : [C U64, C U64] = CallByName List.80 List.487 List.488 List.489 List.590 List.591; + ret List.589; -procedure List.26 (List.199, List.200, List.201): - let List.582 : [C U64, C U64] = CallByName List.102 List.199 List.200 List.201; - let List.585 : U8 = 1i64; - let List.586 : U8 = GetTagId List.582; - let List.587 : Int1 = lowlevel Eq List.585 List.586; - if List.587 then - let List.202 : U64 = UnionAtIndex (Id 1) (Index 0) List.582; - ret List.202; - else - let List.203 : U64 = UnionAtIndex (Id 0) (Index 0) List.582; +procedure List.26 (List.200, List.201, List.202): + let List.583 : [C U64, C U64] = CallByName List.103 List.200 List.201 List.202; + let List.586 : U8 = 1i64; + let List.587 : U8 = GetTagId List.583; + let List.588 : Int1 = lowlevel Eq List.586 List.587; + if List.588 then + let List.203 : U64 = UnionAtIndex (Id 1) (Index 0) List.583; ret List.203; + else + let List.204 : U64 = UnionAtIndex (Id 0) (Index 0) List.583; + ret List.204; -procedure List.38 (List.342, List.343): - let List.581 : U64 = CallByName List.6 List.342; - let List.344 : U64 = CallByName Num.77 List.581 List.343; - let List.571 : List U8 = CallByName List.43 List.342 List.344; - ret List.571; - -procedure List.43 (List.340, List.341): - let List.579 : U64 = CallByName List.6 List.340; - let List.578 : U64 = CallByName Num.77 List.579 List.341; - let List.573 : {U64, U64} = Struct {List.341, List.578}; - let List.572 : List U8 = CallByName List.49 List.340 List.573; +procedure List.38 (List.343, List.344): + let List.582 : U64 = CallByName List.6 List.343; + let List.345 : U64 = CallByName Num.77 List.582 List.344; + let List.572 : List U8 = CallByName List.43 List.343 List.345; ret List.572; -procedure List.49 (List.418, List.419): - let List.575 : U64 = StructAtIndex 1 List.419; - let List.576 : U64 = StructAtIndex 0 List.419; - let List.574 : List U8 = CallByName List.72 List.418 List.575 List.576; - ret List.574; +procedure List.43 (List.341, List.342): + let List.580 : U64 = CallByName List.6 List.341; + let List.579 : U64 = CallByName Num.77 List.580 List.342; + let List.574 : {U64, U64} = Struct {List.342, List.579}; + let List.573 : List U8 = CallByName List.49 List.341 List.574; + ret List.573; + +procedure List.49 (List.419, List.420): + let List.576 : U64 = StructAtIndex 1 List.420; + let List.577 : U64 = StructAtIndex 0 List.420; + let List.575 : List U8 = CallByName List.72 List.419 List.576 List.577; + ret List.575; procedure List.6 (#Attr.2): - let List.580 : U64 = lowlevel ListLen #Attr.2; - ret List.580; + let List.581 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.581; procedure List.66 (#Attr.2, #Attr.3): - let List.603 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.603; + let List.604 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.604; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.577 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.577; + let List.578 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.578; procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.591 List.489 List.490 List.491 List.492 List.493: - let List.593 : Int1 = CallByName Num.22 List.492 List.493; - if List.593 then - let List.602 : U8 = CallByName List.66 List.489 List.492; - let List.594 : [C U64, C U64] = CallByName Test.3 List.490 List.602; - let List.599 : U8 = 1i64; - let List.600 : U8 = GetTagId List.594; - let List.601 : Int1 = lowlevel Eq List.599 List.600; - if List.601 then - let List.494 : U64 = UnionAtIndex (Id 1) (Index 0) List.594; - let List.597 : U64 = 1i64; - let List.596 : U64 = CallByName Num.51 List.492 List.597; - jump List.591 List.489 List.494 List.491 List.596 List.493; + joinpoint List.592 List.490 List.491 List.492 List.493 List.494: + let List.594 : Int1 = CallByName Num.22 List.493 List.494; + if List.594 then + let List.603 : U8 = CallByName List.66 List.490 List.493; + let List.595 : [C U64, C U64] = CallByName Test.3 List.491 List.603; + let List.600 : U8 = 1i64; + let List.601 : U8 = GetTagId List.595; + let List.602 : Int1 = lowlevel Eq List.600 List.601; + if List.602 then + let List.495 : U64 = UnionAtIndex (Id 1) (Index 0) List.595; + let List.598 : U64 = 1i64; + let List.597 : U64 = CallByName Num.51 List.493 List.598; + jump List.592 List.490 List.495 List.492 List.597 List.494; else - dec List.489; - let List.495 : U64 = UnionAtIndex (Id 0) (Index 0) List.594; - let List.598 : [C U64, C U64] = TagId(0) List.495; - ret List.598; + dec List.490; + let List.496 : U64 = UnionAtIndex (Id 0) (Index 0) List.595; + let List.599 : [C U64, C U64] = TagId(0) List.496; + ret List.599; else - dec List.489; - let List.592 : [C U64, C U64] = TagId(1) List.490; - ret List.592; + dec List.490; + let List.593 : [C U64, C U64] = TagId(1) List.491; + ret List.593; in - jump List.591 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.592 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure Num.22 (#Attr.2, #Attr.3): let Num.270 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; From 74e58d3d514eb7ab749d2822bf8677c2b09232d8 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sat, 17 Feb 2024 13:19:52 -0500 Subject: [PATCH 75/80] Fix decode_from_utf8_result --- crates/compiler/gen_llvm/src/llvm/build_str.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/crates/compiler/gen_llvm/src/llvm/build_str.rs b/crates/compiler/gen_llvm/src/llvm/build_str.rs index 2e1af6f89b5..7e23c88e03f 100644 --- a/crates/compiler/gen_llvm/src/llvm/build_str.rs +++ b/crates/compiler/gen_llvm/src/llvm/build_str.rs @@ -13,12 +13,11 @@ pub(crate) fn decode_from_utf8_result<'a, 'ctx>( layout_interner: &STLayoutInterner<'a>, pointer: PointerValue<'ctx>, ) -> BasicValueEnum<'ctx> { - let layout = LayoutRepr::Struct(env.arena.alloc([ - Layout::usize(env.target_info), - Layout::STR, - Layout::BOOL, - Layout::U8, - ])); + let layout = + LayoutRepr::Struct( + env.arena + .alloc([Layout::U64, Layout::STR, Layout::BOOL, Layout::U8]), + ); load_roc_value( env, From 37b154df4f28047122a2b9a93de74ee4ce6ebdd6 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 16 Feb 2024 20:00:07 -0500 Subject: [PATCH 76/80] Remove Str.fromUtf8Range Seamless slices make this obsolete! --- crates/compiler/alias_analysis/src/lib.rs | 2 +- crates/compiler/builtins/bitcode/src/main.zig | 2 +- crates/compiler/builtins/bitcode/src/str.zig | 60 +++++------- crates/compiler/builtins/roc/Str.roc | 28 +----- crates/compiler/builtins/src/bitcode.rs | 2 +- crates/compiler/can/src/builtins.rs | 2 +- crates/compiler/gen_dev/src/lib.rs | 10 +- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 14 +-- crates/compiler/gen_wasm/src/low_level.rs | 6 +- crates/compiler/module/src/low_level.rs | 4 +- crates/compiler/module/src/symbol.rs | 2 +- .../compiler/mono/src/drop_specialization.rs | 2 +- crates/compiler/mono/src/inc_dec.rs | 2 +- crates/compiler/test_gen/src/gen_str.rs | 91 +++++-------------- crates/compiler/test_gen/src/wasm_str.rs | 86 +++++------------- 15 files changed, 94 insertions(+), 219 deletions(-) diff --git a/crates/compiler/alias_analysis/src/lib.rs b/crates/compiler/alias_analysis/src/lib.rs index fbc50997da8..88eeadc7e5b 100644 --- a/crates/compiler/alias_analysis/src/lib.rs +++ b/crates/compiler/alias_analysis/src/lib.rs @@ -1230,7 +1230,7 @@ fn lowlevel_spec<'a>( builder.add_make_tuple(block, &[cell, bag]) } - StrFromUtf8Range => { + StrFromUtf8 => { let list = env.symbols[&arguments[0]]; let cell = builder.add_get_tuple_field(block, list, LIST_CELL_INDEX)?; diff --git a/crates/compiler/builtins/bitcode/src/main.zig b/crates/compiler/builtins/bitcode/src/main.zig index 9070a36be3b..bdb26e2482f 100644 --- a/crates/compiler/builtins/bitcode/src/main.zig +++ b/crates/compiler/builtins/bitcode/src/main.zig @@ -196,7 +196,7 @@ comptime { exportStrFn(str.getUnsafeC, "get_unsafe"); exportStrFn(str.reserveC, "reserve"); exportStrFn(str.strToUtf8C, "to_utf8"); - exportStrFn(str.fromUtf8RangeC, "from_utf8_range"); + exportStrFn(str.fromUtf8C, "from_utf8"); exportStrFn(str.repeatC, "repeat"); exportStrFn(str.strTrim, "trim"); exportStrFn(str.strTrimStart, "trim_start"); diff --git a/crates/compiler/builtins/bitcode/src/str.zig b/crates/compiler/builtins/bitcode/src/str.zig index 31c5d0b48df..73883963909 100644 --- a/crates/compiler/builtins/bitcode/src/str.zig +++ b/crates/compiler/builtins/bitcode/src/str.zig @@ -1511,33 +1511,19 @@ const FromUtf8Result = extern struct { problem_code: Utf8ByteProblem, }; -const CountAndStart = extern struct { - count: usize, - start: usize, -}; - -pub fn fromUtf8RangeC( +pub fn fromUtf8C( list: RocList, - start_u64: u64, - count_u64: u64, update_mode: UpdateMode, ) callconv(.C) FromUtf8Result { - return fromUtf8Range(list, @intCast(start_u64), @intCast(count_u64), update_mode); + return fromUtf8(list, update_mode); } -test "fromUtf8RangeC(\"hello\", 1, 3)" { - const original_bytes = "hello"; - const list = RocList.fromSlice(u8, original_bytes[0..]); - const result = fromUtf8RangeC(list, 1, 3, UpdateMode.Immutable); - - try expectEqual(result.is_ok, true); - - result.string.decref(); -} - -pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: UpdateMode) FromUtf8Result { - if (arg.len() == 0 or count == 0) { - arg.decref(RocStr.alignment); +pub fn fromUtf8( + list: RocList, + update_mode: UpdateMode, +) FromUtf8Result { + if (list.len() == 0) { + list.decref(1); // Alignment 1 for List U8 return FromUtf8Result{ .is_ok = true, .string = RocStr.empty(), @@ -1545,11 +1531,11 @@ pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: Upda .problem_code = Utf8ByteProblem.InvalidStartByte, }; } - const bytes = @as([*]const u8, @ptrCast(arg.bytes))[start .. start + count]; + const bytes = @as([*]const u8, @ptrCast(list.bytes))[0..list.len()]; if (isValidUnicode(bytes)) { // Make a seamless slice of the input. - const string = RocStr.fromSubListUnsafe(arg, start, count, update_mode); + const string = RocStr.fromSubListUnsafe(list, 0, list.len(), update_mode); return FromUtf8Result{ .is_ok = true, .string = string, @@ -1557,10 +1543,9 @@ pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: Upda .problem_code = Utf8ByteProblem.InvalidStartByte, }; } else { - const temp = errorToProblem(@as([*]u8, @ptrCast(arg.bytes)), arg.length); + const temp = errorToProblem(bytes); - // decref the list - arg.decref(RocStr.alignment); + list.decref(1); // Alignment 1 for List U8 return FromUtf8Result{ .is_ok = false, @@ -1571,11 +1556,12 @@ pub fn fromUtf8Range(arg: RocList, start: usize, count: usize, update_mode: Upda } } -fn errorToProblem(bytes: [*]u8, length: usize) struct { index: usize, problem: Utf8ByteProblem } { +fn errorToProblem(bytes: []const u8) struct { index: usize, problem: Utf8ByteProblem } { + const len = bytes.len; var index: usize = 0; - while (index < length) { - const nextNumBytes = numberOfNextCodepointBytes(bytes, length, index) catch |err| { + while (index < len) { + const nextNumBytes = numberOfNextCodepointBytes(bytes, index) catch |err| { switch (err) { error.UnexpectedEof => { return .{ .index = index, .problem = Utf8ByteProblem.UnexpectedEndOfSequence }; @@ -1649,13 +1635,13 @@ const Utf8DecodeError = error{ // Essentially unicode.utf8ValidateSlice -> https://github.com/ziglang/zig/blob/0.7.x/lib/std/unicode.zig#L156 // but only for the next codepoint from the index. Then we return the number of bytes of that codepoint. // TODO: we only ever use the values 0-4, so can we use smaller int than `usize`? -pub fn numberOfNextCodepointBytes(ptr: [*]u8, len: usize, index: usize) Utf8DecodeError!usize { - const codepoint_len = try unicode.utf8ByteSequenceLength(ptr[index]); +pub fn numberOfNextCodepointBytes(bytes: []const u8, index: usize) Utf8DecodeError!usize { + const codepoint_len = try unicode.utf8ByteSequenceLength(bytes[index]); const codepoint_end_index = index + codepoint_len; - if (codepoint_end_index > len) { + if (codepoint_end_index > bytes.len) { return error.UnexpectedEof; } - _ = try unicode.utf8Decode(ptr[index..codepoint_end_index]); + _ = try unicode.utf8Decode(bytes[index..codepoint_end_index]); return codepoint_end_index - index; } @@ -1671,11 +1657,11 @@ pub const Utf8ByteProblem = enum(u8) { }; fn validateUtf8Bytes(bytes: [*]u8, length: usize) FromUtf8Result { - return fromUtf8Range(RocList{ .bytes = bytes, .length = length, .capacity_or_alloc_ptr = length }, 0, length, .Immutable); + return fromUtf8(RocList{ .bytes = bytes, .length = length, .capacity_or_alloc_ptr = length }, .Immutable); } fn validateUtf8BytesX(str: RocList) FromUtf8Result { - return fromUtf8Range(str, 0, str.len(), .Immutable); + return fromUtf8(str, .Immutable); } fn expectOk(result: FromUtf8Result) !void { @@ -1754,7 +1740,7 @@ fn expectErr(list: RocList, index: usize, err: Utf8DecodeError, problem: Utf8Byt const str_ptr = @as([*]u8, @ptrCast(list.bytes)); const len = list.length; - try expectError(err, numberOfNextCodepointBytes(str_ptr, len, index)); + try expectError(err, numberOfNextCodepointBytes(str_ptr[0..len], index)); try expectEqual(toErrUtf8ByteResponse(index, problem), validateUtf8Bytes(str_ptr, len)); } diff --git a/crates/compiler/builtins/roc/Str.roc b/crates/compiler/builtins/roc/Str.roc index 2b7592aae62..43218014e9d 100644 --- a/crates/compiler/builtins/roc/Str.roc +++ b/crates/compiler/builtins/roc/Str.roc @@ -338,7 +338,6 @@ interface Str countUtf8Bytes, toUtf8, fromUtf8, - fromUtf8Range, startsWith, endsWith, trim, @@ -541,7 +540,7 @@ toUtf8 : Str -> List U8 ## ``` fromUtf8 : List U8 -> Result Str [BadUtf8 Utf8ByteProblem U64] fromUtf8 = \bytes -> - result = fromUtf8RangeLowlevel bytes 0 (List.len bytes) + result = fromUtf8Lowlevel bytes if result.cIsOk then Ok result.bString @@ -554,29 +553,6 @@ expect (Str.fromUtf8 [240, 159, 144, 166]) == Ok "🐦" expect (Str.fromUtf8 []) == Ok "" expect (Str.fromUtf8 [255]) |> Result.isErr -## Encode part of a [List] of [U8] UTF-8 [code units](https://unicode.org/glossary/#code_unit) -## into a [Str] -## ``` -## expect Str.fromUtf8Range [72, 105, 80, 103] { start : 0, count : 2 } == Ok "Hi" -## ``` -fromUtf8Range : List U8, { start : U64, count : U64 } -> Result Str [BadUtf8 Utf8ByteProblem U64, OutOfBounds] -fromUtf8Range = \bytes, config -> - if Num.addSaturated config.start config.count <= List.len bytes then - result = fromUtf8RangeLowlevel bytes config.start config.count - - if result.cIsOk then - Ok result.bString - else - Err (BadUtf8 result.dProblemCode result.aByteIndex) - else - Err OutOfBounds - -expect (Str.fromUtf8Range [72, 105, 80, 103] { start: 0, count: 2 }) == Ok "Hi" -expect (Str.fromUtf8Range [233, 185, 143, 224, 174, 154, 224, 174, 191] { start: 3, count: 3 }) == Ok "ச" -expect (Str.fromUtf8Range [240, 159, 144, 166] { start: 0, count: 4 }) == Ok "🐦" -expect (Str.fromUtf8Range [] { start: 0, count: 0 }) == Ok "" -expect (Str.fromUtf8Range [72, 105, 80, 103] { start: 2, count: 3 }) |> Result.isErr - FromUtf8Result : { aByteIndex : U64, bString : Str, @@ -584,7 +560,7 @@ FromUtf8Result : { dProblemCode : Utf8ByteProblem, } -fromUtf8RangeLowlevel : List U8, U64, U64 -> FromUtf8Result +fromUtf8Lowlevel : List U8 -> FromUtf8Result ## Check if the given [Str] starts with a value. ## ``` diff --git a/crates/compiler/builtins/src/bitcode.rs b/crates/compiler/builtins/src/bitcode.rs index ab2e852416c..effe436b00f 100644 --- a/crates/compiler/builtins/src/bitcode.rs +++ b/crates/compiler/builtins/src/bitcode.rs @@ -354,7 +354,7 @@ pub const STR_TO_DECIMAL: &str = "roc_builtins.str.to_decimal"; pub const STR_EQUAL: &str = "roc_builtins.str.equal"; pub const STR_SUBSTRING_UNSAFE: &str = "roc_builtins.str.substring_unsafe"; pub const STR_TO_UTF8: &str = "roc_builtins.str.to_utf8"; -pub const STR_FROM_UTF8_RANGE: &str = "roc_builtins.str.from_utf8_range"; +pub const STR_FROM_UTF8: &str = "roc_builtins.str.from_utf8"; pub const STR_REPEAT: &str = "roc_builtins.str.repeat"; pub const STR_TRIM: &str = "roc_builtins.str.trim"; pub const STR_TRIM_START: &str = "roc_builtins.str.trim_start"; diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index 3223ebb6f3e..c307895cec8 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -116,7 +116,7 @@ map_symbol_to_lowlevel_and_arity! { StrEndsWith; STR_ENDS_WITH; 2, StrSplit; STR_SPLIT; 2, StrCountUtf8Bytes; STR_COUNT_UTF8_BYTES; 1, - StrFromUtf8Range; STR_FROM_UTF8_RANGE_LOWLEVEL; 3, + StrFromUtf8; STR_FROM_UTF8_LOWLEVEL; 1, StrToUtf8; STR_TO_UTF8; 1, StrRepeat; STR_REPEAT; 2, StrTrim; STR_TRIM; 1, diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index a8685ed587c..5dbf7995f8c 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1623,15 +1623,17 @@ trait Backend<'a> { arg_layouts, ret_layout, ), - LowLevel::StrFromUtf8Range => { + LowLevel::StrFromUtf8 => { let update_mode = self.debug_symbol("update_mode"); + + // In dev builds, always use UpdateMode::Immutable self.load_literal_i8(&update_mode, UpdateMode::Immutable as i8); self.build_fn_call( sym, - bitcode::STR_FROM_UTF8_RANGE.to_string(), - &[args[0], args[1], args[2], update_mode], - &[arg_layouts[0], arg_layouts[1], arg_layouts[2], Layout::U8], + bitcode::STR_FROM_UTF8.to_string(), + &[args[0], update_mode], + &[arg_layouts[0], Layout::U8], ret_layout, ) } diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 4c5f73d8f42..4edf5d9f30d 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -408,7 +408,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( &bitcode::STR_FROM_FLOAT[float_width], ) } - StrFromUtf8Range => { + StrFromUtf8 => { let result_type = env.module.get_struct_type("str.FromUtf8Result").unwrap(); let result_ptr = env .builder @@ -417,7 +417,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( use roc_target::Architecture::*; match env.target_info.architecture { Aarch32 | X86_32 => { - arguments!(list, start, count); + arguments!(list); let (a, b) = pass_list_or_string_to_zig_32bit(env, list.into_struct_value()); call_void_bitcode_fn( @@ -426,15 +426,13 @@ pub(crate) fn run_low_level<'a, 'ctx>( result_ptr.into(), a.into(), b.into(), - start, - count, pass_update_mode(env, update_mode), ], - bitcode::STR_FROM_UTF8_RANGE, + bitcode::STR_FROM_UTF8, ); } Aarch64 | X86_64 | Wasm32 => { - arguments!(_list, start, count); + arguments!(_list); // we use the symbol here instead let list = args[0]; @@ -444,11 +442,9 @@ pub(crate) fn run_low_level<'a, 'ctx>( &[ result_ptr.into(), list_symbol_to_c_abi(env, scope, list).into(), - start, - count, pass_update_mode(env, update_mode), ], - bitcode::STR_FROM_UTF8_RANGE, + bitcode::STR_FROM_UTF8, ); } } diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index b18ae7b5891..51d5fb68859 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -225,15 +225,13 @@ impl<'a> LowLevelCall<'a> { } StrFromInt => self.num_to_str(backend), StrFromFloat => self.num_to_str(backend), - StrFromUtf8Range => { + StrFromUtf8 => { /* Low-level op returns a struct with all the data for both Ok and Err. Roc AST wrapper converts this to a tag union, with app-dependent tag IDs. output: *FromUtf8Result i32 arg: RocList i32 - start i64 - count i64 update_mode: UpdateMode i32 */ @@ -245,7 +243,7 @@ impl<'a> LowLevelCall<'a> { &WasmLayout::new(backend.layout_interner, self.ret_layout), ); backend.code_builder.i32_const(UPDATE_MODE_IMMUTABLE); - backend.call_host_fn_after_loading_args(bitcode::STR_FROM_UTF8_RANGE); + backend.call_host_fn_after_loading_args(bitcode::STR_FROM_UTF8); } StrTrimStart => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_START), StrTrimEnd => self.load_args_and_call_zig(backend, bitcode::STR_TRIM_END), diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 0ef2fc346a5..2e795e08d77 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -13,7 +13,7 @@ pub enum LowLevel { StrSplit, StrCountUtf8Bytes, StrFromInt, - StrFromUtf8Range, + StrFromUtf8, StrToUtf8, StrRepeat, StrFromFloat, @@ -257,7 +257,7 @@ map_symbol_to_lowlevel! { StrEndsWith <= STR_ENDS_WITH; StrSplit <= STR_SPLIT; StrCountUtf8Bytes <= STR_COUNT_UTF8_BYTES; - StrFromUtf8Range <= STR_FROM_UTF8_RANGE_LOWLEVEL; + StrFromUtf8 <= STR_FROM_UTF8_LOWLEVEL; StrToUtf8 <= STR_TO_UTF8; StrRepeat <= STR_REPEAT; StrTrim <= STR_TRIM; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index 3c462a4a925..b11cac72f97 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1328,7 +1328,7 @@ define_builtins! { 40 STR_WALK_UTF8_WITH_INDEX: "walkUtf8WithIndex" 41 STR_RESERVE: "reserve" 42 STR_TO_NUM: "strToNum" - 43 STR_FROM_UTF8_RANGE_LOWLEVEL: "fromUtf8RangeLowlevel" + 43 STR_FROM_UTF8_LOWLEVEL: "fromUtf8Lowlevel" 44 STR_CAPACITY: "capacity" 45 STR_REPLACE_EACH: "replaceEach" 46 STR_REPLACE_FIRST: "replaceFirst" diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index 7a16409fc09..3f92d693466 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1596,7 +1596,7 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { I128OfDec => RC::NoRc, DictPseudoSeed => RC::NoRc, StrStartsWith | StrEndsWith => RC::NoRc, - StrFromUtf8Range => RC::Rc, + StrFromUtf8 => RC::Rc, StrToUtf8 => RC::Rc, StrRepeat => RC::NoRc, StrFromInt | StrFromFloat => RC::NoRc, diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index 79925daa351..402fc113590 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1350,7 +1350,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { | NumCountOneBits | I128OfDec => arena.alloc_slice_copy(&[irrelevant]), StrStartsWith | StrEndsWith => arena.alloc_slice_copy(&[borrowed, borrowed]), - StrFromUtf8Range => arena.alloc_slice_copy(&[owned, irrelevant, irrelevant]), + StrFromUtf8 => arena.alloc_slice_copy(&[owned]), StrToUtf8 => arena.alloc_slice_copy(&[owned]), StrRepeat => arena.alloc_slice_copy(&[borrowed, irrelevant]), StrFromInt | StrFromFloat => arena.alloc_slice_copy(&[irrelevant]), diff --git a/crates/compiler/test_gen/src/gen_str.rs b/crates/compiler/test_gen/src/gen_str.rs index a759d48be58..1b6c7a92ae7 100644 --- a/crates/compiler/test_gen/src/gen_str.rs +++ b/crates/compiler/test_gen/src/gen_str.rs @@ -907,12 +907,14 @@ fn str_to_utf8() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range() { +fn str_from_utf8() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 5, start: 0 } is + bytes = + Str.toUtf8 "hello" + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -924,12 +926,15 @@ fn str_from_utf8_range() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_slice() { +fn str_from_utf8_slice() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 4, start: 1 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 4 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -941,12 +946,15 @@ fn str_from_utf8_range_slice() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_slice_not_end() { +fn str_from_utf8_slice_not_end() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 3, start: 1 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 3 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -958,14 +966,17 @@ fn str_from_utf8_range_slice_not_end() { #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_order_does_not_matter() { +fn str_from_utf8_order_does_not_matter() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 1, count: 3 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 3 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String - Err _ -> "Str.fromUtf8Range returned Err instead of Ok!" + Err _ -> "Str.fromUtf8 returned Err instead of Ok!" "# ), RocStr::from("ell"), @@ -973,60 +984,6 @@ fn str_from_utf8_range_order_does_not_matter() { ); } -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_out_of_bounds_start_value() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 7, count: 3 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_count_too_high() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 0, count: 6 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - -#[test] -#[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] -fn str_from_utf8_range_count_too_high_for_start() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 4, count: 3 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - #[test] #[cfg(any(feature = "gen-llvm", feature = "gen-dev"))] fn str_repeat_small_stays_small() { diff --git a/crates/compiler/test_gen/src/wasm_str.rs b/crates/compiler/test_gen/src/wasm_str.rs index 4628683d81e..1531adba193 100644 --- a/crates/compiler/test_gen/src/wasm_str.rs +++ b/crates/compiler/test_gen/src/wasm_str.rs @@ -683,12 +683,14 @@ fn str_to_utf8() { } #[test] -fn str_from_utf8_range() { +fn str_from_utf8() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 5, start: 0 } is + bytes = + Str.toUtf8 "hello" + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -699,12 +701,15 @@ fn str_from_utf8_range() { } #[test] -fn str_from_utf8_range_slice() { +fn str_from_utf8_slice() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 4, start: 1 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 4 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -715,12 +720,15 @@ fn str_from_utf8_range_slice() { } #[test] -fn str_from_utf8_range_slice_not_end() { +fn str_from_utf8_slice_not_end() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { count: 3, start: 1 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 3 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -731,12 +739,15 @@ fn str_from_utf8_range_slice_not_end() { } #[test] -fn str_from_utf8_range_order_does_not_matter() { +fn str_from_utf8_order_does_not_matter() { assert_evals_to!( indoc!( r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 1, count: 3 } is + bytes = + Str.toUtf8 "hello" + |> List.sublist { start: 1, len: 3 } + + when Str.fromUtf8 bytes is Ok utf8String -> utf8String _ -> "" "# @@ -746,57 +757,6 @@ fn str_from_utf8_range_order_does_not_matter() { ); } -#[test] -fn str_from_utf8_range_out_of_bounds_start_value() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 7, count: 3 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - -#[test] -fn str_from_utf8_range_count_too_high() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 0, count: 6 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - -#[test] -fn str_from_utf8_range_count_too_high_for_start() { - assert_evals_to!( - indoc!( - r#" - bytes = Str.toUtf8 "hello" - when Str.fromUtf8Range bytes { start: 4, count: 3 } is - Ok _ -> "" - Err (BadUtf8 _ _) -> "" - Err OutOfBounds -> "out of bounds" - "# - ), - RocStr::from("out of bounds"), - RocStr - ); -} - #[test] fn str_repeat_small() { assert_evals_to!( From 762f52b714871b475db7aceb4fc6784333df5e82 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 16 Feb 2024 20:32:13 -0500 Subject: [PATCH 77/80] Use ListLenU64 where it's needed over ListLenUsize --- crates/compiler/mono/src/ir/pattern.rs | 27 ++++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index 155b3a26419..e04d6f72f44 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1397,22 +1397,20 @@ pub(crate) fn build_list_index_probe<'a>( list_sym: Symbol, list_index: &ListIndex, ) -> (Symbol, impl DoubleEndedIterator>) { - let usize_layout = Layout::usize(env.target_info); - let list_index = list_index.0; let index_sym = env.unique_symbol(); let (opt_len_store, opt_offset_store, index_store) = if list_index >= 0 { let index_expr = Expr::Literal(Literal::Int((list_index as i128).to_ne_bytes())); - let index_store = (index_sym, usize_layout, index_expr); + let index_store = (index_sym, Layout::U64, index_expr); (None, None, index_store) } else { let len_sym = env.unique_symbol(); let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLenUsize, + op: LowLevel::ListLenU64, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1430,9 +1428,9 @@ pub(crate) fn build_list_index_probe<'a>( arguments: env.arena.alloc([len_sym, offset_sym]), }); - let len_store = (len_sym, usize_layout, len_expr); - let offset_store = (offset_sym, usize_layout, offset_expr); - let index_store = (index_sym, usize_layout, index_expr); + let len_store = (len_sym, Layout::U64, len_expr); + let offset_store = (offset_sym, Layout::U64, offset_expr); + let index_store = (index_sym, Layout::U64, index_expr); (Some(len_store), Some(offset_store), index_store) }; @@ -1560,17 +1558,16 @@ fn store_list_rest<'a>( if let Some((index, Some(rest_sym))) = opt_rest { is_productive = true; - let usize_layout = Layout::usize(env.target_info); - let total_dropped = list_arity.min_len(); - let total_dropped_sym = env.unique_symbol(); let total_dropped_expr = Expr::Literal(Literal::Int((total_dropped as u128).to_ne_bytes())); let list_len_sym = env.unique_symbol(); let list_len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLenUsize, + // Must use ListLenU64 here because we're using it with List.sublist, + // which takes U64s for start and len. + op: LowLevel::ListLenU64, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1596,10 +1593,10 @@ fn store_list_rest<'a>( arguments: env.arena.alloc([list_sym, start_sym, rest_len_sym]), }); let needed_stores = [ - (total_dropped_sym, total_dropped_expr, usize_layout), - (list_len_sym, list_len_expr, usize_layout), - (rest_len_sym, rest_len_expr, usize_layout), - (start_sym, start_expr, usize_layout), + (total_dropped_sym, total_dropped_expr, Layout::U64), + (list_len_sym, list_len_expr, Layout::U64), + (rest_len_sym, rest_len_expr, Layout::U64), + (start_sym, start_expr, Layout::U64), (*rest_sym, rest_expr, list_layout), ]; for (sym, expr, lay) in needed_stores.into_iter().rev() { From 87d4760356819a201bcb35f9a6f77fa7ed541aab Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 16 Feb 2024 20:39:09 -0500 Subject: [PATCH 78/80] Remove obsolete ListLenUsize --- crates/compiler/alias_analysis/src/lib.rs | 2 +- crates/compiler/can/src/builtins.rs | 3 +-- crates/compiler/gen_dev/src/generic64/mod.rs | 7 +------ crates/compiler/gen_dev/src/lib.rs | 19 ++++--------------- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 8 +------- crates/compiler/gen_wasm/src/low_level.rs | 3 +-- crates/compiler/load_internal/src/file.rs | 4 ++-- crates/compiler/module/src/low_level.rs | 6 ++---- crates/compiler/module/src/symbol.rs | 3 +-- .../mono/src/code_gen_help/equality.rs | 4 ++-- .../mono/src/code_gen_help/refcount.rs | 4 ++-- .../compiler/mono/src/drop_specialization.rs | 4 ++-- crates/compiler/mono/src/inc_dec.rs | 2 +- crates/compiler/mono/src/ir/decision_tree.rs | 19 ++++++------------- crates/compiler/mono/src/ir/pattern.rs | 4 ++-- crates/compiler/mono/src/low_level.rs | 1 - 16 files changed, 29 insertions(+), 64 deletions(-) diff --git a/crates/compiler/alias_analysis/src/lib.rs b/crates/compiler/alias_analysis/src/lib.rs index 88eeadc7e5b..2c5591c890a 100644 --- a/crates/compiler/alias_analysis/src/lib.rs +++ b/crates/compiler/alias_analysis/src/lib.rs @@ -1121,7 +1121,7 @@ fn lowlevel_spec<'a>( // just dream up a unit value builder.add_make_tuple(block, &[]) } - ListLenUsize | ListLenU64 => { + ListLen => { // TODO should this touch the heap cell? // just dream up a unit value builder.add_make_tuple(block, &[]) diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index c307895cec8..d4d48d0b6f1 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -129,8 +129,7 @@ map_symbol_to_lowlevel_and_arity! { StrWithCapacity; STR_WITH_CAPACITY; 1, StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1, - ListLenUsize; LIST_LEN_USIZE; 1, - ListLenU64; LIST_LEN_U64; 1, + ListLen; LIST_LEN; 1, ListWithCapacity; LIST_WITH_CAPACITY; 1, ListReserve; LIST_RESERVE; 2, ListIsUnique; LIST_IS_UNIQUE; 1, diff --git a/crates/compiler/gen_dev/src/generic64/mod.rs b/crates/compiler/gen_dev/src/generic64/mod.rs index 2ba1abc46a1..69ad85f9541 100644 --- a/crates/compiler/gen_dev/src/generic64/mod.rs +++ b/crates/compiler/gen_dev/src/generic64/mod.rs @@ -2830,12 +2830,7 @@ impl< } } - fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol) { - self.storage_manager - .list_len_usize(&mut self.buf, dst, list); - } - - fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol) { + fn build_list_len(&mut self, dst: &Symbol, list: &Symbol) { self.storage_manager.list_len_u64(&mut self.buf, dst, list); } diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index 5dbf7995f8c..e6d611ba8d2 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1484,21 +1484,13 @@ trait Backend<'a> { self.build_fn_call(sym, intrinsic.to_string(), args, arg_layouts, ret_layout) } - LowLevel::ListLenU64 => { + LowLevel::ListLen => { debug_assert_eq!( 1, args.len(), "ListLenU64: expected to have exactly one argument" ); - self.build_list_len_u64(sym, &args[0]) - } - LowLevel::ListLenUsize => { - debug_assert_eq!( - 1, - args.len(), - "ListLenUsize: expected to have exactly one argument" - ); - self.build_list_len_usize(sym, &args[0]) + self.build_list_len(sym, &args[0]) } LowLevel::ListWithCapacity => { debug_assert_eq!( @@ -2382,11 +2374,8 @@ trait Backend<'a> { /// build_sqrt stores the result of `sqrt(src)` into dst. fn build_num_sqrt(&mut self, dst: Symbol, src: Symbol, float_width: FloatWidth); - /// build_list_len_usize returns the length of a list as a usize. This is for internal use only. - fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol); - - /// build_list_len_u64 returns the length of a list and casts it from usize to u64. This is for the public List.len. - fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol); + /// build_list_len returns the length of a list after casting it from usize to u64. + fn build_list_len(&mut self, dst: &Symbol, list: &Symbol); /// generate a call to a higher-order lowlevel fn build_higher_order_lowlevel( diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 4edf5d9f30d..8ce114879ad 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -607,7 +607,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( bitcode::STR_WITH_CAPACITY, ) } - ListLenU64 => { + ListLen => { // List.len : List * -> U64 arguments!(list); @@ -618,12 +618,6 @@ pub(crate) fn run_low_level<'a, 'ctx>( .new_build_int_cast(len_usize, env.context.i64_type(), "usize_to_u64") .into() } - ListLenUsize => { - // List.lenUsize : List * -> usize # used internally, not exposed - arguments!(list); - - list_len_usize(env.builder, list.into_struct_value()).into() - } ListGetCapacity => { // List.capacity: List a -> U64 arguments!(list); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index 51d5fb68859..b89a56724af 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -260,14 +260,13 @@ impl<'a> LowLevelCall<'a> { StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY), // List - ListLenU64 => { + ListLen => { self.load_list_len_usize(backend); // Length is stored as 32 bits in memory on wasm32, // but List.len always returns U64 backend.code_builder.i64_extend_u_i32(); } - ListLenUsize => self.load_list_len_usize(backend), ListGetCapacity => self.load_args_and_call_zig(backend, bitcode::LIST_CAPACITY), diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index c4239ded421..2eb1d05e6ec 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -4703,7 +4703,7 @@ fn synth_list_len_type(subs: &mut Subs) -> Variable { Content::Structure(FlatType::Apply(Symbol::LIST_LIST, a_slice)), ); let fn_var = synth_import(subs, Content::Error); - let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN_U64, [])]); + let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN, [])]); let clos_list_len = synth_import( subs, Content::LambdaSet(LambdaSet { @@ -4757,7 +4757,7 @@ pub fn add_imports( // Num needs List.len, but List imports Num. let list_len_type_var = synth_list_len_type(subs); let list_len_type_index = constraints.push_variable(list_len_type_var); - def_types.push((Symbol::LIST_LEN_U64, Loc::at_zero(list_len_type_index))); + def_types.push((Symbol::LIST_LEN, Loc::at_zero(list_len_type_index))); import_variables.push(list_len_type_var); } diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index 2e795e08d77..fa10de5b794 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -26,8 +26,7 @@ pub enum LowLevel { StrReserve, StrWithCapacity, StrReleaseExcessCapacity, - ListLenUsize, - ListLenU64, + ListLen, ListWithCapacity, ListReserve, ListReleaseExcessCapacity, @@ -269,8 +268,7 @@ map_symbol_to_lowlevel! { StrToNum <= STR_TO_NUM; StrWithCapacity <= STR_WITH_CAPACITY; StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY; - ListLenU64 <= LIST_LEN_U64; - ListLenUsize <= LIST_LEN_USIZE; + ListLen <= LIST_LEN; ListGetCapacity <= LIST_CAPACITY; ListWithCapacity <= LIST_WITH_CAPACITY; ListReserve <= LIST_RESERVE; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index b11cac72f97..c53a964fefd 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1342,7 +1342,7 @@ define_builtins! { 3 LIST_SET: "set" 4 LIST_APPEND: "append" 5 LIST_MAP: "map" - 6 LIST_LEN_U64: "len" + 6 LIST_LEN: "len" 7 LIST_WALK_BACKWARDS: "walkBackwards" 8 LIST_CONCAT: "concat" 9 LIST_FIRST: "first" @@ -1424,7 +1424,6 @@ define_builtins! { 85 LIST_PREPEND_IF_OK: "prependIfOk" 86 LIST_WALK_WITH_INDEX_UNTIL: "walkWithIndexUntil" 87 LIST_CLONE: "clone" - 88 LIST_LEN_USIZE: "lenUsize" } 7 RESULT: "Result" => { 0 RESULT_RESULT: "Result" exposed_type=true // the Result.Result type alias diff --git a/crates/compiler/mono/src/code_gen_help/equality.rs b/crates/compiler/mono/src/code_gen_help/equality.rs index 3a0d12e826d..d2ce3e3cc97 100644 --- a/crates/compiler/mono/src/code_gen_help/equality.rs +++ b/crates/compiler/mono/src/code_gen_help/equality.rs @@ -668,8 +668,8 @@ fn eq_list<'a>( let len_1 = root.create_symbol(ident_ids, "len_1"); let len_2 = root.create_symbol(ident_ids, "len_2"); - let len_1_stmt = |next| let_lowlevel(arena, layout_isize, len_1, ListLenUsize, &[ARG_1], next); - let len_2_stmt = |next| let_lowlevel(arena, layout_isize, len_2, ListLenUsize, &[ARG_2], next); + let len_1_stmt = |next| let_lowlevel(arena, Layout::U64, len_1, ListLen, &[ARG_1], next); + let len_2_stmt = |next| let_lowlevel(arena, Layout::U64, len_2, ListLen, &[ARG_2], next); let eq_len = root.create_symbol(ident_ids, "eq_len"); let eq_len_stmt = |next| let_lowlevel(arena, LAYOUT_BOOL, eq_len, Eq, &[len_1, len_2], next); diff --git a/crates/compiler/mono/src/code_gen_help/refcount.rs b/crates/compiler/mono/src/code_gen_help/refcount.rs index d2882732f5a..11556e162a6 100644 --- a/crates/compiler/mono/src/code_gen_help/refcount.rs +++ b/crates/compiler/mono/src/code_gen_help/refcount.rs @@ -926,12 +926,12 @@ fn refcount_list<'a>( // let len = root.create_symbol(ident_ids, "len"); - let len_stmt = |next| let_lowlevel(arena, layout_isize, len, ListLenUsize, &[structure], next); + let len_stmt = |next| let_lowlevel(arena, Layout::U64, len, ListLen, &[structure], next); // let zero = 0 let zero = root.create_symbol(ident_ids, "zero"); let zero_expr = Expr::Literal(Literal::Int(0i128.to_ne_bytes())); - let zero_stmt = |next| Stmt::Let(zero, zero_expr, layout_isize, next); + let zero_stmt = |next| Stmt::Let(zero, zero_expr, Layout::U64, next); // let is_empty = lowlevel Eq len zero let is_empty = root.create_symbol(ident_ids, "is_empty"); diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index 3f92d693466..513ee7a0ba9 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1533,8 +1533,8 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { match lowlevel { Unreachable => RC::Uknown, - ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity - | ListWithCapacity | StrWithCapacity => RC::NoRc, + ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity | ListWithCapacity + | StrWithCapacity => RC::NoRc, ListReplaceUnsafe => RC::Rc, StrGetUnsafe | ListGetUnsafe => RC::NoRc, ListConcat => RC::Rc, diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index 402fc113590..bf593e798dc 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1283,7 +1283,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { match op { Unreachable => arena.alloc_slice_copy(&[irrelevant]), DictPseudoSeed => arena.alloc_slice_copy(&[irrelevant]), - ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { + ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { arena.alloc_slice_copy(&[borrowed]) } ListWithCapacity | StrWithCapacity => arena.alloc_slice_copy(&[irrelevant]), diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index 853011ca090..878c2e09776 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1769,7 +1769,7 @@ fn test_to_comparison<'a>( LayoutRepr::Builtin(Builtin::List(_elem_layout)) => { let real_len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLenUsize, + op: LowLevel::ListLen, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1779,10 +1779,8 @@ fn test_to_comparison<'a>( let real_len = env.unique_symbol(); let test_len = env.unique_symbol(); - let usize_layout = Layout::usize(env.target_info); - - stores.push((real_len, usize_layout, real_len_expr)); - stores.push((test_len, usize_layout, test_len_expr)); + stores.push((real_len, Layout::U64, real_len_expr)); + stores.push((test_len, Layout::U64, test_len_expr)); let comparison = match bound { ListLenBound::Exact => (real_len, Comparator::Eq, test_len), @@ -2337,7 +2335,7 @@ fn decide_to_branching<'a>( let len_symbol = env.unique_symbol(); let switch = Stmt::Switch { - cond_layout: Layout::usize(env.target_info), + cond_layout: Layout::U64, cond_symbol: len_symbol, branches: branches.into_bump_slice(), default_branch: (default_branch_info, env.arena.alloc(default_branch)), @@ -2346,18 +2344,13 @@ fn decide_to_branching<'a>( let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLenUsize, + op: LowLevel::ListLen, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([inner_cond_symbol]), }); - Stmt::Let( - len_symbol, - len_expr, - Layout::usize(env.target_info), - env.arena.alloc(switch), - ) + Stmt::Let(len_symbol, len_expr, Layout::U64, env.arena.alloc(switch)) } else { Stmt::Switch { cond_layout: inner_cond_layout, diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index e04d6f72f44..a8980935f95 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1410,7 +1410,7 @@ pub(crate) fn build_list_index_probe<'a>( let len_sym = env.unique_symbol(); let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLenU64, + op: LowLevel::ListLen, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1567,7 +1567,7 @@ fn store_list_rest<'a>( call_type: CallType::LowLevel { // Must use ListLenU64 here because we're using it with List.sublist, // which takes U64s for start and len. - op: LowLevel::ListLenU64, + op: LowLevel::ListLen, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), diff --git a/crates/compiler/mono/src/low_level.rs b/crates/compiler/mono/src/low_level.rs index 2472ed97787..e8cdb934801 100644 --- a/crates/compiler/mono/src/low_level.rs +++ b/crates/compiler/mono/src/low_level.rs @@ -70,7 +70,6 @@ enum FirstOrder { StrRepeat, StrFromFloat, ListLenU64, - ListLenUsize, ListGetUnsafe, ListSublist, ListDropAt, From 739565e836aa154c19d131089b5c5f859b56557c Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 16 Feb 2024 20:47:50 -0500 Subject: [PATCH 79/80] Revert "Remove obsolete ListLenUsize" This reverts commit ad1bca4ac9c40d336522f944df60d61a814435dd. --- crates/compiler/alias_analysis/src/lib.rs | 2 +- crates/compiler/can/src/builtins.rs | 3 ++- crates/compiler/gen_dev/src/generic64/mod.rs | 7 ++++++- crates/compiler/gen_dev/src/lib.rs | 19 +++++++++++++++---- crates/compiler/gen_llvm/src/llvm/lowlevel.rs | 8 +++++++- crates/compiler/gen_wasm/src/low_level.rs | 3 ++- crates/compiler/load_internal/src/file.rs | 4 ++-- crates/compiler/module/src/low_level.rs | 6 ++++-- crates/compiler/module/src/symbol.rs | 3 ++- .../mono/src/code_gen_help/equality.rs | 4 ++-- .../mono/src/code_gen_help/refcount.rs | 4 ++-- .../compiler/mono/src/drop_specialization.rs | 4 ++-- crates/compiler/mono/src/inc_dec.rs | 2 +- crates/compiler/mono/src/ir/decision_tree.rs | 19 +++++++++++++------ crates/compiler/mono/src/ir/pattern.rs | 4 ++-- crates/compiler/mono/src/low_level.rs | 1 + 16 files changed, 64 insertions(+), 29 deletions(-) diff --git a/crates/compiler/alias_analysis/src/lib.rs b/crates/compiler/alias_analysis/src/lib.rs index 2c5591c890a..88eeadc7e5b 100644 --- a/crates/compiler/alias_analysis/src/lib.rs +++ b/crates/compiler/alias_analysis/src/lib.rs @@ -1121,7 +1121,7 @@ fn lowlevel_spec<'a>( // just dream up a unit value builder.add_make_tuple(block, &[]) } - ListLen => { + ListLenUsize | ListLenU64 => { // TODO should this touch the heap cell? // just dream up a unit value builder.add_make_tuple(block, &[]) diff --git a/crates/compiler/can/src/builtins.rs b/crates/compiler/can/src/builtins.rs index d4d48d0b6f1..c307895cec8 100644 --- a/crates/compiler/can/src/builtins.rs +++ b/crates/compiler/can/src/builtins.rs @@ -129,7 +129,8 @@ map_symbol_to_lowlevel_and_arity! { StrWithCapacity; STR_WITH_CAPACITY; 1, StrReleaseExcessCapacity; STR_RELEASE_EXCESS_CAPACITY; 1, - ListLen; LIST_LEN; 1, + ListLenUsize; LIST_LEN_USIZE; 1, + ListLenU64; LIST_LEN_U64; 1, ListWithCapacity; LIST_WITH_CAPACITY; 1, ListReserve; LIST_RESERVE; 2, ListIsUnique; LIST_IS_UNIQUE; 1, diff --git a/crates/compiler/gen_dev/src/generic64/mod.rs b/crates/compiler/gen_dev/src/generic64/mod.rs index 69ad85f9541..2ba1abc46a1 100644 --- a/crates/compiler/gen_dev/src/generic64/mod.rs +++ b/crates/compiler/gen_dev/src/generic64/mod.rs @@ -2830,7 +2830,12 @@ impl< } } - fn build_list_len(&mut self, dst: &Symbol, list: &Symbol) { + fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol) { + self.storage_manager + .list_len_usize(&mut self.buf, dst, list); + } + + fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol) { self.storage_manager.list_len_u64(&mut self.buf, dst, list); } diff --git a/crates/compiler/gen_dev/src/lib.rs b/crates/compiler/gen_dev/src/lib.rs index e6d611ba8d2..5dbf7995f8c 100644 --- a/crates/compiler/gen_dev/src/lib.rs +++ b/crates/compiler/gen_dev/src/lib.rs @@ -1484,13 +1484,21 @@ trait Backend<'a> { self.build_fn_call(sym, intrinsic.to_string(), args, arg_layouts, ret_layout) } - LowLevel::ListLen => { + LowLevel::ListLenU64 => { debug_assert_eq!( 1, args.len(), "ListLenU64: expected to have exactly one argument" ); - self.build_list_len(sym, &args[0]) + self.build_list_len_u64(sym, &args[0]) + } + LowLevel::ListLenUsize => { + debug_assert_eq!( + 1, + args.len(), + "ListLenUsize: expected to have exactly one argument" + ); + self.build_list_len_usize(sym, &args[0]) } LowLevel::ListWithCapacity => { debug_assert_eq!( @@ -2374,8 +2382,11 @@ trait Backend<'a> { /// build_sqrt stores the result of `sqrt(src)` into dst. fn build_num_sqrt(&mut self, dst: Symbol, src: Symbol, float_width: FloatWidth); - /// build_list_len returns the length of a list after casting it from usize to u64. - fn build_list_len(&mut self, dst: &Symbol, list: &Symbol); + /// build_list_len_usize returns the length of a list as a usize. This is for internal use only. + fn build_list_len_usize(&mut self, dst: &Symbol, list: &Symbol); + + /// build_list_len_u64 returns the length of a list and casts it from usize to u64. This is for the public List.len. + fn build_list_len_u64(&mut self, dst: &Symbol, list: &Symbol); /// generate a call to a higher-order lowlevel fn build_higher_order_lowlevel( diff --git a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs index 8ce114879ad..4edf5d9f30d 100644 --- a/crates/compiler/gen_llvm/src/llvm/lowlevel.rs +++ b/crates/compiler/gen_llvm/src/llvm/lowlevel.rs @@ -607,7 +607,7 @@ pub(crate) fn run_low_level<'a, 'ctx>( bitcode::STR_WITH_CAPACITY, ) } - ListLen => { + ListLenU64 => { // List.len : List * -> U64 arguments!(list); @@ -618,6 +618,12 @@ pub(crate) fn run_low_level<'a, 'ctx>( .new_build_int_cast(len_usize, env.context.i64_type(), "usize_to_u64") .into() } + ListLenUsize => { + // List.lenUsize : List * -> usize # used internally, not exposed + arguments!(list); + + list_len_usize(env.builder, list.into_struct_value()).into() + } ListGetCapacity => { // List.capacity: List a -> U64 arguments!(list); diff --git a/crates/compiler/gen_wasm/src/low_level.rs b/crates/compiler/gen_wasm/src/low_level.rs index b89a56724af..51d5fb68859 100644 --- a/crates/compiler/gen_wasm/src/low_level.rs +++ b/crates/compiler/gen_wasm/src/low_level.rs @@ -260,13 +260,14 @@ impl<'a> LowLevelCall<'a> { StrWithCapacity => self.load_args_and_call_zig(backend, bitcode::STR_WITH_CAPACITY), // List - ListLen => { + ListLenU64 => { self.load_list_len_usize(backend); // Length is stored as 32 bits in memory on wasm32, // but List.len always returns U64 backend.code_builder.i64_extend_u_i32(); } + ListLenUsize => self.load_list_len_usize(backend), ListGetCapacity => self.load_args_and_call_zig(backend, bitcode::LIST_CAPACITY), diff --git a/crates/compiler/load_internal/src/file.rs b/crates/compiler/load_internal/src/file.rs index 2eb1d05e6ec..c4239ded421 100644 --- a/crates/compiler/load_internal/src/file.rs +++ b/crates/compiler/load_internal/src/file.rs @@ -4703,7 +4703,7 @@ fn synth_list_len_type(subs: &mut Subs) -> Variable { Content::Structure(FlatType::Apply(Symbol::LIST_LIST, a_slice)), ); let fn_var = synth_import(subs, Content::Error); - let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN, [])]); + let solved_list_len = UnionLabels::insert_into_subs(subs, [(Symbol::LIST_LEN_U64, [])]); let clos_list_len = synth_import( subs, Content::LambdaSet(LambdaSet { @@ -4757,7 +4757,7 @@ pub fn add_imports( // Num needs List.len, but List imports Num. let list_len_type_var = synth_list_len_type(subs); let list_len_type_index = constraints.push_variable(list_len_type_var); - def_types.push((Symbol::LIST_LEN, Loc::at_zero(list_len_type_index))); + def_types.push((Symbol::LIST_LEN_U64, Loc::at_zero(list_len_type_index))); import_variables.push(list_len_type_var); } diff --git a/crates/compiler/module/src/low_level.rs b/crates/compiler/module/src/low_level.rs index fa10de5b794..2e795e08d77 100644 --- a/crates/compiler/module/src/low_level.rs +++ b/crates/compiler/module/src/low_level.rs @@ -26,7 +26,8 @@ pub enum LowLevel { StrReserve, StrWithCapacity, StrReleaseExcessCapacity, - ListLen, + ListLenUsize, + ListLenU64, ListWithCapacity, ListReserve, ListReleaseExcessCapacity, @@ -268,7 +269,8 @@ map_symbol_to_lowlevel! { StrToNum <= STR_TO_NUM; StrWithCapacity <= STR_WITH_CAPACITY; StrReleaseExcessCapacity <= STR_RELEASE_EXCESS_CAPACITY; - ListLen <= LIST_LEN; + ListLenU64 <= LIST_LEN_U64; + ListLenUsize <= LIST_LEN_USIZE; ListGetCapacity <= LIST_CAPACITY; ListWithCapacity <= LIST_WITH_CAPACITY; ListReserve <= LIST_RESERVE; diff --git a/crates/compiler/module/src/symbol.rs b/crates/compiler/module/src/symbol.rs index c53a964fefd..b11cac72f97 100644 --- a/crates/compiler/module/src/symbol.rs +++ b/crates/compiler/module/src/symbol.rs @@ -1342,7 +1342,7 @@ define_builtins! { 3 LIST_SET: "set" 4 LIST_APPEND: "append" 5 LIST_MAP: "map" - 6 LIST_LEN: "len" + 6 LIST_LEN_U64: "len" 7 LIST_WALK_BACKWARDS: "walkBackwards" 8 LIST_CONCAT: "concat" 9 LIST_FIRST: "first" @@ -1424,6 +1424,7 @@ define_builtins! { 85 LIST_PREPEND_IF_OK: "prependIfOk" 86 LIST_WALK_WITH_INDEX_UNTIL: "walkWithIndexUntil" 87 LIST_CLONE: "clone" + 88 LIST_LEN_USIZE: "lenUsize" } 7 RESULT: "Result" => { 0 RESULT_RESULT: "Result" exposed_type=true // the Result.Result type alias diff --git a/crates/compiler/mono/src/code_gen_help/equality.rs b/crates/compiler/mono/src/code_gen_help/equality.rs index d2ce3e3cc97..3a0d12e826d 100644 --- a/crates/compiler/mono/src/code_gen_help/equality.rs +++ b/crates/compiler/mono/src/code_gen_help/equality.rs @@ -668,8 +668,8 @@ fn eq_list<'a>( let len_1 = root.create_symbol(ident_ids, "len_1"); let len_2 = root.create_symbol(ident_ids, "len_2"); - let len_1_stmt = |next| let_lowlevel(arena, Layout::U64, len_1, ListLen, &[ARG_1], next); - let len_2_stmt = |next| let_lowlevel(arena, Layout::U64, len_2, ListLen, &[ARG_2], next); + let len_1_stmt = |next| let_lowlevel(arena, layout_isize, len_1, ListLenUsize, &[ARG_1], next); + let len_2_stmt = |next| let_lowlevel(arena, layout_isize, len_2, ListLenUsize, &[ARG_2], next); let eq_len = root.create_symbol(ident_ids, "eq_len"); let eq_len_stmt = |next| let_lowlevel(arena, LAYOUT_BOOL, eq_len, Eq, &[len_1, len_2], next); diff --git a/crates/compiler/mono/src/code_gen_help/refcount.rs b/crates/compiler/mono/src/code_gen_help/refcount.rs index 11556e162a6..d2882732f5a 100644 --- a/crates/compiler/mono/src/code_gen_help/refcount.rs +++ b/crates/compiler/mono/src/code_gen_help/refcount.rs @@ -926,12 +926,12 @@ fn refcount_list<'a>( // let len = root.create_symbol(ident_ids, "len"); - let len_stmt = |next| let_lowlevel(arena, Layout::U64, len, ListLen, &[structure], next); + let len_stmt = |next| let_lowlevel(arena, layout_isize, len, ListLenUsize, &[structure], next); // let zero = 0 let zero = root.create_symbol(ident_ids, "zero"); let zero_expr = Expr::Literal(Literal::Int(0i128.to_ne_bytes())); - let zero_stmt = |next| Stmt::Let(zero, zero_expr, Layout::U64, next); + let zero_stmt = |next| Stmt::Let(zero, zero_expr, layout_isize, next); // let is_empty = lowlevel Eq len zero let is_empty = root.create_symbol(ident_ids, "is_empty"); diff --git a/crates/compiler/mono/src/drop_specialization.rs b/crates/compiler/mono/src/drop_specialization.rs index 513ee7a0ba9..3f92d693466 100644 --- a/crates/compiler/mono/src/drop_specialization.rs +++ b/crates/compiler/mono/src/drop_specialization.rs @@ -1533,8 +1533,8 @@ fn low_level_no_rc(lowlevel: &LowLevel) -> RC { match lowlevel { Unreachable => RC::Uknown, - ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity | ListWithCapacity - | StrWithCapacity => RC::NoRc, + ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity + | ListWithCapacity | StrWithCapacity => RC::NoRc, ListReplaceUnsafe => RC::Rc, StrGetUnsafe | ListGetUnsafe => RC::NoRc, ListConcat => RC::Rc, diff --git a/crates/compiler/mono/src/inc_dec.rs b/crates/compiler/mono/src/inc_dec.rs index bf593e798dc..402fc113590 100644 --- a/crates/compiler/mono/src/inc_dec.rs +++ b/crates/compiler/mono/src/inc_dec.rs @@ -1283,7 +1283,7 @@ fn lowlevel_borrow_signature(arena: &Bump, op: LowLevel) -> &[Ownership] { match op { Unreachable => arena.alloc_slice_copy(&[irrelevant]), DictPseudoSeed => arena.alloc_slice_copy(&[irrelevant]), - ListLen | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { + ListLenU64 | ListLenUsize | StrIsEmpty | StrCountUtf8Bytes | ListGetCapacity => { arena.alloc_slice_copy(&[borrowed]) } ListWithCapacity | StrWithCapacity => arena.alloc_slice_copy(&[irrelevant]), diff --git a/crates/compiler/mono/src/ir/decision_tree.rs b/crates/compiler/mono/src/ir/decision_tree.rs index 878c2e09776..853011ca090 100644 --- a/crates/compiler/mono/src/ir/decision_tree.rs +++ b/crates/compiler/mono/src/ir/decision_tree.rs @@ -1769,7 +1769,7 @@ fn test_to_comparison<'a>( LayoutRepr::Builtin(Builtin::List(_elem_layout)) => { let real_len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1779,8 +1779,10 @@ fn test_to_comparison<'a>( let real_len = env.unique_symbol(); let test_len = env.unique_symbol(); - stores.push((real_len, Layout::U64, real_len_expr)); - stores.push((test_len, Layout::U64, test_len_expr)); + let usize_layout = Layout::usize(env.target_info); + + stores.push((real_len, usize_layout, real_len_expr)); + stores.push((test_len, usize_layout, test_len_expr)); let comparison = match bound { ListLenBound::Exact => (real_len, Comparator::Eq, test_len), @@ -2335,7 +2337,7 @@ fn decide_to_branching<'a>( let len_symbol = env.unique_symbol(); let switch = Stmt::Switch { - cond_layout: Layout::U64, + cond_layout: Layout::usize(env.target_info), cond_symbol: len_symbol, branches: branches.into_bump_slice(), default_branch: (default_branch_info, env.arena.alloc(default_branch)), @@ -2344,13 +2346,18 @@ fn decide_to_branching<'a>( let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenUsize, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([inner_cond_symbol]), }); - Stmt::Let(len_symbol, len_expr, Layout::U64, env.arena.alloc(switch)) + Stmt::Let( + len_symbol, + len_expr, + Layout::usize(env.target_info), + env.arena.alloc(switch), + ) } else { Stmt::Switch { cond_layout: inner_cond_layout, diff --git a/crates/compiler/mono/src/ir/pattern.rs b/crates/compiler/mono/src/ir/pattern.rs index a8980935f95..e04d6f72f44 100644 --- a/crates/compiler/mono/src/ir/pattern.rs +++ b/crates/compiler/mono/src/ir/pattern.rs @@ -1410,7 +1410,7 @@ pub(crate) fn build_list_index_probe<'a>( let len_sym = env.unique_symbol(); let len_expr = Expr::Call(Call { call_type: CallType::LowLevel { - op: LowLevel::ListLen, + op: LowLevel::ListLenU64, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), @@ -1567,7 +1567,7 @@ fn store_list_rest<'a>( call_type: CallType::LowLevel { // Must use ListLenU64 here because we're using it with List.sublist, // which takes U64s for start and len. - op: LowLevel::ListLen, + op: LowLevel::ListLenU64, update_mode: env.next_update_mode_id(), }, arguments: env.arena.alloc([list_sym]), diff --git a/crates/compiler/mono/src/low_level.rs b/crates/compiler/mono/src/low_level.rs index e8cdb934801..2472ed97787 100644 --- a/crates/compiler/mono/src/low_level.rs +++ b/crates/compiler/mono/src/low_level.rs @@ -70,6 +70,7 @@ enum FirstOrder { StrRepeat, StrFromFloat, ListLenU64, + ListLenUsize, ListGetUnsafe, ListSublist, ListDropAt, From 12aa775f547f29dd78b4fe032816d955514b68e7 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Fri, 16 Feb 2024 21:14:42 -0500 Subject: [PATCH 80/80] Update mono tests --- ...lambda_set_productive_nullable_wrapped.txt | 4 +- .../test_mono/generated/dbg_in_expect.txt | 4 +- .../generated/dbg_str_followed_by_number.txt | 4 +- .../encode_derived_nested_record_string.txt | 278 +++++++++--------- ...encode_derived_record_one_field_string.txt | 230 +++++++-------- ...ncode_derived_record_two_field_strings.txt | 230 +++++++-------- .../generated/encode_derived_string.txt | 174 ++++++----- .../encode_derived_tag_one_field_string.txt | 238 ++++++++------- ...encode_derived_tag_two_payloads_string.txt | 234 ++++++++------- .../generated/inspect_derived_dict.txt | 8 +- .../generated/inspect_derived_list.txt | 4 +- .../inspect_derived_nested_record_string.txt | 4 +- .../generated/inspect_derived_record.txt | 4 +- ...nspect_derived_record_one_field_string.txt | 4 +- ...spect_derived_record_two_field_strings.txt | 4 +- .../generated/inspect_derived_string.txt | 4 +- .../inspect_derived_tag_one_field_string.txt | 4 +- ...nspect_derived_tag_two_payloads_string.txt | 4 +- ...cialize_errors_behind_unified_branches.txt | 36 +-- .../test_mono/generated/issue_4749.txt | 34 +-- ..._4772_weakened_monomorphic_destructure.txt | 78 +++-- .../test_mono/generated/issue_6196.txt | 2 +- ...pture_niches_with_other_lambda_capture.txt | 4 +- .../generated/list_map_closure_borrows.txt | 8 +- .../generated/list_map_closure_owns.txt | 4 +- .../polymorphic_expression_unification.txt | 4 +- .../generated/recursively_build_effect.txt | 4 +- ...not_duplicate_identical_concrete_types.txt | 4 +- ...types_without_unification_of_unifiable.txt | 4 +- .../specialize/inspect/opaque_automatic.txt | 4 +- .../inspect/opaque_automatic_late.txt | 4 +- 31 files changed, 805 insertions(+), 821 deletions(-) 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 c98a783e9c5..3035636660b 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 @@ -40,8 +40,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.234 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.234; procedure Test.1 (Test.5): ret Test.5; diff --git a/crates/compiler/test_mono/generated/dbg_in_expect.txt b/crates/compiler/test_mono/generated/dbg_in_expect.txt index a4e869f195c..a1c97597ac0 100644 --- a/crates/compiler/test_mono/generated/dbg_in_expect.txt +++ b/crates/compiler/test_mono/generated/dbg_in_expect.txt @@ -42,8 +42,8 @@ procedure Inspect.60 (Inspect.298): ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; procedure Test.1 (): let Test.4 : Str = ""; 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 1836a44aeea..0bd7f21f88b 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 @@ -38,8 +38,8 @@ procedure Inspect.60 (Inspect.298): ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; procedure Test.0 (): let Test.3 : Str = ""; 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 e727df92773..ec57d326238 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 @@ -66,188 +66,188 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.684 : U64 = 0i64; - let List.685 : U64 = CallByName List.6 List.487; - let List.683 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.684 List.685; - ret List.683; + let List.683 : U64 = 0i64; + let List.684 : U64 = CallByName List.6 List.487; + let List.682 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.683 List.684; + ret List.682; procedure List.18 (List.159, List.160, List.161): - let List.594 : U64 = 0i64; - let List.595 : U64 = CallByName List.6 List.159; - let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; - ret List.593; + let List.593 : U64 = 0i64; + let List.594 : U64 = CallByName List.6 List.159; + let List.592 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.593 List.594; + ret List.592; procedure List.18 (List.159, List.160, List.161): - let List.628 : U64 = 0i64; - let List.629 : U64 = CallByName List.6 List.159; - let List.627 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.628 List.629; - ret List.627; + let List.627 : U64 = 0i64; + let List.628 : U64 = CallByName List.6 List.159; + let List.626 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.627 List.628; + ret List.626; procedure List.18 (List.159, List.160, List.161): - let List.640 : U64 = 0i64; - let List.641 : U64 = CallByName List.6 List.159; - let List.639 : List U8 = CallByName List.91 List.159 List.160 List.161 List.640 List.641; - ret List.639; + let List.639 : U64 = 0i64; + let List.640 : U64 = CallByName List.6 List.159; + let List.638 : List U8 = CallByName List.91 List.159 List.160 List.161 List.639 List.640; + ret List.638; procedure List.26 (List.200, List.201, List.202): - let List.677 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.680 : U8 = 1i64; - let List.681 : U8 = GetTagId List.677; - let List.682 : Int1 = lowlevel Eq List.680 List.681; - if List.682 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.677; + let List.676 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.679 : U8 = 1i64; + let List.680 : U8 = GetTagId List.676; + let List.681 : Int1 = lowlevel Eq List.679 List.680; + if List.681 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.676; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.677; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.676; ret List.204; procedure List.4 (List.123, List.124): - let List.626 : U64 = 1i64; - let List.625 : List U8 = CallByName List.70 List.123 List.626; - let List.624 : List U8 = CallByName List.71 List.625 List.124; - ret List.624; + let List.625 : U64 = 1i64; + let List.624 : List U8 = CallByName List.70 List.123 List.625; + let List.623 : List U8 = CallByName List.71 List.624 List.124; + ret List.623; procedure List.49 (List.419, List.420): - let List.668 : U64 = StructAtIndex 1 List.420; - let List.669 : U64 = StructAtIndex 0 List.420; - let List.667 : List U8 = CallByName List.72 List.419 List.668 List.669; - ret List.667; + let List.667 : U64 = StructAtIndex 1 List.420; + let List.668 : U64 = StructAtIndex 0 List.420; + let List.666 : List U8 = CallByName List.72 List.419 List.667 List.668; + ret List.666; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.675 List.437: - let List.673 : U64 = 0i64; - let List.672 : {U64, U64} = Struct {List.437, List.673}; + joinpoint List.674 List.437: + let List.672 : U64 = 0i64; + let List.671 : {U64, U64} = Struct {List.437, List.672}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.672; - let List.671 : U64 = CallByName Num.75 List.436 List.437; - let List.666 : {U64, U64} = Struct {List.671, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.666; - let List.665 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.665; + let List.438 : List U8 = CallByName List.49 List.434 List.671; + let List.670 : U64 = CallByName Num.75 List.436 List.437; + let List.665 : {U64, U64} = Struct {List.670, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.665; + let List.664 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.664; in - let List.676 : Int1 = CallByName Num.24 List.436 List.435; - if List.676 then - jump List.675 List.435; + let List.675 : Int1 = CallByName Num.24 List.436 List.435; + if List.675 then + jump List.674 List.435; else - jump List.675 List.436; + jump List.674 List.436; procedure List.6 (#Attr.2): - let List.606 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.606; + let List.605 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.605; procedure List.6 (#Attr.2): - let List.660 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.660; + let List.659 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.659; procedure List.6 (#Attr.2): - let List.662 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.662; + let List.661 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.661; procedure List.66 (#Attr.2, #Attr.3): - let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.603; + let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.602; procedure List.66 (#Attr.2, #Attr.3): - let List.637 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.637; + let List.636 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.636; procedure List.66 (#Attr.2, #Attr.3): - let List.649 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.649; + let List.648 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.648; procedure List.68 (#Attr.2): - let List.664 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.664; + let List.663 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.663; procedure List.70 (#Attr.2, #Attr.3): - let List.611 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.611; + let List.610 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.610; procedure List.71 (#Attr.2, #Attr.3): - let List.609 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.609; + let List.608 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.670 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.670; + let List.669 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.669; procedure List.8 (#Attr.2, #Attr.3): - let List.659 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.659; - -procedure List.80 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): - joinpoint List.686 List.490 List.491 List.492 List.493 List.494: - let List.688 : Int1 = CallByName Num.22 List.493 List.494; - if List.688 then - let List.697 : U8 = CallByName List.66 List.490 List.493; - let List.689 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.697; - let List.694 : U8 = 1i64; - let List.695 : U8 = GetTagId List.689; - let List.696 : Int1 = lowlevel Eq List.694 List.695; - if List.696 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.689; - let List.692 : U64 = 1i64; - let List.691 : U64 = CallByName Num.51 List.493 List.692; - jump List.686 List.490 List.495 List.492 List.691 List.494; + let List.658 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.658; + +procedure List.80 (#Derived_gen.45, #Derived_gen.46, #Derived_gen.47, #Derived_gen.48, #Derived_gen.49): + joinpoint List.685 List.490 List.491 List.492 List.493 List.494: + let List.687 : Int1 = CallByName Num.22 List.493 List.494; + if List.687 then + let List.696 : U8 = CallByName List.66 List.490 List.493; + let List.688 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.696; + let List.693 : U8 = 1i64; + let List.694 : U8 = GetTagId List.688; + let List.695 : Int1 = lowlevel Eq List.693 List.694; + if List.695 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.688; + let List.691 : U64 = 1i64; + let List.690 : U64 = CallByName Num.51 List.493 List.691; + jump List.685 List.490 List.495 List.492 List.690 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.689; - let List.693 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.693; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.688; + let List.692 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.692; else dec List.490; - let List.687 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.687; + let List.686 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.686; in - jump List.686 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; - -procedure List.91 (#Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23, #Derived_gen.24): - joinpoint List.642 List.162 List.163 List.164 List.165 List.166: - let List.644 : Int1 = CallByName Num.22 List.165 List.166; - if List.644 then - let List.648 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.648; - let List.647 : U64 = 1i64; - let List.646 : U64 = CallByName Num.51 List.165 List.647; - jump List.642 List.162 List.167 List.164 List.646 List.166; + jump List.685 #Derived_gen.45 #Derived_gen.46 #Derived_gen.47 #Derived_gen.48 #Derived_gen.49; + +procedure List.91 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): + joinpoint List.641 List.162 List.163 List.164 List.165 List.166: + let List.643 : Int1 = CallByName Num.22 List.165 List.166; + if List.643 then + let List.647 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.647; + let List.646 : U64 = 1i64; + let List.645 : U64 = CallByName Num.51 List.165 List.646; + jump List.641 List.162 List.167 List.164 List.645 List.166; else dec List.162; ret List.163; in - jump List.642 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24; - -procedure List.91 (#Derived_gen.31, #Derived_gen.32, #Derived_gen.33, #Derived_gen.34, #Derived_gen.35): - joinpoint List.630 List.162 List.163 List.164 List.165 List.166: - let List.632 : Int1 = CallByName Num.22 List.165 List.166; - if List.632 then - let List.636 : {Str, Str} = CallByName List.66 List.162 List.165; - inc List.636; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.636; - let List.635 : U64 = 1i64; - let List.634 : U64 = CallByName Num.51 List.165 List.635; - jump List.630 List.162 List.167 List.164 List.634 List.166; + jump List.641 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + +procedure List.91 (#Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31, #Derived_gen.32): + joinpoint List.629 List.162 List.163 List.164 List.165 List.166: + let List.631 : Int1 = CallByName Num.22 List.165 List.166; + if List.631 then + let List.635 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.635; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.635; + let List.634 : U64 = 1i64; + let List.633 : U64 = CallByName Num.51 List.165 List.634; + jump List.629 List.162 List.167 List.164 List.633 List.166; else dec List.162; ret List.163; in - jump List.630 #Derived_gen.31 #Derived_gen.32 #Derived_gen.33 #Derived_gen.34 #Derived_gen.35; - -procedure List.91 (#Derived_gen.36, #Derived_gen.37, #Derived_gen.38, #Derived_gen.39, #Derived_gen.40): - joinpoint List.596 List.162 List.163 List.164 List.165 List.166: - let List.598 : Int1 = CallByName Num.22 List.165 List.166; - if List.598 then - let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; - inc List.602; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; - let List.601 : U64 = 1i64; - let List.600 : U64 = CallByName Num.51 List.165 List.601; - jump List.596 List.162 List.167 List.164 List.600 List.166; + jump List.629 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31 #Derived_gen.32; + +procedure List.91 (#Derived_gen.50, #Derived_gen.51, #Derived_gen.52, #Derived_gen.53, #Derived_gen.54): + joinpoint List.595 List.162 List.163 List.164 List.165 List.166: + let List.597 : Int1 = CallByName Num.22 List.165 List.166; + if List.597 then + let List.601 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.601; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.601; + let List.600 : U64 = 1i64; + let List.599 : U64 = CallByName Num.51 List.165 List.600; + jump List.595 List.162 List.167 List.164 List.599 List.166; else dec List.162; ret List.163; in - jump List.596 #Derived_gen.36 #Derived_gen.37 #Derived_gen.38 #Derived_gen.39 #Derived_gen.40; + jump List.595 #Derived_gen.50 #Derived_gen.51 #Derived_gen.52 #Derived_gen.53 #Derived_gen.54; procedure Num.127 (#Attr.2): let Num.282 : U8 = lowlevel NumIntCast #Attr.2; @@ -286,30 +286,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.295; procedure Str.12 (#Attr.2): - let Str.261 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.261; + let Str.242 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.242; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.55 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.55; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1043, TotallyNotJson.149): let TotallyNotJson.1046 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 155f17b9941..cc689d67fc7 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 @@ -39,158 +39,158 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.650 : U64 = 0i64; - let List.651 : U64 = CallByName List.6 List.487; - let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.650 List.651; - ret List.649; + let List.649 : U64 = 0i64; + let List.650 : U64 = CallByName List.6 List.487; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.649 List.650; + ret List.648; procedure List.18 (List.159, List.160, List.161): - let List.594 : U64 = 0i64; - let List.595 : U64 = CallByName List.6 List.159; - let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; - ret List.593; + let List.593 : U64 = 0i64; + let List.594 : U64 = CallByName List.6 List.159; + let List.592 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.593 List.594; + ret List.592; procedure List.18 (List.159, List.160, List.161): - let List.606 : U64 = 0i64; - let List.607 : U64 = CallByName List.6 List.159; - let List.605 : List U8 = CallByName List.91 List.159 List.160 List.161 List.606 List.607; - ret List.605; + let List.605 : U64 = 0i64; + let List.606 : U64 = CallByName List.6 List.159; + let List.604 : List U8 = CallByName List.91 List.159 List.160 List.161 List.605 List.606; + ret List.604; procedure List.26 (List.200, List.201, List.202): - let List.643 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.646 : U8 = 1i64; - let List.647 : U8 = GetTagId List.643; - let List.648 : Int1 = lowlevel Eq List.646 List.647; - if List.648 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.643; + let List.642 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.645 : U8 = 1i64; + let List.646 : U8 = GetTagId List.642; + let List.647 : Int1 = lowlevel Eq List.645 List.646; + if List.647 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.642; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.643; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.642; ret List.204; procedure List.4 (List.123, List.124): - let List.592 : U64 = 1i64; - let List.591 : List U8 = CallByName List.70 List.123 List.592; - let List.590 : List U8 = CallByName List.71 List.591 List.124; - ret List.590; + let List.591 : U64 = 1i64; + let List.590 : List U8 = CallByName List.70 List.123 List.591; + let List.589 : List U8 = CallByName List.71 List.590 List.124; + ret List.589; procedure List.49 (List.419, List.420): - let List.634 : U64 = StructAtIndex 1 List.420; - let List.635 : U64 = StructAtIndex 0 List.420; - let List.633 : List U8 = CallByName List.72 List.419 List.634 List.635; - ret List.633; + let List.633 : U64 = StructAtIndex 1 List.420; + let List.634 : U64 = StructAtIndex 0 List.420; + let List.632 : List U8 = CallByName List.72 List.419 List.633 List.634; + ret List.632; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.641 List.437: - let List.639 : U64 = 0i64; - let List.638 : {U64, U64} = Struct {List.437, List.639}; + joinpoint List.640 List.437: + let List.638 : U64 = 0i64; + let List.637 : {U64, U64} = Struct {List.437, List.638}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.638; - let List.637 : U64 = CallByName Num.75 List.436 List.437; - let List.632 : {U64, U64} = Struct {List.637, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.632; - let List.631 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.631; + let List.438 : List U8 = CallByName List.49 List.434 List.637; + let List.636 : U64 = CallByName Num.75 List.436 List.437; + let List.631 : {U64, U64} = Struct {List.636, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.631; + let List.630 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.630; in - let List.642 : Int1 = CallByName Num.24 List.436 List.435; - if List.642 then - jump List.641 List.435; + let List.641 : Int1 = CallByName Num.24 List.436 List.435; + if List.641 then + jump List.640 List.435; else - jump List.641 List.436; + jump List.640 List.436; procedure List.6 (#Attr.2): - let List.626 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.626; + let List.625 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.625; procedure List.6 (#Attr.2): - let List.628 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.628; + let List.627 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.627; procedure List.66 (#Attr.2, #Attr.3): - let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.603; + let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.602; procedure List.66 (#Attr.2, #Attr.3): - let List.615 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.615; + let List.614 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.614; procedure List.68 (#Attr.2): - let List.630 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.630; + let List.629 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.629; procedure List.70 (#Attr.2, #Attr.3): - let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.577; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.575; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.636 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.636; + let List.635 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.635; procedure List.8 (#Attr.2, #Attr.3): - let List.625 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.625; + let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.624; procedure List.80 (#Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27): - joinpoint List.652 List.490 List.491 List.492 List.493 List.494: - let List.654 : Int1 = CallByName Num.22 List.493 List.494; - if List.654 then - let List.663 : U8 = CallByName List.66 List.490 List.493; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.663; - let List.660 : U8 = 1i64; - let List.661 : U8 = GetTagId List.655; - let List.662 : Int1 = lowlevel Eq List.660 List.661; - if List.662 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.655; - let List.658 : U64 = 1i64; - let List.657 : U64 = CallByName Num.51 List.493 List.658; - jump List.652 List.490 List.495 List.492 List.657 List.494; + joinpoint List.651 List.490 List.491 List.492 List.493 List.494: + let List.653 : Int1 = CallByName Num.22 List.493 List.494; + if List.653 then + let List.662 : U8 = CallByName List.66 List.490 List.493; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.662; + let List.659 : U8 = 1i64; + let List.660 : U8 = GetTagId List.654; + let List.661 : Int1 = lowlevel Eq List.659 List.660; + if List.661 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.654; + let List.657 : U64 = 1i64; + let List.656 : U64 = CallByName Num.51 List.493 List.657; + jump List.651 List.490 List.495 List.492 List.656 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.655; - let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.659; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.654; + let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.658; else dec List.490; - let List.653 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.653; + let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.652; in - jump List.652 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; - -procedure List.91 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): - joinpoint List.596 List.162 List.163 List.164 List.165 List.166: - let List.598 : Int1 = CallByName Num.22 List.165 List.166; - if List.598 then - let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; - inc List.602; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; - let List.601 : U64 = 1i64; - let List.600 : U64 = CallByName Num.51 List.165 List.601; - jump List.596 List.162 List.167 List.164 List.600 List.166; + jump List.651 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27; + +procedure List.91 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): + joinpoint List.595 List.162 List.163 List.164 List.165 List.166: + let List.597 : Int1 = CallByName Num.22 List.165 List.166; + if List.597 then + let List.601 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.601; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.601; + let List.600 : U64 = 1i64; + let List.599 : U64 = CallByName Num.51 List.165 List.600; + jump List.595 List.162 List.167 List.164 List.599 List.166; else dec List.162; ret List.163; in - jump List.596 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + jump List.595 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; procedure List.91 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): - joinpoint List.608 List.162 List.163 List.164 List.165 List.166: - let List.610 : Int1 = CallByName Num.22 List.165 List.166; - if List.610 then - let List.614 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.614; - let List.613 : U64 = 1i64; - let List.612 : U64 = CallByName Num.51 List.165 List.613; - jump List.608 List.162 List.167 List.164 List.612 List.166; + joinpoint List.607 List.162 List.163 List.164 List.165 List.166: + let List.609 : Int1 = CallByName Num.22 List.165 List.166; + if List.609 then + let List.613 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.613; + let List.612 : U64 = 1i64; + let List.611 : U64 = CallByName Num.51 List.165 List.612; + jump List.607 List.162 List.167 List.164 List.611 List.166; else dec List.162; ret List.163; in - jump List.608 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.607 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; procedure Num.127 (#Attr.2): let Num.272 : U8 = lowlevel NumIntCast #Attr.2; @@ -229,30 +229,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.285; procedure Str.12 (#Attr.2): - let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.260; + let Str.241 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.241; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.34 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.34; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 ab0039ecbd0..3fc3415f682 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 @@ -46,158 +46,158 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.650 : U64 = 0i64; - let List.651 : U64 = CallByName List.6 List.487; - let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.650 List.651; - ret List.649; + let List.649 : U64 = 0i64; + let List.650 : U64 = CallByName List.6 List.487; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.649 List.650; + ret List.648; procedure List.18 (List.159, List.160, List.161): - let List.594 : U64 = 0i64; - let List.595 : U64 = CallByName List.6 List.159; - let List.593 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.594 List.595; - ret List.593; + let List.593 : U64 = 0i64; + let List.594 : U64 = CallByName List.6 List.159; + let List.592 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.593 List.594; + ret List.592; procedure List.18 (List.159, List.160, List.161): - let List.606 : U64 = 0i64; - let List.607 : U64 = CallByName List.6 List.159; - let List.605 : List U8 = CallByName List.91 List.159 List.160 List.161 List.606 List.607; - ret List.605; + let List.605 : U64 = 0i64; + let List.606 : U64 = CallByName List.6 List.159; + let List.604 : List U8 = CallByName List.91 List.159 List.160 List.161 List.605 List.606; + ret List.604; procedure List.26 (List.200, List.201, List.202): - let List.643 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.646 : U8 = 1i64; - let List.647 : U8 = GetTagId List.643; - let List.648 : Int1 = lowlevel Eq List.646 List.647; - if List.648 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.643; + let List.642 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.645 : U8 = 1i64; + let List.646 : U8 = GetTagId List.642; + let List.647 : Int1 = lowlevel Eq List.645 List.646; + if List.647 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.642; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.643; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.642; ret List.204; procedure List.4 (List.123, List.124): - let List.592 : U64 = 1i64; - let List.591 : List U8 = CallByName List.70 List.123 List.592; - let List.590 : List U8 = CallByName List.71 List.591 List.124; - ret List.590; + let List.591 : U64 = 1i64; + let List.590 : List U8 = CallByName List.70 List.123 List.591; + let List.589 : List U8 = CallByName List.71 List.590 List.124; + ret List.589; procedure List.49 (List.419, List.420): - let List.634 : U64 = StructAtIndex 1 List.420; - let List.635 : U64 = StructAtIndex 0 List.420; - let List.633 : List U8 = CallByName List.72 List.419 List.634 List.635; - ret List.633; + let List.633 : U64 = StructAtIndex 1 List.420; + let List.634 : U64 = StructAtIndex 0 List.420; + let List.632 : List U8 = CallByName List.72 List.419 List.633 List.634; + ret List.632; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.641 List.437: - let List.639 : U64 = 0i64; - let List.638 : {U64, U64} = Struct {List.437, List.639}; + joinpoint List.640 List.437: + let List.638 : U64 = 0i64; + let List.637 : {U64, U64} = Struct {List.437, List.638}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.638; - let List.637 : U64 = CallByName Num.75 List.436 List.437; - let List.632 : {U64, U64} = Struct {List.637, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.632; - let List.631 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.631; + let List.438 : List U8 = CallByName List.49 List.434 List.637; + let List.636 : U64 = CallByName Num.75 List.436 List.437; + let List.631 : {U64, U64} = Struct {List.636, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.631; + let List.630 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.630; in - let List.642 : Int1 = CallByName Num.24 List.436 List.435; - if List.642 then - jump List.641 List.435; + let List.641 : Int1 = CallByName Num.24 List.436 List.435; + if List.641 then + jump List.640 List.435; else - jump List.641 List.436; + jump List.640 List.436; procedure List.6 (#Attr.2): - let List.626 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.626; + let List.625 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.625; procedure List.6 (#Attr.2): - let List.628 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.628; + let List.627 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.627; procedure List.66 (#Attr.2, #Attr.3): - let List.603 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.603; + let List.602 : {Str, Str} = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.602; procedure List.66 (#Attr.2, #Attr.3): - let List.615 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.615; + let List.614 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.614; procedure List.68 (#Attr.2): - let List.630 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.630; + let List.629 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.629; procedure List.70 (#Attr.2, #Attr.3): - let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.577; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.575; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.636 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.636; + let List.635 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.635; procedure List.8 (#Attr.2, #Attr.3): - let List.625 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.625; + let List.624 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.624; procedure List.80 (#Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30, #Derived_gen.31): - joinpoint List.652 List.490 List.491 List.492 List.493 List.494: - let List.654 : Int1 = CallByName Num.22 List.493 List.494; - if List.654 then - let List.663 : U8 = CallByName List.66 List.490 List.493; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.663; - let List.660 : U8 = 1i64; - let List.661 : U8 = GetTagId List.655; - let List.662 : Int1 = lowlevel Eq List.660 List.661; - if List.662 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.655; - let List.658 : U64 = 1i64; - let List.657 : U64 = CallByName Num.51 List.493 List.658; - jump List.652 List.490 List.495 List.492 List.657 List.494; + joinpoint List.651 List.490 List.491 List.492 List.493 List.494: + let List.653 : Int1 = CallByName Num.22 List.493 List.494; + if List.653 then + let List.662 : U8 = CallByName List.66 List.490 List.493; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.662; + let List.659 : U8 = 1i64; + let List.660 : U8 = GetTagId List.654; + let List.661 : Int1 = lowlevel Eq List.659 List.660; + if List.661 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.654; + let List.657 : U64 = 1i64; + let List.656 : U64 = CallByName Num.51 List.493 List.657; + jump List.651 List.490 List.495 List.492 List.656 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.655; - let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.659; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.654; + let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.658; else dec List.490; - let List.653 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.653; + let List.652 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.652; in - jump List.652 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31; - -procedure List.91 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): - joinpoint List.596 List.162 List.163 List.164 List.165 List.166: - let List.598 : Int1 = CallByName Num.22 List.165 List.166; - if List.598 then - let List.602 : {Str, Str} = CallByName List.66 List.162 List.165; - inc List.602; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.602; - let List.601 : U64 = 1i64; - let List.600 : U64 = CallByName Num.51 List.165 List.601; - jump List.596 List.162 List.167 List.164 List.600 List.166; + jump List.651 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30 #Derived_gen.31; + +procedure List.91 (#Derived_gen.17, #Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21): + joinpoint List.595 List.162 List.163 List.164 List.165 List.166: + let List.597 : Int1 = CallByName Num.22 List.165 List.166; + if List.597 then + let List.601 : {Str, Str} = CallByName List.66 List.162 List.165; + inc List.601; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.203 List.163 List.601; + let List.600 : U64 = 1i64; + let List.599 : U64 = CallByName Num.51 List.165 List.600; + jump List.595 List.162 List.167 List.164 List.599 List.166; else dec List.162; ret List.163; in - jump List.596 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; + jump List.595 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21; procedure List.91 (#Derived_gen.22, #Derived_gen.23, #Derived_gen.24, #Derived_gen.25, #Derived_gen.26): - joinpoint List.608 List.162 List.163 List.164 List.165 List.166: - let List.610 : Int1 = CallByName Num.22 List.165 List.166; - if List.610 then - let List.614 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.614; - let List.613 : U64 = 1i64; - let List.612 : U64 = CallByName Num.51 List.165 List.613; - jump List.608 List.162 List.167 List.164 List.612 List.166; + joinpoint List.607 List.162 List.163 List.164 List.165 List.166: + let List.609 : Int1 = CallByName Num.22 List.165 List.166; + if List.609 then + let List.613 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.613; + let List.612 : U64 = 1i64; + let List.611 : U64 = CallByName Num.51 List.165 List.612; + jump List.607 List.162 List.167 List.164 List.611 List.166; else dec List.162; ret List.163; in - jump List.608 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; + jump List.607 #Derived_gen.22 #Derived_gen.23 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26; procedure Num.127 (#Attr.2): let Num.272 : U8 = lowlevel NumIntCast #Attr.2; @@ -236,30 +236,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.285; procedure Str.12 (#Attr.2): - let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.260; + let Str.241 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.241; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.38 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.38; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1009, TotallyNotJson.149): let TotallyNotJson.1012 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; diff --git a/crates/compiler/test_mono/generated/encode_derived_string.txt b/crates/compiler/test_mono/generated/encode_derived_string.txt index 9341835e435..c22e092ee07 100644 --- a/crates/compiler/test_mono/generated/encode_derived_string.txt +++ b/crates/compiler/test_mono/generated/encode_derived_string.txt @@ -12,114 +12,114 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.615 : U64 = 0i64; - let List.616 : U64 = CallByName List.6 List.487; - let List.614 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.615 List.616; - ret List.614; + let List.614 : U64 = 0i64; + let List.615 : U64 = CallByName List.6 List.487; + let List.613 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.614 List.615; + ret List.613; procedure List.18 (List.159, List.160, List.161): - let List.586 : U64 = 0i64; - let List.587 : U64 = CallByName List.6 List.159; - let List.585 : List U8 = CallByName List.91 List.159 List.160 List.161 List.586 List.587; - ret List.585; + let List.585 : U64 = 0i64; + let List.586 : U64 = CallByName List.6 List.159; + let List.584 : List U8 = CallByName List.91 List.159 List.160 List.161 List.585 List.586; + ret List.584; procedure List.26 (List.200, List.201, List.202): - let List.608 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.611 : U8 = 1i64; - let List.612 : U8 = GetTagId List.608; - let List.613 : Int1 = lowlevel Eq List.611 List.612; - if List.613 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.608; + let List.607 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.610 : U8 = 1i64; + let List.611 : U8 = GetTagId List.607; + let List.612 : Int1 = lowlevel Eq List.610 List.611; + if List.612 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.607; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.608; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.607; ret List.204; procedure List.49 (List.419, List.420): - let List.599 : U64 = StructAtIndex 1 List.420; - let List.600 : U64 = StructAtIndex 0 List.420; - let List.598 : List U8 = CallByName List.72 List.419 List.599 List.600; - ret List.598; + let List.598 : U64 = StructAtIndex 1 List.420; + let List.599 : U64 = StructAtIndex 0 List.420; + let List.597 : List U8 = CallByName List.72 List.419 List.598 List.599; + ret List.597; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.606 List.437: - let List.604 : U64 = 0i64; - let List.603 : {U64, U64} = Struct {List.437, List.604}; + joinpoint List.605 List.437: + let List.603 : U64 = 0i64; + let List.602 : {U64, U64} = Struct {List.437, List.603}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.603; - let List.602 : U64 = CallByName Num.75 List.436 List.437; - let List.597 : {U64, U64} = Struct {List.602, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.597; - let List.596 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.596; + let List.438 : List U8 = CallByName List.49 List.434 List.602; + let List.601 : U64 = CallByName Num.75 List.436 List.437; + let List.596 : {U64, U64} = Struct {List.601, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.596; + let List.595 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.595; in - let List.607 : Int1 = CallByName Num.24 List.436 List.435; - if List.607 then - jump List.606 List.435; + let List.606 : Int1 = CallByName Num.24 List.436 List.435; + if List.606 then + jump List.605 List.435; else - jump List.606 List.436; + jump List.605 List.436; procedure List.6 (#Attr.2): - let List.584 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.584; + let List.583 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.583; procedure List.66 (#Attr.2, #Attr.3): - let List.595 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.595; + let List.594 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.594; procedure List.68 (#Attr.2): - let List.582 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.582; + let List.581 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.581; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.601 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.601; + let List.600 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.600; procedure List.8 (#Attr.2, #Attr.3): - let List.580 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.580; + let List.579 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.579; procedure List.80 (#Derived_gen.0, #Derived_gen.1, #Derived_gen.2, #Derived_gen.3, #Derived_gen.4): - joinpoint List.617 List.490 List.491 List.492 List.493 List.494: - let List.619 : Int1 = CallByName Num.22 List.493 List.494; - if List.619 then - let List.628 : U8 = CallByName List.66 List.490 List.493; - let List.620 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.628; - let List.625 : U8 = 1i64; - let List.626 : U8 = GetTagId List.620; - let List.627 : Int1 = lowlevel Eq List.625 List.626; - if List.627 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.620; - let List.623 : U64 = 1i64; - let List.622 : U64 = CallByName Num.51 List.493 List.623; - jump List.617 List.490 List.495 List.492 List.622 List.494; + joinpoint List.616 List.490 List.491 List.492 List.493 List.494: + let List.618 : Int1 = CallByName Num.22 List.493 List.494; + if List.618 then + let List.627 : U8 = CallByName List.66 List.490 List.493; + let List.619 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.627; + let List.624 : U8 = 1i64; + let List.625 : U8 = GetTagId List.619; + let List.626 : Int1 = lowlevel Eq List.624 List.625; + if List.626 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.619; + let List.622 : U64 = 1i64; + let List.621 : U64 = CallByName Num.51 List.493 List.622; + jump List.616 List.490 List.495 List.492 List.621 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.620; - let List.624 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.624; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.619; + let List.623 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.623; else dec List.490; - let List.618 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.618; + let List.617 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.617; in - jump List.617 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; + jump List.616 #Derived_gen.0 #Derived_gen.1 #Derived_gen.2 #Derived_gen.3 #Derived_gen.4; procedure List.91 (#Derived_gen.8, #Derived_gen.9, #Derived_gen.10, #Derived_gen.11, #Derived_gen.12): - joinpoint List.588 List.162 List.163 List.164 List.165 List.166: - let List.590 : Int1 = CallByName Num.22 List.165 List.166; - if List.590 then - let List.594 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.594; - let List.593 : U64 = 1i64; - let List.592 : U64 = CallByName Num.51 List.165 List.593; - jump List.588 List.162 List.167 List.164 List.592 List.166; + joinpoint List.587 List.162 List.163 List.164 List.165 List.166: + let List.589 : Int1 = CallByName Num.22 List.165 List.166; + if List.589 then + let List.593 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.593; + let List.592 : U64 = 1i64; + let List.591 : U64 = CallByName Num.51 List.165 List.592; + jump List.587 List.162 List.167 List.164 List.591 List.166; else dec List.162; ret List.163; in - jump List.588 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; + jump List.587 #Derived_gen.8 #Derived_gen.9 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12; procedure Num.137 (#Attr.2, #Attr.3): let Num.269 : U64 = lowlevel NumDivCeilUnchecked #Attr.2 #Attr.3; @@ -150,30 +150,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.275; procedure Str.12 (#Attr.2): - let Str.259 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.259; + let Str.240 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.240; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.13 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.13; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.973, TotallyNotJson.149): let TotallyNotJson.976 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 6ff0ef18740..6c1446bcc0b 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 @@ -41,158 +41,158 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.656 : U64 = 0i64; - let List.657 : U64 = CallByName List.6 List.487; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.656 List.657; - ret List.655; + let List.655 : U64 = 0i64; + let List.656 : U64 = CallByName List.6 List.487; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.655 List.656; + ret List.654; procedure List.18 (List.159, List.160, List.161): - let List.600 : U64 = 0i64; - let List.601 : U64 = CallByName List.6 List.159; - let List.599 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.600 List.601; - ret List.599; + let List.599 : U64 = 0i64; + let List.600 : U64 = CallByName List.6 List.159; + let List.598 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.599 List.600; + ret List.598; procedure List.18 (List.159, List.160, List.161): - let List.612 : U64 = 0i64; - let List.613 : U64 = CallByName List.6 List.159; - let List.611 : List U8 = CallByName List.91 List.159 List.160 List.161 List.612 List.613; - ret List.611; + let List.611 : U64 = 0i64; + let List.612 : U64 = CallByName List.6 List.159; + let List.610 : List U8 = CallByName List.91 List.159 List.160 List.161 List.611 List.612; + ret List.610; procedure List.26 (List.200, List.201, List.202): - let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.652 : U8 = 1i64; - let List.653 : U8 = GetTagId List.649; - let List.654 : Int1 = lowlevel Eq List.652 List.653; - if List.654 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.649; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.651 : U8 = 1i64; + let List.652 : U8 = GetTagId List.648; + let List.653 : Int1 = lowlevel Eq List.651 List.652; + if List.653 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.649; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648; ret List.204; procedure List.4 (List.123, List.124): - let List.598 : U64 = 1i64; - let List.597 : List U8 = CallByName List.70 List.123 List.598; - let List.596 : List U8 = CallByName List.71 List.597 List.124; - ret List.596; + let List.597 : U64 = 1i64; + let List.596 : List U8 = CallByName List.70 List.123 List.597; + let List.595 : List U8 = CallByName List.71 List.596 List.124; + ret List.595; procedure List.49 (List.419, List.420): - let List.640 : U64 = StructAtIndex 1 List.420; - let List.641 : U64 = StructAtIndex 0 List.420; - let List.639 : List U8 = CallByName List.72 List.419 List.640 List.641; - ret List.639; + let List.639 : U64 = StructAtIndex 1 List.420; + let List.640 : U64 = StructAtIndex 0 List.420; + let List.638 : List U8 = CallByName List.72 List.419 List.639 List.640; + ret List.638; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.647 List.437: - let List.645 : U64 = 0i64; - let List.644 : {U64, U64} = Struct {List.437, List.645}; + joinpoint List.646 List.437: + let List.644 : U64 = 0i64; + let List.643 : {U64, U64} = Struct {List.437, List.644}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.644; - let List.643 : U64 = CallByName Num.75 List.436 List.437; - let List.638 : {U64, U64} = Struct {List.643, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.638; - let List.637 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.637; + let List.438 : List U8 = CallByName List.49 List.434 List.643; + let List.642 : U64 = CallByName Num.75 List.436 List.437; + let List.637 : {U64, U64} = Struct {List.642, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.637; + let List.636 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.636; in - let List.648 : Int1 = CallByName Num.24 List.436 List.435; - if List.648 then - jump List.647 List.435; + let List.647 : Int1 = CallByName Num.24 List.436 List.435; + if List.647 then + jump List.646 List.435; else - jump List.647 List.436; + jump List.646 List.436; procedure List.6 (#Attr.2): - let List.623 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.623; + let List.622 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.622; procedure List.6 (#Attr.2): - let List.625 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.625; + let List.624 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.624; procedure List.66 (#Attr.2, #Attr.3): - let List.609 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.609; + let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.66 (#Attr.2, #Attr.3): - let List.621 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.621; + let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.620; procedure List.68 (#Attr.2): - let List.636 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.636; + let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.635; procedure List.70 (#Attr.2, #Attr.3): - let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.577; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.575; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.642 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.642; + let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.641; procedure List.8 (#Attr.2, #Attr.3): - let List.634 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.634; - -procedure List.80 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): - joinpoint List.658 List.490 List.491 List.492 List.493 List.494: - let List.660 : Int1 = CallByName Num.22 List.493 List.494; - if List.660 then - let List.669 : U8 = CallByName List.66 List.490 List.493; - let List.661 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.669; - let List.666 : U8 = 1i64; - let List.667 : U8 = GetTagId List.661; - let List.668 : Int1 = lowlevel Eq List.666 List.667; - if List.668 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.661; - let List.664 : U64 = 1i64; - let List.663 : U64 = CallByName Num.51 List.493 List.664; - jump List.658 List.490 List.495 List.492 List.663 List.494; + let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.633; + +procedure List.80 (#Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18, #Derived_gen.19): + joinpoint List.657 List.490 List.491 List.492 List.493 List.494: + let List.659 : Int1 = CallByName Num.22 List.493 List.494; + if List.659 then + let List.668 : U8 = CallByName List.66 List.490 List.493; + let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.668; + let List.665 : U8 = 1i64; + let List.666 : U8 = GetTagId List.660; + let List.667 : Int1 = lowlevel Eq List.665 List.666; + if List.667 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660; + let List.663 : U64 = 1i64; + let List.662 : U64 = CallByName Num.51 List.493 List.663; + jump List.657 List.490 List.495 List.492 List.662 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.661; - let List.665 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.665; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660; + let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.664; else dec List.490; - let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.659; + let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.658; in - jump List.658 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; - -procedure List.91 (#Derived_gen.13, #Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17): - joinpoint List.614 List.162 List.163 List.164 List.165 List.166: - let List.616 : Int1 = CallByName Num.22 List.165 List.166; - if List.616 then - let List.620 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.620; - let List.619 : U64 = 1i64; - let List.618 : U64 = CallByName Num.51 List.165 List.619; - jump List.614 List.162 List.167 List.164 List.618 List.166; + jump List.657 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18 #Derived_gen.19; + +procedure List.91 (#Derived_gen.10, #Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14): + joinpoint List.613 List.162 List.163 List.164 List.165 List.166: + let List.615 : Int1 = CallByName Num.22 List.165 List.166; + if List.615 then + let List.619 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.619; + let List.618 : U64 = 1i64; + let List.617 : U64 = CallByName Num.51 List.165 List.618; + jump List.613 List.162 List.167 List.164 List.617 List.166; else dec List.162; ret List.163; in - jump List.614 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17; - -procedure List.91 (#Derived_gen.18, #Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22): - joinpoint List.602 List.162 List.163 List.164 List.165 List.166: - let List.604 : Int1 = CallByName Num.22 List.165 List.166; - if List.604 then - let List.608 : Str = CallByName List.66 List.162 List.165; - inc List.608; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.608; - let List.607 : U64 = 1i64; - let List.606 : U64 = CallByName Num.51 List.165 List.607; - jump List.602 List.162 List.167 List.164 List.606 List.166; + jump List.613 #Derived_gen.10 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14; + +procedure List.91 (#Derived_gen.26, #Derived_gen.27, #Derived_gen.28, #Derived_gen.29, #Derived_gen.30): + joinpoint List.601 List.162 List.163 List.164 List.165 List.166: + let List.603 : Int1 = CallByName Num.22 List.165 List.166; + if List.603 then + let List.607 : Str = CallByName List.66 List.162 List.165; + inc List.607; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.607; + let List.606 : U64 = 1i64; + let List.605 : U64 = CallByName Num.51 List.165 List.606; + jump List.601 List.162 List.167 List.164 List.605 List.166; else dec List.162; ret List.163; in - jump List.602 #Derived_gen.18 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22; + jump List.601 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28 #Derived_gen.29 #Derived_gen.30; procedure Num.127 (#Attr.2): let Num.274 : U8 = lowlevel NumIntCast #Attr.2; @@ -231,30 +231,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.287; procedure Str.12 (#Attr.2): - let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.260; + let Str.241 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.241; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.34 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.34; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; 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 c921fe7aaab..48fce989640 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 @@ -44,158 +44,158 @@ procedure Encode.26 (Encode.105, Encode.106): ret Encode.108; procedure List.103 (List.487, List.488, List.489): - let List.656 : U64 = 0i64; - let List.657 : U64 = CallByName List.6 List.487; - let List.655 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.656 List.657; - ret List.655; + let List.655 : U64 = 0i64; + let List.656 : U64 = CallByName List.6 List.487; + let List.654 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.80 List.487 List.488 List.489 List.655 List.656; + ret List.654; procedure List.18 (List.159, List.160, List.161): - let List.600 : U64 = 0i64; - let List.601 : U64 = CallByName List.6 List.159; - let List.599 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.600 List.601; - ret List.599; + let List.599 : U64 = 0i64; + let List.600 : U64 = CallByName List.6 List.159; + let List.598 : {List U8, U64} = CallByName List.91 List.159 List.160 List.161 List.599 List.600; + ret List.598; procedure List.18 (List.159, List.160, List.161): - let List.612 : U64 = 0i64; - let List.613 : U64 = CallByName List.6 List.159; - let List.611 : List U8 = CallByName List.91 List.159 List.160 List.161 List.612 List.613; - ret List.611; + let List.611 : U64 = 0i64; + let List.612 : U64 = CallByName List.6 List.159; + let List.610 : List U8 = CallByName List.91 List.159 List.160 List.161 List.611 List.612; + ret List.610; procedure List.26 (List.200, List.201, List.202): - let List.649 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; - let List.652 : U8 = 1i64; - let List.653 : U8 = GetTagId List.649; - let List.654 : Int1 = lowlevel Eq List.652 List.653; - if List.654 then - let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.649; + let List.648 : [C {U64, Int1}, C {U64, Int1}] = CallByName List.103 List.200 List.201 List.202; + let List.651 : U8 = 1i64; + let List.652 : U8 = GetTagId List.648; + let List.653 : Int1 = lowlevel Eq List.651 List.652; + if List.653 then + let List.203 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.648; ret List.203; else - let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.649; + let List.204 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.648; ret List.204; procedure List.4 (List.123, List.124): - let List.598 : U64 = 1i64; - let List.597 : List U8 = CallByName List.70 List.123 List.598; - let List.596 : List U8 = CallByName List.71 List.597 List.124; - ret List.596; + let List.597 : U64 = 1i64; + let List.596 : List U8 = CallByName List.70 List.123 List.597; + let List.595 : List U8 = CallByName List.71 List.596 List.124; + ret List.595; procedure List.49 (List.419, List.420): - let List.640 : U64 = StructAtIndex 1 List.420; - let List.641 : U64 = StructAtIndex 0 List.420; - let List.639 : List U8 = CallByName List.72 List.419 List.640 List.641; - ret List.639; + let List.639 : U64 = StructAtIndex 1 List.420; + let List.640 : U64 = StructAtIndex 0 List.420; + let List.638 : List U8 = CallByName List.72 List.419 List.639 List.640; + ret List.638; procedure List.52 (List.434, List.435): let List.436 : U64 = CallByName List.6 List.434; - joinpoint List.647 List.437: - let List.645 : U64 = 0i64; - let List.644 : {U64, U64} = Struct {List.437, List.645}; + joinpoint List.646 List.437: + let List.644 : U64 = 0i64; + let List.643 : {U64, U64} = Struct {List.437, List.644}; inc List.434; - let List.438 : List U8 = CallByName List.49 List.434 List.644; - let List.643 : U64 = CallByName Num.75 List.436 List.437; - let List.638 : {U64, U64} = Struct {List.643, List.437}; - let List.439 : List U8 = CallByName List.49 List.434 List.638; - let List.637 : {List U8, List U8} = Struct {List.438, List.439}; - ret List.637; + let List.438 : List U8 = CallByName List.49 List.434 List.643; + let List.642 : U64 = CallByName Num.75 List.436 List.437; + let List.637 : {U64, U64} = Struct {List.642, List.437}; + let List.439 : List U8 = CallByName List.49 List.434 List.637; + let List.636 : {List U8, List U8} = Struct {List.438, List.439}; + ret List.636; in - let List.648 : Int1 = CallByName Num.24 List.436 List.435; - if List.648 then - jump List.647 List.435; + let List.647 : Int1 = CallByName Num.24 List.436 List.435; + if List.647 then + jump List.646 List.435; else - jump List.647 List.436; + jump List.646 List.436; procedure List.6 (#Attr.2): - let List.623 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.623; + let List.622 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.622; procedure List.6 (#Attr.2): - let List.625 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.625; + let List.624 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.624; procedure List.66 (#Attr.2, #Attr.3): - let List.609 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.609; + let List.608 : Str = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.608; procedure List.66 (#Attr.2, #Attr.3): - let List.621 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; - ret List.621; + let List.620 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; + ret List.620; procedure List.68 (#Attr.2): - let List.636 : List U8 = lowlevel ListWithCapacity #Attr.2; - ret List.636; + let List.635 : List U8 = lowlevel ListWithCapacity #Attr.2; + ret List.635; procedure List.70 (#Attr.2, #Attr.3): - let List.577 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; - ret List.577; + let List.576 : List U8 = lowlevel ListReserve #Attr.2 #Attr.3; + ret List.576; procedure List.71 (#Attr.2, #Attr.3): - let List.575 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; - ret List.575; + let List.574 : List U8 = lowlevel ListAppendUnsafe #Attr.2 #Attr.3; + ret List.574; procedure List.72 (#Attr.2, #Attr.3, #Attr.4): - let List.642 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; - ret List.642; + let List.641 : List U8 = lowlevel ListSublist #Attr.2 #Attr.3 #Attr.4; + ret List.641; procedure List.8 (#Attr.2, #Attr.3): - let List.634 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; - ret List.634; - -procedure List.80 (#Derived_gen.14, #Derived_gen.15, #Derived_gen.16, #Derived_gen.17, #Derived_gen.18): - joinpoint List.658 List.490 List.491 List.492 List.493 List.494: - let List.660 : Int1 = CallByName Num.22 List.493 List.494; - if List.660 then - let List.669 : U8 = CallByName List.66 List.490 List.493; - let List.661 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.669; - let List.666 : U8 = 1i64; - let List.667 : U8 = GetTagId List.661; - let List.668 : Int1 = lowlevel Eq List.666 List.667; - if List.668 then - let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.661; - let List.664 : U64 = 1i64; - let List.663 : U64 = CallByName Num.51 List.493 List.664; - jump List.658 List.490 List.495 List.492 List.663 List.494; + let List.633 : List U8 = lowlevel ListConcat #Attr.2 #Attr.3; + ret List.633; + +procedure List.80 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): + joinpoint List.657 List.490 List.491 List.492 List.493 List.494: + let List.659 : Int1 = CallByName Num.22 List.493 List.494; + if List.659 then + let List.668 : U8 = CallByName List.66 List.490 List.493; + let List.660 : [C {U64, Int1}, C {U64, Int1}] = CallByName TotallyNotJson.157 List.491 List.668; + let List.665 : U8 = 1i64; + let List.666 : U8 = GetTagId List.660; + let List.667 : Int1 = lowlevel Eq List.665 List.666; + if List.667 then + let List.495 : {U64, Int1} = UnionAtIndex (Id 1) (Index 0) List.660; + let List.663 : U64 = 1i64; + let List.662 : U64 = CallByName Num.51 List.493 List.663; + jump List.657 List.490 List.495 List.492 List.662 List.494; else dec List.490; - let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.661; - let List.665 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; - ret List.665; + let List.496 : {U64, Int1} = UnionAtIndex (Id 0) (Index 0) List.660; + let List.664 : [C {U64, Int1}, C {U64, Int1}] = TagId(0) List.496; + ret List.664; else dec List.490; - let List.659 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; - ret List.659; + let List.658 : [C {U64, Int1}, C {U64, Int1}] = TagId(1) List.491; + ret List.658; in - jump List.658 #Derived_gen.14 #Derived_gen.15 #Derived_gen.16 #Derived_gen.17 #Derived_gen.18; - -procedure List.91 (#Derived_gen.19, #Derived_gen.20, #Derived_gen.21, #Derived_gen.22, #Derived_gen.23): - joinpoint List.614 List.162 List.163 List.164 List.165 List.166: - let List.616 : Int1 = CallByName Num.22 List.165 List.166; - if List.616 then - let List.620 : U8 = CallByName List.66 List.162 List.165; - let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.620; - let List.619 : U64 = 1i64; - let List.618 : U64 = CallByName Num.51 List.165 List.619; - jump List.614 List.162 List.167 List.164 List.618 List.166; + jump List.657 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + +procedure List.91 (#Derived_gen.11, #Derived_gen.12, #Derived_gen.13, #Derived_gen.14, #Derived_gen.15): + joinpoint List.601 List.162 List.163 List.164 List.165 List.166: + let List.603 : Int1 = CallByName Num.22 List.165 List.166; + if List.603 then + let List.607 : Str = CallByName List.66 List.162 List.165; + inc List.607; + let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.607; + let List.606 : U64 = 1i64; + let List.605 : U64 = CallByName Num.51 List.165 List.606; + jump List.601 List.162 List.167 List.164 List.605 List.166; else dec List.162; ret List.163; in - jump List.614 #Derived_gen.19 #Derived_gen.20 #Derived_gen.21 #Derived_gen.22 #Derived_gen.23; + jump List.601 #Derived_gen.11 #Derived_gen.12 #Derived_gen.13 #Derived_gen.14 #Derived_gen.15; procedure List.91 (#Derived_gen.24, #Derived_gen.25, #Derived_gen.26, #Derived_gen.27, #Derived_gen.28): - joinpoint List.602 List.162 List.163 List.164 List.165 List.166: - let List.604 : Int1 = CallByName Num.22 List.165 List.166; - if List.604 then - let List.608 : Str = CallByName List.66 List.162 List.165; - inc List.608; - let List.167 : {List U8, U64} = CallByName TotallyNotJson.230 List.163 List.608; - let List.607 : U64 = 1i64; - let List.606 : U64 = CallByName Num.51 List.165 List.607; - jump List.602 List.162 List.167 List.164 List.606 List.166; + joinpoint List.613 List.162 List.163 List.164 List.165 List.166: + let List.615 : Int1 = CallByName Num.22 List.165 List.166; + if List.615 then + let List.619 : U8 = CallByName List.66 List.162 List.165; + let List.167 : List U8 = CallByName TotallyNotJson.183 List.163 List.619; + let List.618 : U64 = 1i64; + let List.617 : U64 = CallByName Num.51 List.165 List.618; + jump List.613 List.162 List.167 List.164 List.617 List.166; else dec List.162; ret List.163; in - jump List.602 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; + jump List.613 #Derived_gen.24 #Derived_gen.25 #Derived_gen.26 #Derived_gen.27 #Derived_gen.28; procedure Num.127 (#Attr.2): let Num.274 : U8 = lowlevel NumIntCast #Attr.2; @@ -234,30 +234,28 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.287; procedure Str.12 (#Attr.2): - let Str.260 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.260; + let Str.241 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.241; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.35 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.35; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure TotallyNotJson.150 (TotallyNotJson.151, TotallyNotJson.1014, TotallyNotJson.149): let TotallyNotJson.1017 : List U8 = CallByName TotallyNotJson.26 TotallyNotJson.149; diff --git a/crates/compiler/test_mono/generated/inspect_derived_dict.txt b/crates/compiler/test_mono/generated/inspect_derived_dict.txt index 7a5a529443d..d0a8f27493c 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_dict.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_dict.txt @@ -1171,12 +1171,12 @@ procedure Num.96 (#Attr.2): ret Num.424; procedure Str.12 (#Attr.2): - let Str.251 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.251; + let Str.234 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.234; procedure Str.3 (#Attr.2, #Attr.3): - let Str.252 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.252; + let Str.235 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.235; 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 8d3ef195ad5..96afa3ad8d7 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_list.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_list.txt @@ -167,8 +167,8 @@ procedure Num.96 (#Attr.2): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 0d92ec94fc4..8fd3ac3acdc 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 @@ -269,8 +269,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.269; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.233 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.233; 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 166bd1ffacf..33fdb0b09fd 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_record.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_record.txt @@ -197,8 +197,8 @@ procedure Num.96 (#Attr.2): ret Num.268; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 297337b44c7..4b24e7c7a2f 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 @@ -166,8 +166,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 55080253489..19855c1a95f 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 @@ -173,8 +173,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 a6a9be5e04f..608567f910f 100644 --- a/crates/compiler/test_mono/generated/inspect_derived_string.txt +++ b/crates/compiler/test_mono/generated/inspect_derived_string.txt @@ -38,8 +38,8 @@ procedure Inspect.60 (Inspect.298): ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 03f6666568a..931f8e9b0e2 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 @@ -168,8 +168,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 8a6ecbb65bd..2b957cdc8d1 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 @@ -171,8 +171,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 f85d0eb427f..d867bbd15fb 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 @@ -47,28 +47,28 @@ procedure Num.22 (#Attr.2, #Attr.3): let Num.267 : Int1 = lowlevel NumLt #Attr.2 #Attr.3; ret Num.267; -procedure Str.27 (Str.86): - let Str.249 : [C Int1, C I64] = CallByName Str.60 Str.86; - ret Str.249; +procedure Str.27 (Str.78): + let Str.232 : [C Int1, C I64] = CallByName Str.60 Str.78; + ret Str.232; procedure Str.42 (#Attr.2): - let Str.257 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.257; + let Str.240 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.240; -procedure Str.60 (Str.193): - let Str.194 : {I64, U8} = CallByName Str.42 Str.193; - dec Str.193; - let Str.255 : U8 = StructAtIndex 1 Str.194; - let Str.256 : U8 = 0i64; - let Str.252 : Int1 = CallByName Bool.11 Str.255 Str.256; - if Str.252 then - let Str.254 : I64 = StructAtIndex 0 Str.194; - let Str.253 : [C Int1, C I64] = TagId(1) Str.254; - ret Str.253; +procedure Str.60 (Str.185): + let Str.186 : {I64, U8} = CallByName Str.42 Str.185; + dec Str.185; + let Str.238 : U8 = StructAtIndex 1 Str.186; + let Str.239 : U8 = 0i64; + let Str.235 : Int1 = CallByName Bool.11 Str.238 Str.239; + if Str.235 then + let Str.237 : I64 = StructAtIndex 0 Str.186; + let Str.236 : [C Int1, C I64] = TagId(1) Str.237; + ret Str.236; else - let Str.251 : Int1 = false; - let Str.250 : [C Int1, C I64] = TagId(0) Str.251; - ret Str.250; + let Str.234 : Int1 = false; + let Str.233 : [C Int1, C I64] = TagId(0) Str.234; + ret Str.233; procedure Test.0 (): let Test.3 : Int1 = CallByName Bool.2; diff --git a/crates/compiler/test_mono/generated/issue_4749.txt b/crates/compiler/test_mono/generated/issue_4749.txt index 2aa85b731cf..89e99995fa8 100644 --- a/crates/compiler/test_mono/generated/issue_4749.txt +++ b/crates/compiler/test_mono/generated/issue_4749.txt @@ -129,8 +129,8 @@ procedure List.49 (List.419, List.420): ret List.621; procedure List.6 (#Attr.2): - let List.649 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.649; + let List.624 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.624; procedure List.66 (#Attr.2, #Attr.3): let List.610 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; @@ -218,27 +218,25 @@ procedure Num.77 (#Attr.2, #Attr.3): let Num.301 : U64 = lowlevel NumSubSaturated #Attr.2 #Attr.3; ret Num.301; -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.258 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.258; +procedure Str.43 (#Attr.2): + let Str.239 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.239; procedure Str.9 (Str.67): - let Str.256 : U64 = 0i64; - let Str.257 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.256 Str.257; - let Str.253 : Int1 = StructAtIndex 2 Str.68; - if Str.253 then - let Str.255 : Str = StructAtIndex 1 Str.68; - let Str.254 : [C {U64, U8}, C Str] = TagId(1) Str.255; - ret Str.254; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.236 : Int1 = StructAtIndex 2 Str.68; + if Str.236 then + let Str.238 : Str = StructAtIndex 1 Str.68; + let Str.237 : [C {U64, U8}, C Str] = TagId(1) Str.238; + ret Str.237; else - let Str.251 : U8 = StructAtIndex 3 Str.68; - let Str.252 : U64 = StructAtIndex 0 Str.68; + let Str.234 : U8 = StructAtIndex 3 Str.68; + let Str.235 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.6 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.6; - let Str.250 : {U64, U8} = Struct {Str.252, Str.251}; - let Str.249 : [C {U64, U8}, C Str] = TagId(0) Str.250; - ret Str.249; + let Str.233 : {U64, U8} = Struct {Str.235, Str.234}; + let Str.232 : [C {U64, U8}, C Str] = TagId(0) Str.233; + ret Str.232; procedure Test.3 (): let Test.0 : List U8 = Array [82i64, 111i64, 99i64]; 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 8f8e38d68aa..8861a277bbc 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 @@ -103,8 +103,8 @@ procedure List.49 (List.419, List.420): ret List.617; procedure List.6 (#Attr.2): - let List.645 : U64 = lowlevel ListLenU64 #Attr.2; - ret List.645; + let List.620 : U64 = lowlevel ListLenU64 #Attr.2; + ret List.620; procedure List.66 (#Attr.2, #Attr.3): let List.606 : U8 = lowlevel ListGetUnsafe #Attr.2 #Attr.3; @@ -193,53 +193,51 @@ procedure Num.77 (#Attr.2, #Attr.3): ret Num.301; procedure Str.12 (#Attr.2): - let Str.258 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.258; + let Str.241 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.241; -procedure Str.27 (Str.86): - let Str.249 : [C {}, C I64] = CallByName Str.60 Str.86; - ret Str.249; +procedure Str.27 (Str.78): + let Str.232 : [C {}, C I64] = CallByName Str.60 Str.78; + ret Str.232; procedure Str.42 (#Attr.2): - let Str.257 : {I64, U8} = lowlevel StrToNum #Attr.2; - ret Str.257; - -procedure Str.43 (#Attr.2, #Attr.3, #Attr.4): - let Str.268 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8Range #Attr.2 #Attr.3 #Attr.4; - ret Str.268; - -procedure Str.60 (Str.193): - let Str.194 : {I64, U8} = CallByName Str.42 Str.193; - dec Str.193; - let Str.255 : U8 = StructAtIndex 1 Str.194; - let Str.256 : U8 = 0i64; - let Str.252 : Int1 = CallByName Bool.11 Str.255 Str.256; - if Str.252 then - let Str.254 : I64 = StructAtIndex 0 Str.194; - let Str.253 : [C {}, C I64] = TagId(1) Str.254; - ret Str.253; + let Str.240 : {I64, U8} = lowlevel StrToNum #Attr.2; + ret Str.240; + +procedure Str.43 (#Attr.2): + let Str.249 : {U64, Str, Int1, U8} = lowlevel StrFromUtf8 #Attr.2; + ret Str.249; + +procedure Str.60 (Str.185): + let Str.186 : {I64, U8} = CallByName Str.42 Str.185; + dec Str.185; + let Str.238 : U8 = StructAtIndex 1 Str.186; + let Str.239 : U8 = 0i64; + let Str.235 : Int1 = CallByName Bool.11 Str.238 Str.239; + if Str.235 then + let Str.237 : I64 = StructAtIndex 0 Str.186; + let Str.236 : [C {}, C I64] = TagId(1) Str.237; + ret Str.236; else - let Str.251 : {} = Struct {}; - let Str.250 : [C {}, C I64] = TagId(0) Str.251; - ret Str.250; + let Str.234 : {} = Struct {}; + let Str.233 : [C {}, C I64] = TagId(0) Str.234; + ret Str.233; procedure Str.9 (Str.67): - let Str.266 : U64 = 0i64; - let Str.267 : U64 = CallByName List.6 Str.67; - let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67 Str.266 Str.267; - let Str.263 : Int1 = StructAtIndex 2 Str.68; - if Str.263 then - let Str.265 : Str = StructAtIndex 1 Str.68; - let Str.264 : [C {U64, U8}, C Str] = TagId(1) Str.265; - ret Str.264; + let Str.68 : {U64, Str, Int1, U8} = CallByName Str.43 Str.67; + let Str.246 : Int1 = StructAtIndex 2 Str.68; + if Str.246 then + let Str.248 : Str = StructAtIndex 1 Str.68; + let Str.247 : [C {U64, U8}, C Str] = TagId(1) Str.248; + ret Str.247; else - let Str.261 : U8 = StructAtIndex 3 Str.68; - let Str.262 : U64 = StructAtIndex 0 Str.68; + let Str.244 : U8 = StructAtIndex 3 Str.68; + let Str.245 : U64 = StructAtIndex 0 Str.68; let #Derived_gen.7 : Str = StructAtIndex 1 Str.68; dec #Derived_gen.7; - let Str.260 : {U64, U8} = Struct {Str.262, Str.261}; - let Str.259 : [C {U64, U8}, C Str] = TagId(0) Str.260; - ret Str.259; + let Str.243 : {U64, U8} = Struct {Str.245, Str.244}; + let Str.242 : [C {U64, U8}, C Str] = TagId(0) Str.243; + ret Str.242; procedure Test.0 (): let Test.37 : Str = "-1234"; diff --git a/crates/compiler/test_mono/generated/issue_6196.txt b/crates/compiler/test_mono/generated/issue_6196.txt index 67c0c631b3b..33e125cc5de 100644 --- a/crates/compiler/test_mono/generated/issue_6196.txt +++ b/crates/compiler/test_mono/generated/issue_6196.txt @@ -24,7 +24,7 @@ procedure Test.1 (#Derived_gen.0, #Derived_gen.1): else let Test.23 : List Str = StructAtIndex 0 Test.13; let Test.24 : U64 = 1i64; - let Test.25 : U64 = lowlevel ListLenUsize Test.23; + let Test.25 : U64 = lowlevel ListLenU64 Test.23; let Test.26 : U64 = lowlevel NumSub Test.25 Test.24; let Test.27 : U64 = 1i64; let Test.8 : List Str = lowlevel ListSublist Test.23 Test.27 Test.26; 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 efb2ea43247..c95a0adc440 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.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 ba0cc7bab0e..488f9514e3a 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_borrows.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_borrows.txt @@ -31,12 +31,12 @@ procedure Num.22 (#Attr.2, #Attr.3): ret Num.267; procedure Str.16 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrRepeat #Attr.2 #Attr.3; + ret Str.232; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.233 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.233; 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 70b7e684006..41ad6711e5a 100644 --- a/crates/compiler/test_mono/generated/list_map_closure_owns.txt +++ b/crates/compiler/test_mono/generated/list_map_closure_owns.txt @@ -31,8 +31,8 @@ procedure Num.22 (#Attr.2, #Attr.3): ret Num.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.233 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.233; procedure Test.1 (): let Test.21 : Str = "lllllllllllllllllllllooooooooooong"; diff --git a/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt b/crates/compiler/test_mono/generated/polymorphic_expression_unification.txt index 56ea2423ae3..1e74803e858 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.250 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.250; + let Str.233 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.233; 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 dd7ef0e03be..7bdeb97ad89 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.267; procedure Str.3 (#Attr.2, #Attr.3): - let Str.251 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.251; + let Str.234 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.234; 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/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 58c15be82cf..5a72b263e94 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 @@ -220,8 +220,8 @@ procedure Num.75 (#Attr.2, #Attr.3): ret Num.287; procedure Str.12 (#Attr.2): - let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.250; + let Str.233 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.233; procedure Test.2 (Test.10): let Test.15 : {Str, Str} = CallByName Encode.23 Test.10; 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 73397f8f285..465fa426785 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 @@ -178,8 +178,8 @@ procedure Num.51 (#Attr.2, #Attr.3): ret Num.289; procedure Str.12 (#Attr.2): - let Str.250 : List U8 = lowlevel StrToUtf8 #Attr.2; - ret Str.250; + let Str.233 : List U8 = lowlevel StrToUtf8 #Attr.2; + ret Str.233; procedure Test.2 (Test.11): let Test.18 : {{}, {}} = CallByName Encode.23 Test.11; 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 67e1dcc1c82..0f4fc5de7a2 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.60 (Inspect.298): ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; 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 212898ee56c..6f9474cc635 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.60 (Inspect.298): ret Inspect.298; procedure Str.3 (#Attr.2, #Attr.3): - let Str.249 : Str = lowlevel StrConcat #Attr.2 #Attr.3; - ret Str.249; + let Str.232 : Str = lowlevel StrConcat #Attr.2 #Attr.3; + ret Str.232; procedure Test.2 (Test.3): let Test.4 : Str = CallByName Inspect.33 Test.3;