Merge pull request #7409 from joshuawarner32/fuzzing-bugs-5

Fix another batch of parsing/formatting bugs found in fuzzing
This commit is contained in:
Luke Boswell 2024-12-28 17:36:03 +11:00 committed by GitHub
commit f7dbf850b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
31 changed files with 750 additions and 74 deletions

View file

@ -0,0 +1 @@
Expr(BackpassArrow(@3), @0)

View file

@ -0,0 +1,3 @@
n,U(implements
)<-t
9

View file

@ -1 +1 @@
Expr(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(Type(TInParens(End(@78), @74), @72), @71), @69), @68), @66), @65), @61), @60), @58), @57), @53), @52), @50), @49), @47), @46), @44), @43), @41), @40), @39), @38), @36), @35), @31), @30), @28), @27), @23), @22), @20), @19), @17), @16), @11), @10), @8), @7), @3), @2), @2), @0)
Expr(Type(TInParens(End(@7), @2), @2), @0)

View file

@ -0,0 +1 @@
Expr(Type(TIndentEnd(@397), @2), @0)

View file

@ -0,0 +1,14 @@
K:bMM,(
A0,AectAfects,(
A0,AenAA1M,(
A0,Ae,(
A0bMprovi0,A=>A1,MA,M,e,M,A ,A ,s,(
AbMM,(A0
,Ae,(
A0bMprovi0,A=>A1,MA,M,e,M,e8,ActAfects,(
A0,AenAA1M,(
A0,Ae,(
A0bMprovi0,A=>A1,MA,M,e,M,A ,A ,s,(
AbMM,(A0
,Ae,(
A0bMprovi0,A=>A1,MA,M,e,M,e8,A)WM,ulsee,M,e8,A)db1,MA,M,e,M,e8,A)WM,ulsee,M,e8,A)dbgMA,MO,e,M,e4,A)WA)WenA1)WM,ulsee,M,e8,A)db1,MA,M,e,M,e8,A)WM,ulsee,M,e8,A)dbgMA,MO,e,M,e4,A)WA)WenA1,A)W

View file

@ -1,5 +1,6 @@
1 : (
f,
(ww -> p),
ww
-> p,
)e
Mh

View file

@ -21,16 +21,16 @@
),
@2-13 Tuple {
elems: [
@3-4 SpaceAfter(
BoundVariable(
"f",
),
[
Newline,
],
),
@6-11 Function(
@3-11 Function(
[
@3-4 SpaceAfter(
BoundVariable(
"f",
),
[
Newline,
],
),
@6-8 BoundVariable(
"ww",
),

View file

@ -0,0 +1,32 @@
@0-13 SpaceAfter(
Closure(
[
@1-5 Apply(
@1-2 Tag(
"L",
),
[
@4-5 SpaceAfter(
SpaceAfter(
Identifier {
ident: "z",
},
[
Newline,
],
),
[
Newline,
],
),
],
),
],
@11-13 Num(
"42",
),
),
[
Newline,
],
)

View file

@ -0,0 +1,49 @@
@0-14 SpaceAfter(
BinOps(
[
(
@0-1 SpaceAfter(
Var {
module_name: "",
ident: "m",
},
[
Newline,
],
),
@3-4 Caret,
),
],
@5-14 Apply(
@5-11 UnaryOp(
@6-11 Closure(
[
@7-8 Identifier {
ident: "w",
},
],
@10-11 Var {
module_name: "",
ident: "m",
},
),
@5-6 Negate,
),
[
@13-14 SpaceBefore(
Var {
module_name: "",
ident: "w",
},
[
Newline,
],
),
],
Space,
),
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
1 : w -> (w -> p)
h

View file

@ -0,0 +1,58 @@
@0-13 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-11,
],
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: [
Annotation(
@0-1 NumLiteral(
"1",
),
@3-10 Function(
[
@3-4 BoundVariable(
"w",
),
],
Pure,
@6-10 Function(
[
@6-7 BoundVariable(
"w",
),
],
Pure,
@9-10 BoundVariable(
"p",
),
),
),
),
],
},
@12-13 SpaceBefore(
Var {
module_name: "",
ident: "h",
},
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
1:(w->w->p)
h

View file

@ -0,0 +1,5 @@
1 : (
w -> p,
(w -> p),
)
h

View file

@ -0,0 +1,71 @@
@0-16 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-14,
],
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: [
Annotation(
@0-1 NumLiteral(
"1",
),
@2-14 Tuple {
elems: [
@3-7 Function(
[
@3-4 BoundVariable(
"w",
),
],
Pure,
@6-7 BoundVariable(
"p",
),
),
@9-13 Function(
[
@9-10 SpaceBefore(
BoundVariable(
"w",
),
[
Newline,
],
),
],
Pure,
@12-13 BoundVariable(
"p",
),
),
],
ext: None,
},
),
],
},
@15-16 SpaceBefore(
Var {
module_name: "",
ident: "h",
},
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,3 @@
1:(w->p,
w->p)
h

View file

@ -0,0 +1,42 @@
@0-16 SpaceAfter(
UnaryOp(
@1-16 Closure(
[
@2-3 Identifier {
ident: "t",
},
],
@7-16 SpaceBefore(
Backpassing(
[
@7-8 Identifier {
ident: "m",
},
@9-10 Identifier {
ident: "i",
},
],
@12-13 Num(
"0",
),
@15-16 SpaceBefore(
Var {
module_name: "",
ident: "s",
},
[
Newline,
],
),
),
[
Newline,
],
),
),
@0-1 Not,
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
f : (a, b -> c, (d -> e), g)
f

View file

@ -0,0 +1,72 @@
@0-27 SpaceAfter(
Defs(
Defs {
tags: [
EitherIndex(2147483648),
],
regions: [
@0-25,
],
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: [
Annotation(
@0-1 Identifier {
ident: "f",
},
@3-25 Tuple {
elems: [
@4-13 Function(
[
@4-5 BoundVariable(
"a",
),
@7-8 BoundVariable(
"b",
),
],
Pure,
@12-13 BoundVariable(
"c",
),
),
@15-21 Function(
[
@15-16 BoundVariable(
"d",
),
],
Pure,
@20-21 BoundVariable(
"e",
),
),
@23-24 BoundVariable(
"g",
),
],
ext: None,
},
),
],
},
@26-27 SpaceBefore(
Var {
module_name: "",
ident: "f",
},
[
Newline,
],
),
),
[
Newline,
],
)

View file

@ -0,0 +1,2 @@
f: (a, b -> c, d -> e, g)
f

View file

@ -209,6 +209,7 @@ mod test_snapshots {
fail/if_outdented_else_branch.expr,
fail/if_outdented_then.expr,
fail/ifbang_eqeq.expr,
fail/implements_in_multibackpassing_parens.expr,
fail/import_with_lowercase_alias.moduledefs,
fail/imports_missing_comma.header,
fail/inline_hastype.expr,
@ -228,6 +229,7 @@ mod test_snapshots {
fail/nested_tuples_annotation_terrible_perf.expr,
fail/nested_when_expect_binop_when.expr,
fail/newline_before_operator_with_defs.expr,
fail/oom_repro.expr,
fail/opaque_type_def_with_newline.expr,
fail/pattern_binds_keyword.expr,
fail/pattern_in_parens_end.expr,
@ -351,7 +353,9 @@ mod test_snapshots {
pass/closure_in_apply_in_binop.expr,
pass/closure_in_binop_with_spaces.expr,
pass/closure_newline_empty_record_newline.expr,
pass/closure_parens_double_newlines.expr,
pass/closure_pat_reccord_comment.expr,
pass/closure_with_binops_and_unary.expr,
pass/closure_with_underscores.expr,
pass/comma_prefixed_indented_record.expr,
pass/comment_after_annotation.expr,
@ -380,6 +384,7 @@ mod test_snapshots {
pass/crazy_backpassing_parens.expr,
pass/crazy_implements_bangs.expr,
pass/crazy_pat_ann.expr,
pass/curried_function_type.expr,
pass/dbg.expr,
pass/dbg_bang_neg_bang_if_bang.expr,
pass/dbg_double.expr,
@ -397,6 +402,7 @@ mod test_snapshots {
pass/destructure_tag_assignment.expr,
pass/docs.expr,
pass/double_closure_newlines_binop.expr,
pass/double_function_tuple.expr,
pass/double_parens_as_in_backpassing_pat.expr,
pass/double_parens_comment_tuple_pat.expr,
pass/double_question_binop.expr,
@ -552,6 +558,7 @@ mod test_snapshots {
pass/nonempty_hosted_header.header,
pass/nonempty_package_header.header,
pass/nonempty_platform_header.header,
pass/not_closure_with_multibackpassing.expr,
pass/not_double_parens.expr,
pass/not_multiline_string.expr,
pass/not_record_updater.expr,
@ -700,6 +707,7 @@ mod test_snapshots {
pass/tuple_accessor_function.expr,
pass/tuple_apply_parens_comment.expr,
pass/tuple_destructure_bang.expr,
pass/tuple_funcs_in_parens.expr,
pass/tuple_function_annotation.expr,
pass/tuple_type.expr,
pass/tuple_type_ext.expr,