Merge pull request #7050 from roc-lang/arg-patterns-as

This commit is contained in:
Agus Zubiaga 2024-09-02 14:02:17 -03:00 committed by GitHub
commit 2469a3aa2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 179 additions and 1 deletions

View file

@ -0,0 +1,2 @@
\({ x, y } as point), (@Location inner as outer) ->
crash ""

View file

@ -0,0 +1,57 @@
SpaceAfter(
Closure(
[
@2-19 As(
@2-10 RecordDestructure(
[
@4-5 Identifier {
ident: "x",
},
@7-8 Identifier {
ident: "y",
},
],
),
PatternAs {
spaces_before: [],
identifier: @14-19 "point",
},
),
@23-47 As(
@23-38 Apply(
@23-32 OpaqueRef(
"@Location",
),
[
@33-38 Identifier {
ident: "inner",
},
],
),
PatternAs {
spaces_before: [],
identifier: @42-47 "outer",
},
),
],
@56-64 SpaceBefore(
Apply(
@56-61 Crash,
[
@62-64 Str(
PlainLine(
"",
),
),
],
Space,
),
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
\({ x, y } as point), (@Location inner as outer) ->
crash ""

View file

@ -281,6 +281,7 @@ mod test_snapshots {
pass/apply_two_args.expr,
pass/apply_unary_negation.expr,
pass/apply_unary_not.expr,
pass/arg_pattern_as.expr,
pass/basic_apply.expr,
pass/basic_docs.expr,
pass/basic_field.expr,