Reproduce missing support for when after operator

This commit is contained in:
Richard Feldman 2022-07-24 18:20:24 -04:00
parent 0d2141d8b8
commit bbf867c1d1
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
3 changed files with 59 additions and 0 deletions

View file

@ -0,0 +1,54 @@
BinOps(
[
(
@0-1 Num(
"1",
),
@2-3 Plus,
),
],
@8-53 SpaceBefore(
When(
@13-16 Tag(
"Foo",
),
[
WhenBranch {
patterns: [
@28-31 SpaceBefore(
Tag(
"Foo",
),
[
Newline,
],
),
],
value: @35-36 Num(
"2",
),
guard: None,
},
WhenBranch {
patterns: [
@45-48 SpaceBefore(
Tag(
"Bar",
),
[
Newline,
],
),
],
value: @52-53 Num(
"3",
),
guard: None,
},
],
),
[
Newline,
],
),
)

View file

@ -0,0 +1,4 @@
1 +
when Foo is
Foo -> 2
Bar -> 3

View file

@ -229,6 +229,7 @@ mod test_parse {
pass/parse_as_ann.expr,
pass/pattern_with_space_in_parens.expr, // https://github.com/rtfeldman/roc/issues/929
pass/plus_if.expr,
pass/plus_when.expr,
pass/pos_inf_float.expr,
pass/positive_float.expr,
pass/positive_int.expr,