Fix exponential behavior in parsing function types in tuples

This commit is contained in:
Joshua Warner 2024-12-22 20:14:50 -05:00
parent f1f6cb4625
commit 941c6c4fe3
No known key found for this signature in database
GPG key ID: 89AD497003F93FDD
14 changed files with 466 additions and 67 deletions

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,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

@ -229,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,
@ -381,6 +382,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,
@ -398,6 +400,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_space_before.expr,