Fix outdenting in closures

This commit is contained in:
Joshua Warner 2024-12-14 20:28:46 -08:00
parent 54a0456c30
commit 7b9aa59d64
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
5 changed files with 63 additions and 1 deletions

View file

@ -1872,7 +1872,6 @@ fn fmt_closure<'a>(
};
if should_outdent {
buf.spaces(1);
sub_expr.format_with_options(buf, Parens::NotNeeded, Newlines::Yes, indent);
} else {
loc_ret.format_with_options(buf, Parens::NotNeeded, Newlines::Yes, body_indent);

View file

@ -0,0 +1,55 @@
@0-12 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-9,
],
space_before: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
space_after: [
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
value_defs: [
Stmt(
@0-9 Closure(
[
@1-2 Tag(
"L",
),
],
@6-9 SpaceBefore(
Record(
Collection {
items: [],
final_comments: [
Newline,
],
},
),
[
Newline,
],
),
),
),
],
},
@10-12 SpaceBefore(
Tag(
"Θ",
),
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -344,6 +344,7 @@ mod test_snapshots {
pass/closure_complex_pattern_indent_issue.expr,
pass/closure_in_apply_in_binop.expr,
pass/closure_in_binop_with_spaces.expr,
pass/closure_newline_empty_record_newline.expr,
pass/closure_pat_reccord_comment.expr,
pass/closure_with_underscores.expr,
pass/comma_prefixed_indented_record.expr,