mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-28 06:14:46 +00:00
add tests for List.dropAt
This commit is contained in:
parent
3baff93a97
commit
700ab20a8c
3 changed files with 29 additions and 8 deletions
|
@ -833,8 +833,6 @@ pub fn listDrop(
|
|||
}
|
||||
}
|
||||
|
||||
// GIESCH add type inference test
|
||||
// GIESCH add unit tests
|
||||
// GIESCH do a uniqueness check, and reuse the same array if possible
|
||||
// GIESCH figure out where to specify uniqueness of output, update builtins readme
|
||||
pub fn listDropAt(
|
||||
|
@ -848,7 +846,8 @@ pub fn listDropAt(
|
|||
const size = list.len();
|
||||
|
||||
if (drop_index >= size) {
|
||||
return RocList.empty();
|
||||
// GIESCH should this still copy/reallocate if non-unique?
|
||||
return list;
|
||||
}
|
||||
|
||||
if (drop_index < size) {
|
||||
|
@ -856,11 +855,6 @@ pub fn listDropAt(
|
|||
dec(element);
|
||||
}
|
||||
|
||||
// GIESCH is this necessary?
|
||||
if (size < 2 and drop_index == 0) {
|
||||
return RocList.empty();
|
||||
}
|
||||
|
||||
const output = RocList.allocate(alignment, (size - 1), element_width);
|
||||
const target_ptr = output.bytes orelse unreachable;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue