mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
Fix formatting of body when pattern is multi-line
This commit is contained in:
parent
01dda78271
commit
7b09b15dea
5 changed files with 88 additions and 0 deletions
|
@ -1009,6 +1009,7 @@ pub fn fmt_body<'a>(
|
|||
} else {
|
||||
buf.spaces(1);
|
||||
}
|
||||
let indent = buf.cur_line_indent();
|
||||
buf.push_str("=");
|
||||
|
||||
let body = expr_lift_and_lower(Parens::NotNeeded, buf.text.bump(), body);
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{ e ? f
|
||||
4 } = f
|
||||
e
|
||||
r
|
|
@ -0,0 +1,78 @@
|
|||
@0-14 SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-12,
|
||||
],
|
||||
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: [
|
||||
Body(
|
||||
@0-7 RecordDestructure(
|
||||
[
|
||||
@1-6 OptionalField(
|
||||
"e",
|
||||
@3-6 Apply(
|
||||
@3-4 Var {
|
||||
module_name: "",
|
||||
ident: "f",
|
||||
},
|
||||
[
|
||||
@5-6 SpaceBefore(
|
||||
Num(
|
||||
"4",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
@8-12 Apply(
|
||||
@8-9 Var {
|
||||
module_name: "",
|
||||
ident: "f",
|
||||
},
|
||||
[
|
||||
@11-12 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "e",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@13-14 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "r",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
{e?f
|
||||
4}=f
|
||||
e
|
||||
r
|
|
@ -574,6 +574,7 @@ mod test_snapshots {
|
|||
pass/ops_with_newlines.expr,
|
||||
pass/opt_field_newline_in_pat.expr,
|
||||
pass/opt_field_newline_in_ty.expr,
|
||||
pass/opt_record_field_pat_assign.expr,
|
||||
pass/outdented_app_with_record.expr,
|
||||
pass/outdented_colon_in_record.expr,
|
||||
pass/outdented_list.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue