mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-02 05:48:17 +00:00
Only allow indented else if there's a newline after the else
This commit is contained in:
parent
48c941d542
commit
cabe67f88d
5 changed files with 94 additions and 1 deletions
|
|
@ -0,0 +1,7 @@
|
|||
if
|
||||
h
|
||||
then
|
||||
A
|
||||
else
|
||||
&e
|
||||
s #
|
||||
|
|
@ -0,0 +1,75 @@
|
|||
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: [
|
||||
Stmt(
|
||||
@0-20 If {
|
||||
if_thens: [
|
||||
(
|
||||
@3-4 SpaceBefore(
|
||||
SpaceAfter(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "h",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
@10-11 SpaceBefore(
|
||||
SpaceAfter(
|
||||
Tag(
|
||||
"A",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
final_else: @18-20 RecordUpdater(
|
||||
"e",
|
||||
),
|
||||
indented_else: false,
|
||||
},
|
||||
),
|
||||
],
|
||||
},
|
||||
@21-22 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "s",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
LineComment(
|
||||
"",
|
||||
),
|
||||
],
|
||||
)
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
if
|
||||
h
|
||||
then
|
||||
A
|
||||
else &e
|
||||
s#
|
||||
|
|
@ -274,6 +274,7 @@ mod test_snapshots {
|
|||
pass/ability_multi_line.expr,
|
||||
pass/ability_single_line.expr,
|
||||
pass/ability_two_in_a_row.expr,
|
||||
pass/accidentally_indented_else.expr,
|
||||
pass/add_var_with_spaces.expr,
|
||||
pass/add_with_spaces.expr,
|
||||
pass/alias_ann_in_parens.expr,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue