mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 11:52:19 +00:00
Simplify arity and branching calculation
This commit is contained in:
parent
0706615d29
commit
27b9dd8253
3 changed files with 46 additions and 81 deletions
|
@ -796,18 +796,7 @@ fn to_relevant_branch_help<'a>(
|
|||
elements,
|
||||
element_layout: _,
|
||||
} => match test {
|
||||
IsListLen { bound, len }
|
||||
if (match (bound, my_arity) {
|
||||
(ListLenBound::Exact, ListArity::Exact(my_len)) => my_len == *len as _,
|
||||
(ListLenBound::Exact, ListArity::Slice(my_head, my_tail)) => {
|
||||
my_head + my_tail <= *len as _
|
||||
}
|
||||
(ListLenBound::AtLeast, ListArity::Exact(my_len)) => my_len == *len as _,
|
||||
(ListLenBound::AtLeast, ListArity::Slice(my_head, my_tail)) => {
|
||||
my_head + my_tail <= *len as _
|
||||
}
|
||||
}) =>
|
||||
{
|
||||
IsListLen { bound: _, len } if my_arity.covers_length(*len as _) => {
|
||||
let sub_positions = elements.into_iter().enumerate().map(|(index, elem_pat)| {
|
||||
let mut new_path = path.to_vec();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue