fix wrong alignment used to (re)allocate a list

This commit is contained in:
Folkert 2023-09-15 00:46:26 +02:00
parent 5d6523f994
commit edefbe5b6b
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
3 changed files with 21 additions and 2 deletions

View file

@ -2975,7 +2975,7 @@ impl<
let list_b_layout = arg_layouts[1];
// Load list alignment argument (u32).
self.load_layout_alignment(*ret_layout, Symbol::DEV_TMP);
self.load_layout_alignment(elem_layout, Symbol::DEV_TMP);
// Load element_width argument (usize).
self.load_layout_stack_size(elem_layout, Symbol::DEV_TMP2);

View file

@ -95,6 +95,22 @@ fn dec_list_literal() {
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn dec_list_join() {
assert_evals_to!(
"List.concat [1.0dec, 2.0] [3.0, 4.0, 5.0]",
RocList::from_slice(&[
RocDec::from(1),
RocDec::from(2),
RocDec::from(3),
RocDec::from(4),
RocDec::from(5),
]),
RocList<RocDec>
);
}
#[test]
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm", feature = "gen-dev"))]
fn bool_list_concat() {

View file

@ -455,7 +455,7 @@ where
T: PartialEq<U>,
{
fn eq(&self, other: &RocList<U>) -> bool {
self.deref() == other.deref()
self.as_slice() == other.as_slice()
}
}
@ -812,5 +812,8 @@ mod tests {
let b = a.clone();
assert_eq!(a, b);
drop(a);
drop(b);
}
}