mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Fix indentation of single-line ifs
This commit is contained in:
parent
7fd97dec72
commit
d9ad34592c
7 changed files with 87 additions and 10 deletions
|
@ -0,0 +1,5 @@
|
|||
f = if !b! then
|
||||
""
|
||||
else
|
||||
e
|
||||
""
|
|
@ -0,0 +1,68 @@
|
|||
@0-23 SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-20,
|
||||
],
|
||||
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-1 Identifier {
|
||||
ident: "f",
|
||||
},
|
||||
@2-20 If {
|
||||
if_thens: [
|
||||
(
|
||||
@4-7 UnaryOp(
|
||||
@5-7 Var {
|
||||
module_name: "",
|
||||
ident: "b!",
|
||||
},
|
||||
@4-5 Not,
|
||||
),
|
||||
@11-13 Str(
|
||||
PlainLine(
|
||||
"",
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
final_else: @19-20 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "e",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
indented_else: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
@21-23 SpaceBefore(
|
||||
Str(
|
||||
PlainLine(
|
||||
"",
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
f=if!b!then""else
|
||||
e
|
||||
""
|
|
@ -1,8 +1,8 @@
|
|||
@1-23 SpaceAfter(
|
||||
@0-22 SpaceAfter(
|
||||
If {
|
||||
if_thens: [
|
||||
(
|
||||
@4-5 SpaceBefore(
|
||||
@3-4 SpaceBefore(
|
||||
SpaceAfter(
|
||||
Var {
|
||||
module_name: "",
|
||||
|
@ -16,7 +16,7 @@
|
|||
Newline,
|
||||
],
|
||||
),
|
||||
@11-12 SpaceBefore(
|
||||
@10-11 SpaceBefore(
|
||||
SpaceAfter(
|
||||
Tag(
|
||||
"A",
|
||||
|
@ -31,14 +31,14 @@
|
|||
),
|
||||
),
|
||||
],
|
||||
final_else: @20-23 SpaceBefore(
|
||||
final_else: @19-22 SpaceBefore(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@20-21,
|
||||
@19-20,
|
||||
],
|
||||
space_before: [
|
||||
Slice<roc_parse::ast::CommentOrNewline> { start: 0, length: 0 },
|
||||
|
@ -50,14 +50,14 @@
|
|||
type_defs: [],
|
||||
value_defs: [
|
||||
Stmt(
|
||||
@20-21 Var {
|
||||
@19-20 Var {
|
||||
module_name: "",
|
||||
ident: "e",
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
@22-23 SpaceBefore(
|
||||
@21-22 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "r",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
if
|
||||
if
|
||||
k
|
||||
then
|
||||
A
|
||||
|
|
|
@ -454,6 +454,7 @@ mod test_snapshots {
|
|||
pass/highest_float.expr,
|
||||
pass/highest_int.expr,
|
||||
pass/i_over_not_g.expr,
|
||||
pass/if_bang_then_else_one_line.expr,
|
||||
pass/if_def.expr,
|
||||
pass/if_in_record_field_opt_pat.expr,
|
||||
pass/if_newline_then_negate_else_recordupdater.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue