Parenthesize closures in unary ops and pre-emptively disallow multi-backpassing in such closures, to avoid formatter trouble later

This commit is contained in:
Joshua Warner 2025-01-01 12:22:09 -05:00
parent 14b18f4213
commit 37e7caa1aa
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
12 changed files with 77 additions and 53 deletions

View file

@ -0,0 +1 @@
Expr(Pattern(NotAPattern(@10), @10), @0)

View file

@ -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,
],
)

View file

@ -1,6 +1,6 @@
[
[
!(!\L -> t)
!(!(\L -> t))
M,
],
]

View file

@ -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,
],
)

View file

@ -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,