mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Fix List.first types
This commit is contained in:
parent
b3dfbeeec8
commit
0f36255f83
8 changed files with 90 additions and 62 deletions
|
@ -1290,18 +1290,6 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
|
||||
BasicValueEnum::IntValue(load_list_len(env.builder, arg.into_struct_value()))
|
||||
}
|
||||
ListIsEmpty => {
|
||||
debug_assert_eq!(args.len(), 1);
|
||||
|
||||
let arg = build_expr(env, layout_ids, scope, parent, &args[0].0);
|
||||
let list_struct = arg.into_struct_value();
|
||||
let builder = env.builder;
|
||||
let list_len = load_list_len(builder, list_struct);
|
||||
let zero = env.ptr_int().const_zero();
|
||||
let answer = builder.build_int_compare(IntPredicate::EQ, list_len, zero, "is_zero");
|
||||
|
||||
BasicValueEnum::IntValue(answer)
|
||||
}
|
||||
ListSingle => {
|
||||
// List.single : a -> List a
|
||||
debug_assert_eq!(args.len(), 1);
|
||||
|
@ -1528,7 +1516,10 @@ fn run_low_level<'a, 'ctx, 'env>(
|
|||
builder.build_load(elem_ptr, "List.get")
|
||||
}
|
||||
_ => {
|
||||
unreachable!("Invalid List layout for List.get: {:?}", list_layout);
|
||||
unreachable!(
|
||||
"Invalid List layout for ListGetUnsafe operation: {:?}",
|
||||
list_layout
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue