mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Disallow simplifying empty assignment of dbg
This commit is contained in:
parent
59fe0f06ea
commit
d8d0b6ebb1
6 changed files with 72 additions and 2 deletions
|
@ -991,6 +991,7 @@ pub fn fmt_body<'a>(
|
|||
&& !matches!(body.extract_spaces().item, Expr::Defs(..))
|
||||
&& !matches!(body.extract_spaces().item, Expr::Return(..))
|
||||
&& !matches!(body.extract_spaces().item, Expr::Backpassing(..))
|
||||
&& !matches!(body.extract_spaces().item, Expr::DbgStmt { .. })
|
||||
&& !starts_with_expect_ident(body)
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -360,8 +360,8 @@ impl<'a> Input<'a> {
|
|||
* * * AST after formatting:\n{:#?}\n\n",
|
||||
self.as_str(),
|
||||
output.as_ref().as_str(),
|
||||
ast_normalized,
|
||||
reparsed_ast_normalized
|
||||
actual,
|
||||
reparsed_ast
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
{} =
|
||||
dbg c
|
||||
c
|
||||
e
|
|
@ -0,0 +1,60 @@
|
|||
@0-15 SpaceAfter(
|
||||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
EitherIndex(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-13,
|
||||
],
|
||||
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-2 RecordDestructure(
|
||||
[],
|
||||
),
|
||||
@5-10 SpaceBefore(
|
||||
DbgStmt {
|
||||
first: @9-10 Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
extra_args: [],
|
||||
continuation: @12-13 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "c",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@14-15 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "e",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
{}=
|
||||
dbg c
|
||||
c
|
||||
e
|
|
@ -420,6 +420,7 @@ mod test_snapshots {
|
|||
pass/empty_platform_header.header,
|
||||
pass/empty_record.expr,
|
||||
pass/empty_record_assign_backpassing.expr,
|
||||
pass/empty_record_assign_dbg.expr,
|
||||
pass/empty_record_assign_implements.expr,
|
||||
pass/empty_record_assign_return.expr,
|
||||
pass/empty_record_assign_tag.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue