refactor PatternAs

This commit is contained in:
Folkert 2022-12-30 18:22:10 +01:00
parent e9196f3c0b
commit aff70bb6bd
No known key found for this signature in database
GPG key ID: 1F17F6FFD112B97C
6 changed files with 94 additions and 52 deletions

View file

@ -689,7 +689,7 @@ pub fn canonicalize_pattern<'a>(
for (i, loc_pattern) in patterns.iter().enumerate() {
match &loc_pattern.value {
ListRest => match rest_index {
ListRest(_opt_pattern_as) => match rest_index {
None => {
rest_index = Some(i);
}
@ -731,14 +731,14 @@ pub fn canonicalize_pattern<'a>(
},
})
}
ListRest => {
ListRest(_opt_pattern_as) => {
// Parsing should make sure these only appear in list patterns, where we will generate
// better contextual errors.
let problem = MalformedPatternProblem::Unknown;
malformed_pattern(env, problem, region)
}
As(_pattern, _spaces, _identifier) => {
As(_pattern, _pattern_as) => {
todo!();
}