mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-03 19:58:18 +00:00
Fix a bunch of bugs in parsing/formatting found by fuzzing
This commit is contained in:
parent
acd446f6bd
commit
3fee0d3e8f
43 changed files with 593 additions and 70 deletions
|
@ -0,0 +1,6 @@
|
|||
MalformedIdent(
|
||||
"I.5",
|
||||
QualifiedTupleAccessor(
|
||||
@1,
|
||||
),
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
I.5
|
|
@ -0,0 +1,3 @@
|
|||
a
|
||||
&& (\x -> x)
|
||||
8
|
|
@ -0,0 +1,35 @@
|
|||
BinOps(
|
||||
[
|
||||
(
|
||||
@0-1 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@2-4 And,
|
||||
),
|
||||
],
|
||||
@5-12 Apply(
|
||||
@5-10 Closure(
|
||||
[
|
||||
@6-7 Identifier(
|
||||
"x",
|
||||
),
|
||||
],
|
||||
@9-10 Var {
|
||||
module_name: "",
|
||||
ident: "x",
|
||||
},
|
||||
),
|
||||
[
|
||||
@11-12 SpaceBefore(
|
||||
Num(
|
||||
"8",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
a && \x->x
|
||||
8
|
|
@ -0,0 +1,4 @@
|
|||
i
|
||||
> (\s -> s
|
||||
)
|
||||
-a
|
|
@ -0,0 +1,39 @@
|
|||
BinOps(
|
||||
[
|
||||
(
|
||||
@0-1 Var {
|
||||
module_name: "",
|
||||
ident: "i",
|
||||
},
|
||||
@1-2 GreaterThan,
|
||||
),
|
||||
],
|
||||
@2-10 Apply(
|
||||
@2-7 SpaceAfter(
|
||||
Closure(
|
||||
[
|
||||
@3-4 Identifier(
|
||||
"s",
|
||||
),
|
||||
],
|
||||
@6-7 Var {
|
||||
module_name: "",
|
||||
ident: "s",
|
||||
},
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
[
|
||||
@8-10 UnaryOp(
|
||||
@9-10 Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
@8-9 Negate,
|
||||
),
|
||||
],
|
||||
Space,
|
||||
),
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
i>\s->s
|
||||
-a
|
|
@ -0,0 +1,3 @@
|
|||
B : {}
|
||||
|
||||
a
|
|
@ -0,0 +1,47 @@
|
|||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(0),
|
||||
],
|
||||
regions: [
|
||||
@0-4,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [
|
||||
Alias {
|
||||
header: TypeHeader {
|
||||
name: @0-1 "B",
|
||||
vars: [],
|
||||
},
|
||||
ann: @2-4 Record {
|
||||
fields: [],
|
||||
ext: None,
|
||||
},
|
||||
},
|
||||
],
|
||||
value_defs: [],
|
||||
},
|
||||
@6-10 SpaceBefore(
|
||||
ParensAround(
|
||||
SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
B:{}
|
||||
|
||||
(
|
||||
a)
|
|
@ -1,3 +1,3 @@
|
|||
!
|
||||
"""
|
||||
"""
|
||||
-(
|
||||
"""
|
||||
""")
|
|
@ -4,5 +4,5 @@ UnaryOp(
|
|||
[],
|
||||
),
|
||||
),
|
||||
@0-1 Not,
|
||||
@0-1 Negate,
|
||||
)
|
||||
|
|
|
@ -1 +1 @@
|
|||
!""""""
|
||||
-""""""
|
|
@ -0,0 +1,4 @@
|
|||
-(
|
||||
"""
|
||||
"<
|
||||
""")
|
|
@ -0,0 +1,8 @@
|
|||
UnaryOp(
|
||||
@1-9 Str(
|
||||
PlainLine(
|
||||
"\"<",
|
||||
),
|
||||
),
|
||||
@0-1 Negate,
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
-""""<"""
|
|
@ -0,0 +1,3 @@
|
|||
!
|
||||
"""
|
||||
"""
|
|
@ -0,0 +1,8 @@
|
|||
UnaryOp(
|
||||
@1-7 Str(
|
||||
Block(
|
||||
[],
|
||||
),
|
||||
),
|
||||
@0-1 Not,
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
!""""""
|
|
@ -0,0 +1,2 @@
|
|||
U (b a) : b
|
||||
a
|
|
@ -0,0 +1,49 @@
|
|||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(0),
|
||||
],
|
||||
regions: [
|
||||
@0-8,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [
|
||||
Alias {
|
||||
header: TypeHeader {
|
||||
name: @0-1 "U",
|
||||
vars: [
|
||||
@2-5 Apply(
|
||||
@2-3 Identifier(
|
||||
"b",
|
||||
),
|
||||
[
|
||||
@4-5 Identifier(
|
||||
"a",
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
},
|
||||
ann: @7-8 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
},
|
||||
],
|
||||
value_defs: [],
|
||||
},
|
||||
@9-10 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
U(b a):b
|
||||
a
|
|
@ -0,0 +1,3 @@
|
|||
i #
|
||||
N : b
|
||||
a
|
|
@ -0,0 +1,52 @@
|
|||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(2147483648),
|
||||
],
|
||||
regions: [
|
||||
@0-9,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [],
|
||||
value_defs: [
|
||||
Annotation(
|
||||
@0-1 Apply(
|
||||
@0-1 Identifier(
|
||||
"i",
|
||||
),
|
||||
[
|
||||
@5-6 SpaceBefore(
|
||||
Tag(
|
||||
"N",
|
||||
),
|
||||
[
|
||||
Newline,
|
||||
LineComment(
|
||||
"",
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@8-9 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
),
|
||||
],
|
||||
},
|
||||
@10-11 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
i
|
||||
(#
|
||||
N):b
|
||||
a
|
|
@ -0,0 +1,2 @@
|
|||
D : b
|
||||
a
|
|
@ -0,0 +1,38 @@
|
|||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(0),
|
||||
],
|
||||
regions: [
|
||||
@1-5,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [
|
||||
Alias {
|
||||
header: TypeHeader {
|
||||
name: @1-2 "D",
|
||||
vars: [],
|
||||
},
|
||||
ann: @4-5 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
},
|
||||
],
|
||||
value_defs: [],
|
||||
},
|
||||
@6-7 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
|
@ -0,0 +1,2 @@
|
|||
(D):b
|
||||
a
|
|
@ -0,0 +1,2 @@
|
|||
A : b
|
||||
a
|
|
@ -0,0 +1,38 @@
|
|||
Defs(
|
||||
Defs {
|
||||
tags: [
|
||||
Index(0),
|
||||
],
|
||||
regions: [
|
||||
@2-6,
|
||||
],
|
||||
space_before: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
space_after: [
|
||||
Slice(start = 0, length = 0),
|
||||
],
|
||||
spaces: [],
|
||||
type_defs: [
|
||||
Alias {
|
||||
header: TypeHeader {
|
||||
name: @2-3 "A",
|
||||
vars: [],
|
||||
},
|
||||
ann: @5-6 BoundVariable(
|
||||
"b",
|
||||
),
|
||||
},
|
||||
],
|
||||
value_defs: [],
|
||||
},
|
||||
@7-8 SpaceBefore(
|
||||
Var {
|
||||
module_name: "",
|
||||
ident: "a",
|
||||
},
|
||||
[
|
||||
Newline,
|
||||
],
|
||||
),
|
||||
)
|
|
@ -0,0 +1,3 @@
|
|||
(
|
||||
A):b
|
||||
a
|
|
@ -0,0 +1,5 @@
|
|||
"""
|
||||
|
||||
|
||||
#
|
||||
""" #
|
|
@ -0,0 +1,24 @@
|
|||
SpaceAfter(
|
||||
Str(
|
||||
Block(
|
||||
[
|
||||
[
|
||||
Plaintext(
|
||||
"\n",
|
||||
),
|
||||
Plaintext(
|
||||
"\n",
|
||||
),
|
||||
Plaintext(
|
||||
"#",
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
[
|
||||
LineComment(
|
||||
"",
|
||||
),
|
||||
],
|
||||
)
|
|
@ -0,0 +1,4 @@
|
|||
"""
|
||||
|
||||
|
||||
#"""#
|
|
@ -251,6 +251,7 @@ mod test_snapshots {
|
|||
malformed/malformed_ident_due_to_underscore.expr,
|
||||
malformed/malformed_pattern_field_access.expr, // See https://github.com/roc-lang/roc/issues/399
|
||||
malformed/malformed_pattern_module_name.expr, // See https://github.com/roc-lang/roc/issues/399
|
||||
malformed/module_dot_tuple.expr,
|
||||
malformed/qualified_tag.expr,
|
||||
malformed/underscore_expr_in_def.expr,
|
||||
pass/ability_demand_signature_is_multiline.expr,
|
||||
|
@ -278,6 +279,8 @@ mod test_snapshots {
|
|||
pass/basic_var.expr,
|
||||
pass/bound_variable.expr,
|
||||
pass/call_with_newlines.expr,
|
||||
pass/closure_in_binop.expr,
|
||||
pass/closure_in_binop_with_spaces.expr,
|
||||
pass/closure_with_underscores.expr,
|
||||
pass/comment_after_annotation.expr,
|
||||
pass/comment_after_def.moduledefs,
|
||||
|
@ -306,6 +309,7 @@ mod test_snapshots {
|
|||
pass/equals_with_spaces.expr,
|
||||
pass/expect.expr,
|
||||
pass/expect_fx.moduledefs,
|
||||
pass/extra_newline_in_parens.expr,
|
||||
pass/float_with_underscores.expr,
|
||||
pass/full_app_header.header,
|
||||
pass/full_app_header_trailing_commas.header,
|
||||
|
@ -343,6 +347,7 @@ mod test_snapshots {
|
|||
pass/multiple_operators.expr,
|
||||
pass/neg_inf_float.expr,
|
||||
pass/negate_multiline_string.expr,
|
||||
pass/negate_multiline_string_with_quote.expr,
|
||||
pass/negative_float.expr,
|
||||
pass/negative_in_apply_def.expr,
|
||||
pass/negative_int.expr,
|
||||
|
@ -368,6 +373,7 @@ mod test_snapshots {
|
|||
pass/nonempty_package_header.header,
|
||||
pass/nonempty_platform_header.header,
|
||||
pass/not_docs.expr,
|
||||
pass/not_multiline_string.expr,
|
||||
pass/number_literal_suffixes.expr,
|
||||
pass/one_backpassing.expr,
|
||||
pass/one_char_string.expr,
|
||||
|
@ -389,6 +395,10 @@ mod test_snapshots {
|
|||
pass/outdented_list.expr,
|
||||
pass/outdented_record.expr,
|
||||
pass/packed_singleton_list.expr,
|
||||
pass/parens_in_type_def_apply.expr,
|
||||
pass/parens_in_value_def_annotation.expr,
|
||||
pass/parenthesized_type_def.expr,
|
||||
pass/parenthesized_type_def_space_before.expr,
|
||||
pass/parenthetical_apply.expr,
|
||||
pass/parenthetical_basic_field.expr,
|
||||
pass/parenthetical_field_qualified_var.expr,
|
||||
|
@ -420,6 +430,7 @@ mod test_snapshots {
|
|||
pass/spaced_singleton_list.expr,
|
||||
pass/spaces_inside_empty_list.expr,
|
||||
pass/standalone_module_defs.moduledefs,
|
||||
pass/str_block_multiple_newlines.expr,
|
||||
pass/string_without_escape.expr,
|
||||
pass/sub_var_with_spaces.expr,
|
||||
pass/sub_with_spaces.expr,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue