mirror of
https://github.com/roc-lang/roc.git
synced 2024-11-10 18:08:55 +03:00
Merge pull request #4903 from joshuawarner32/fix-nested_backpassing_no_newline_before
Fix formatting of backpassing in a nested def with no newline
This commit is contained in:
commit
78fc30484e
@ -420,7 +420,7 @@ pub fn fmt_body<'a, 'buf>(
|
||||
);
|
||||
}
|
||||
}
|
||||
Expr::Defs(..) | Expr::BinOps(_, _) => {
|
||||
Expr::Defs(..) | Expr::BinOps(_, _) | Expr::Backpassing(..) => {
|
||||
// Binop chains always get a newline. Otherwise you can have things like:
|
||||
//
|
||||
// something = foo
|
||||
|
@ -0,0 +1,7 @@
|
||||
main =
|
||||
task =
|
||||
file <-
|
||||
foo
|
||||
bar
|
||||
task
|
||||
42
|
@ -0,0 +1,97 @@
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-71,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@0-4 Identifier(
|
||||
"main",
|
||||
),
|
||||
@11-71 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@11-62,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Body(
|
||||
@11-15 Identifier(
|
||||
"task",
|
||||
),
|
||||
@18-62 Backpassing(
|
||||
[
|
||||
@18-22 Identifier(
|
||||
"file",
|
||||
),
|
||||
],
|
||||
@43-46 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "foo",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@59-62 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "bar",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@67-71 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "task",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@72-74 SpaceBefore(
|
||||
Num(
|
||||
"42",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
@ -0,0 +1,6 @@
|
||||
main =
|
||||
task = file <-
|
||||
foo
|
||||
bar
|
||||
task
|
||||
42
|
@ -325,6 +325,7 @@ mod test_snapshots {
|
||||
pass/negative_in_apply_def.expr,
|
||||
pass/negative_int.expr,
|
||||
pass/nested_def_annotation.moduledefs,
|
||||
pass/nested_backpassing_no_newline_before.expr,
|
||||
pass/nested_def_without_newline.expr,
|
||||
pass/nested_if.expr,
|
||||
pass/nested_module.header,
|
||||
|
Loading…
Reference in New Issue
Block a user