mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-21 07:49:17 +03:00
Fix formatting of backpassing in a nested def with no newline
Fixes #4338
This commit is contained in:
parent
fb0668f13b
commit
d876abb04b
@ -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:
|
// Binop chains always get a newline. Otherwise you can have things like:
|
||||||
//
|
//
|
||||||
// something = foo
|
// 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_in_apply_def.expr,
|
||||||
pass/negative_int.expr,
|
pass/negative_int.expr,
|
||||||
pass/nested_def_annotation.moduledefs,
|
pass/nested_def_annotation.moduledefs,
|
||||||
|
pass/nested_backpassing_no_newline_before.expr,
|
||||||
pass/nested_def_without_newline.expr,
|
pass/nested_def_without_newline.expr,
|
||||||
pass/nested_if.expr,
|
pass/nested_if.expr,
|
||||||
pass/nested_module.header,
|
pass/nested_module.header,
|
||||||
|
Loading…
Reference in New Issue
Block a user