mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 04:08:19 +00:00
Implement ? binop operator
This commit is contained in:
parent
9d37c906fe
commit
b73e4387ae
12 changed files with 291 additions and 55 deletions
|
@ -0,0 +1,3 @@
|
|||
fallible!(args)
|
||||
? \my_err ->
|
||||
my_err * 2
|
|
@ -0,0 +1,50 @@
|
|||
@0-43 SpaceAfter(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@0-15 PncApply(
|
||||
@0-9 Var {
|
||||
module_name: "",
|
||||
ident: "fallible!",
|
||||
},
|
||||
[
|
||||
@10-14 Var {
|
||||
module_name: "",
|
||||
ident: "args",
|
||||
},
|
||||
],
|
||||
),
|
||||
@18-19 SingleQuestion,
|
||||
),
|
||||
],
|
||||
@20-43 Closure(
|
||||
[
|
||||
@21-27 Identifier {
|
||||
ident: "my_err",
|
||||
},
|
||||
],
|
||||
@33-43 SpaceBefore(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@33-39 Var {
|
||||
module_name: "",
|
||||
ident: "my_err",
|
||||
},
|
||||
@40-41 Star,
|
||||
),
|
||||
],
|
||||
@42-43 Num(
|
||||
"2",
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
fallible!(args) ? |my_err|
|
||||
my_err * 2
|
|
@ -0,0 +1 @@
|
|||
fallible!(args) ? WrapOverErr
|
|
@ -0,0 +1,27 @@
|
|||
@0-31 SpaceAfter(
|
||||
BinOps(
|
||||
[
|
||||
(
|
||||
@0-15 PncApply(
|
||||
@0-9 Var {
|
||||
module_name: "",
|
||||
ident: "fallible!",
|
||||
},
|
||||
[
|
||||
@10-14 Var {
|
||||
module_name: "",
|
||||
ident: "args",
|
||||
},
|
||||
],
|
||||
),
|
||||
@18-19 SingleQuestion,
|
||||
),
|
||||
],
|
||||
@20-31 Tag(
|
||||
"WrapOverErr",
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
fallible!(args) ? WrapOverErr
|
|
@ -693,6 +693,8 @@ mod test_snapshots {
|
|||
pass/single_arg_closure.expr,
|
||||
pass/single_arg_with_underscore_closure.expr,
|
||||
pass/single_underscore_closure.expr,
|
||||
pass/single_question_binop_closure.expr,
|
||||
pass/single_question_binop_tag.expr,
|
||||
pass/sneaky_implements_in_opaque_fn_type.expr,
|
||||
pass/space_after_opt_field_pat.expr,
|
||||
pass/space_before_colon.full,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue