mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
Canonicalization of list patterns
This commit is contained in:
parent
55ea3bbea2
commit
b0a8b85de3
13 changed files with 189 additions and 4 deletions
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
def::Def,
|
||||
expr::{AccessorData, ClosureData, Expr, Field, OpaqueWrapFunctionData, WhenBranchPattern},
|
||||
pattern::{DestructType, Pattern, RecordDestruct},
|
||||
pattern::{DestructType, ListPatterns, Pattern, RecordDestruct},
|
||||
};
|
||||
use roc_module::{
|
||||
ident::{Lowercase, TagName},
|
||||
|
@ -707,6 +707,18 @@ fn deep_copy_pattern_help<C: CopyEnv>(
|
|||
})
|
||||
.collect(),
|
||||
},
|
||||
List {
|
||||
list_var,
|
||||
elem_var,
|
||||
patterns: ListPatterns { patterns, opt_rest },
|
||||
} => List {
|
||||
list_var: sub!(*list_var),
|
||||
elem_var: sub!(*elem_var),
|
||||
patterns: ListPatterns {
|
||||
patterns: patterns.iter().map(|lp| lp.map(|p| go_help!(p))).collect(),
|
||||
opt_rest: *opt_rest,
|
||||
},
|
||||
},
|
||||
NumLiteral(var, s, n, bound) => NumLiteral(sub!(*var), s.clone(), *n, *bound),
|
||||
IntLiteral(v1, v2, s, n, bound) => IntLiteral(sub!(*v1), sub!(*v2), s.clone(), *n, *bound),
|
||||
FloatLiteral(v1, v2, s, n, bound) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue