mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Parenthesize closures in unary ops and pre-emptively disallow multi-backpassing in such closures, to avoid formatter trouble later
This commit is contained in:
parent
14b18f4213
commit
37e7caa1aa
12 changed files with 77 additions and 53 deletions
|
@ -0,0 +1 @@
|
|||
Expr(Pattern(NotAPattern(@10), @10), @0)
|
|
@ -0,0 +1,3 @@
|
|||
! !(
|
||||
\w -> 2)
|
||||
n
|
|
@ -0,0 +1,40 @@
|
|||
@0-12 SpaceAfter(
|
||||
Apply(
|
||||
@0-9 UnaryOp(
|
||||
@1-9 UnaryOp(
|
||||
@4-9 SpaceBefore(
|
||||
Closure(
|
||||
[
|
||||
@5-6 Identifier {
|
||||
ident: "w",
|
||||
},
|
||||
],
|
||||
@8-9 Num(
|
||||
"2",
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@1-2 Not,
|
||||
),
|
||||
@0-1 Not,
|
||||
),
|
||||
[
|
||||
@11-12 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "n",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
!!
|
||||
\w->2
|
||||
n
|
|
@ -1,3 +1,3 @@
|
|||
m
|
||||
^ (-\w -> m)
|
||||
^ (-(\w -> m))
|
||||
w
|
|
@ -1,6 +1,6 @@
|
|||
[
|
||||
[
|
||||
!(!\L -> t)
|
||||
!(!(\L -> t))
|
||||
M,
|
||||
],
|
||||
]
|
|
@ -1,3 +0,0 @@
|
|||
!\t ->
|
||||
m, i <- 0
|
||||
s
|
|
@ -1,42 +0,0 @@
|
|||
@0-16 SpaceAfter(
|
||||
UnaryOp(
|
||||
@1-16 Closure(
|
||||
[
|
||||
@2-3 Identifier {
|
||||
ident: "t",
|
||||
},
|
||||
],
|
||||
@7-16 SpaceBefore(
|
||||
Backpassing(
|
||||
[
|
||||
@7-8 Identifier {
|
||||
ident: "m",
|
||||
},
|
||||
@9-10 Identifier {
|
||||
ident: "i",
|
||||
},
|
||||
],
|
||||
@12-13 Num(
|
||||
"0",
|
||||
),
|
||||
@15-16 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "s",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
@0-1 Not,
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -232,6 +232,7 @@ mod test_snapshots {
|
|||
fail/nested_tuples_annotation_terrible_perf.expr,
|
||||
fail/nested_when_expect_binop_when.expr,
|
||||
fail/newline_before_operator_with_defs.expr,
|
||||
fail/not_closure_with_multibackpassing.expr,
|
||||
fail/oom_repro.expr,
|
||||
fail/opaque_type_def_with_newline.expr,
|
||||
fail/pattern_binds_keyword.expr,
|
||||
|
@ -318,6 +319,7 @@ mod test_snapshots {
|
|||
pass/annotation_tuple_parens_newlines.expr,
|
||||
pass/annotation_tuples_ext_galore.expr,
|
||||
pass/applies_in_binop.expr,
|
||||
pass/apply_bang_bang_closure.expr,
|
||||
pass/apply_binop_switch.expr,
|
||||
pass/apply_closure_pizza.expr,
|
||||
pass/apply_parenthetical_tag_args.expr,
|
||||
|
@ -570,7 +572,6 @@ mod test_snapshots {
|
|||
pass/nonempty_hosted_header.header,
|
||||
pass/nonempty_package_header.header,
|
||||
pass/nonempty_platform_header.header,
|
||||
pass/not_closure_with_multibackpassing.expr,
|
||||
pass/not_double_parens.expr,
|
||||
pass/not_multiline_string.expr,
|
||||
pass/not_record_updater.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue