diff --git a/crates/compiler/fmt/src/expr.rs b/crates/compiler/fmt/src/expr.rs index b9f354cab9..8d0e6875b8 100644 --- a/crates/compiler/fmt/src/expr.rs +++ b/crates/compiler/fmt/src/expr.rs @@ -291,7 +291,7 @@ fn format_expr_only( let inner_parens = if needs_parens { Parens::NotNeeded } else { - Parens::InApply + Parens::InApplyLastArg }; if !before_all_newlines { diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.formatted.roc b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.formatted.roc new file mode 100644 index 0000000000..91c0d95b9e --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.formatted.roc @@ -0,0 +1,3 @@ +!\t -> + m, i <- 0 + s \ No newline at end of file diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.result-ast b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.result-ast new file mode 100644 index 0000000000..173ead48e1 --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.result-ast @@ -0,0 +1,42 @@ +@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, + ], +) diff --git a/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.roc b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.roc new file mode 100644 index 0000000000..f0e9650a37 --- /dev/null +++ b/crates/compiler/test_syntax/tests/snapshots/pass/not_closure_with_multibackpassing.expr.roc @@ -0,0 +1,3 @@ +!\t-> + m,i<-0 + s diff --git a/crates/compiler/test_syntax/tests/test_snapshots.rs b/crates/compiler/test_syntax/tests/test_snapshots.rs index 4ef013174e..3b95476692 100644 --- a/crates/compiler/test_syntax/tests/test_snapshots.rs +++ b/crates/compiler/test_syntax/tests/test_snapshots.rs @@ -551,6 +551,7 @@ 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,