mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Fix some empty list edge cases
This commit is contained in:
parent
5cec577427
commit
0550af17d2
3 changed files with 113 additions and 81 deletions
|
@ -386,6 +386,13 @@ pub fn build_expr<'a, 'ctx, 'env>(
|
|||
BasicValueEnum::PointerValue(ptr)
|
||||
}
|
||||
}
|
||||
EmptyArray => {
|
||||
let struct_type = collection(env.context, env.ptr_bytes);
|
||||
|
||||
// The pointer should be null (aka zero) and the length should be zero,
|
||||
// so the whole struct should be a const_zero
|
||||
BasicValueEnum::StructValue(struct_type.const_zero())
|
||||
}
|
||||
Array { elem_layout, elems } => {
|
||||
let ctx = env.context;
|
||||
let elem_type = basic_type_from_layout(env.arena, ctx, elem_layout, env.ptr_bytes);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue