Fix CI failure

This commit is contained in:
Richard Feldman 2025-12-03 22:53:39 -05:00
parent 15c3dda28b
commit fd22eff4ee
No known key found for this signature in database
2 changed files with 26 additions and 24 deletions

View file

@ -331,15 +331,15 @@ Builtin :: [].{
from_numeral : Numeral -> Try(U8, [InvalidNumeral(Str), ..others])
from_str : Str -> Try(U8, [BadNumStr, ..others])
## List of integers beginning with this `U8` and ending with the other `U8`.
## (Use [until] instead to end with the other `U8` minus one.)
## Returns an empty list if this `U8` is greater than the other.
# # List of integers beginning with this `U8` and ending with the other `U8`.
# # (Use [until] instead to end with the other `U8` minus one.)
# # Returns an empty list if this `U8` is greater than the other.
to : U8, U8 -> List(U8)
to = |start, end| range_to(start, end)
## List of integers beginning with this `U8` and ending with the other `U8` minus one.
## (Use [to] instead to end with the other `U8` exactly, instead of minus one.)
## Returns an empty list if this `U8` is greater than or equal to the other.
# # List of integers beginning with this `U8` and ending with the other `U8` minus one.
# # (Use [to] instead to end with the other `U8` exactly, instead of minus one.)
# # Returns an empty list if this `U8` is greater than or equal to the other.
until : U8, U8 -> List(U8)
until = |start, end| range_until(start, end)
@ -990,25 +990,25 @@ Builtin :: [].{
}
range_to = |var $current, end| {
var $answer = [] # Not bothering with List.with_capacity because this will become an iterator once those exist.
var $answer = [] # Not bothering with List.with_capacity because this will become an iterator once those exist.
while $current <= end {
$answer = $answer.append($current)
$current = $current + 1
}
while $current <= end {
$answer = $answer.append($current)
$current = $current + 1
}
$answer
$answer
}
range_until = |var $current, end| {
var $answer = [] # Not bothering with List.with_capacity because this will become an iterator once those exist.
var $answer = [] # Not bothering with List.with_capacity because this will become an iterator once those exist.
while $current < end {
$answer = $answer.append($current)
$current = $current + 1
}
while $current < end {
$answer = $answer.append($current)
$current = $current + 1
}
$answer
$answer
}
# Implemented by the compiler, does not perform bounds checks

View file

@ -1481,13 +1481,15 @@ pub const Interpreter = struct {
// Get the result layout - should be List(U8).
// If return_rt_var is a flex that would default to a scalar,
// we need to ensure we get a proper list layout for correct refcounting.
const result_rt_var = return_rt_var orelse {
self.triggerCrash("str_to_utf8 requires return type info", false, roc_ops);
return error.Crash;
};
const result_layout = blk: {
if (return_rt_var) |rt_var| {
const maybe_layout = try self.getRuntimeLayout(rt_var);
// If the layout is a list, use it
if (maybe_layout.tag == .list or maybe_layout.tag == .list_of_zst) {
break :blk maybe_layout;
}
const maybe_layout = try self.getRuntimeLayout(result_rt_var);
// If the layout is a list, use it
if (maybe_layout.tag == .list or maybe_layout.tag == .list_of_zst) {
break :blk maybe_layout;
}
// Fallback: create a proper List(U8) layout
const u8_layout_idx = try self.runtime_layout_store.insertLayout(Layout.int(.u8));