mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-26 13:29:12 +00:00
fix parsing lists in tag patterns
This commit is contained in:
parent
4cf256c6b7
commit
6844df6c37
4 changed files with 59 additions and 0 deletions
|
@ -205,6 +205,7 @@ fn loc_parse_tag_pattern_arg<'a>() -> impl Parser<'a, Loc<Pattern<'a>>, EPattern
|
||||||
crate::pattern::record_pattern_help()
|
crate::pattern::record_pattern_help()
|
||||||
)),
|
)),
|
||||||
loc!(string_like_pattern_help()),
|
loc!(string_like_pattern_help()),
|
||||||
|
loc!(specialize_err(EPattern::List, list_pattern_help())),
|
||||||
loc!(number_pattern_help())
|
loc!(number_pattern_help())
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,54 @@
|
||||||
|
When(
|
||||||
|
@5-10 Apply(
|
||||||
|
@5-7 Tag(
|
||||||
|
"Ok",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@8-10 List(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
Space,
|
||||||
|
),
|
||||||
|
[
|
||||||
|
WhenBranch {
|
||||||
|
patterns: [
|
||||||
|
@18-23 SpaceBefore(
|
||||||
|
Apply(
|
||||||
|
@18-20 Tag(
|
||||||
|
"Ok",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
@21-23 List(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
value: @27-29 Record(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
guard: None,
|
||||||
|
},
|
||||||
|
WhenBranch {
|
||||||
|
patterns: [
|
||||||
|
@34-35 SpaceBefore(
|
||||||
|
Underscore(
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
[
|
||||||
|
Newline,
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
value: @39-41 Record(
|
||||||
|
[],
|
||||||
|
),
|
||||||
|
guard: None,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
)
|
|
@ -0,0 +1,3 @@
|
||||||
|
when Ok [] is
|
||||||
|
Ok [] -> {}
|
||||||
|
_ -> {}
|
|
@ -482,6 +482,7 @@ mod test_snapshots {
|
||||||
pass/when_in_function_python_style_indent.expr,
|
pass/when_in_function_python_style_indent.expr,
|
||||||
pass/when_in_parens.expr,
|
pass/when_in_parens.expr,
|
||||||
pass/when_in_parens_indented.expr,
|
pass/when_in_parens_indented.expr,
|
||||||
|
pass/when_result_list.expr,
|
||||||
pass/when_with_alternative_patterns.expr,
|
pass/when_with_alternative_patterns.expr,
|
||||||
pass/when_with_function_application.expr,
|
pass/when_with_function_application.expr,
|
||||||
pass/when_with_negative_numbers.expr,
|
pass/when_with_negative_numbers.expr,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue