Skip to content

Commit 9f395e0

Browse files
Fix pnc apply pattern lift spaces
1 parent 7acf9c5 commit 9f395e0

File tree

5 files changed

+61
-1
lines changed

5 files changed

+61
-1
lines changed

crates/compiler/fmt/src/pattern.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ pub fn pattern_lift_spaces<'a, 'b: 'a>(
722722

723723
Spaces {
724724
before: func_lifted.before,
725-
item: Pattern::PncApply(arena.alloc(func), *args),
725+
item: Pattern::PncApply(arena.alloc(Loc::at_zero(func_lifted.item)), *args),
726726
after: &[],
727727
}
728728
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
3() : B
2+
z
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
@0-12 SpaceAfter(
2+
Defs(
3+
Defs {
4+
tags: [
5+
EitherIndex(2147483648),
6+
],
7+
regions: [
8+
@0-8,
9+
],
10+
space_before: [
11+
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
12+
],
13+
space_after: [
14+
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
15+
],
16+
spaces: [],
17+
type_defs: [],
18+
value_defs: [
19+
Annotation(
20+
@2-6 PncApply(
21+
@2-3 SpaceBefore(
22+
NumLiteral(
23+
"3",
24+
),
25+
[
26+
Newline,
27+
],
28+
),
29+
[],
30+
),
31+
@7-8 Apply(
32+
"",
33+
"B",
34+
[],
35+
),
36+
),
37+
],
38+
},
39+
@9-12 SpaceBefore(
40+
ParensAround(
41+
Var {
42+
module_name: "",
43+
ident: "z",
44+
},
45+
),
46+
[
47+
Newline,
48+
],
49+
),
50+
),
51+
[
52+
Newline,
53+
],
54+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
(
2+
3)():B
3+
(z)

crates/compiler/test_syntax/tests/test_snapshots.rs

+1
Original file line numberDiff line numberDiff line change
@@ -634,6 +634,7 @@ mod test_snapshots {
634634
pass/plus_if.expr,
635635
pass/plus_when.expr,
636636
pass/pnc_apply_comment_after_newline.expr,
637+
pass/pnc_parens_apply_etc.expr,
637638
pass/pos_inf_float.expr,
638639
pass/positive_float.expr,
639640
pass/positive_int.expr,

0 commit comments

Comments
 (0)