mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 03:42:17 +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
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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