mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 22:34:45 +00:00
Fix some usize -> u64 in List patterns
This commit is contained in:
parent
b2ce7e5fcf
commit
e8a0b0930d
3 changed files with 17 additions and 30 deletions
|
@ -1397,15 +1397,12 @@ pub(crate) fn build_list_index_probe<'a>(
|
|||
list_sym: Symbol,
|
||||
list_index: &ListIndex,
|
||||
) -> (Symbol, impl DoubleEndedIterator<Item = Store<'a>>) {
|
||||
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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue