Fix some bugs found via fuzzing

* Keywords need to still be recognized if they're followed by ',' as well as a bunch of other operator characters. Notably missing from this list is '-', since that would mess up expect-fx currently.
* Smattering of niche cases of formatting bugs (either non-idempotency, leading to different code, or leading to unparsable code)
* One missing indent call in fmt_collection leading to a panic
This commit is contained in:
Joshua Warner 2024-11-15 21:33:42 -08:00
parent 8fd83a483b
commit 550113df67
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
11 changed files with 152 additions and 6 deletions

View file

@ -0,0 +1,70 @@
SpaceAfter(
DbgStmt(
@5-10 SpaceBefore(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@5-6,
],
space_before: [
Slice { start: 0, length: 0 },
],
space_after: [
Slice { start: 0, length: 0 },
],
spaces: [],
type_defs: [],
value_defs: [
Stmt(
@5-6 Var {
module_name: "",
ident: "q",
},
),
],
},
@8-10 SpaceBefore(
Var {
module_name: "",
ident: "qt",
},
[
Newline,
],
),
),
[
Newline,
],
),
@11-16 SpaceBefore(
Apply(
@11-12 Var {
module_name: "",
ident: "g",
},
[
@14-16 SpaceBefore(
Var {
module_name: "",
ident: "qt",
},
[
Newline,
],
),
],
Space,
),
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,5 @@
dbg
q
qt
g
qt

View file

@ -0,0 +1,3 @@
L [
try, # [then2[#
]

View file

@ -0,0 +1,25 @@
SpaceAfter(
Apply(
@0-1 Tag(
"L",
),
[
@1-16 List(
[
@2-5 SpaceAfter(
Try,
[
LineComment(
"[then2[#",
),
],
),
],
),
],
Space,
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
L[try#[then2[#
]

View file

@ -314,6 +314,7 @@ mod test_snapshots {
pass/dbg.expr,
pass/dbg_stmt.expr,
pass/dbg_stmt_multiline.expr,
pass/dbg_stmt_two_exprs.expr,
pass/def_bang.expr,
pass/defs_suffixed_middle_extra_indents.moduledefs,
pass/destructure_tag_assignment.expr,
@ -501,6 +502,7 @@ mod test_snapshots {
pass/tag_pattern.expr,
pass/ten_times_eleven.expr,
pass/three_arg_closure.expr,
pass/try_blank_in_list.expr,
pass/try_function_after_pipe.expr,
pass/try_pipe_suffix.expr,
pass/try_plain_prefix.expr,