Skip to content

Avoid stack overflow in Sequentials pattern - #14663

Merged
vzarytovskii merged 4 commits into
dotnet:mainfrom
0101:fix-11667
Jan 26, 2023
Merged

Avoid stack overflow in Sequentials pattern#14663
vzarytovskii merged 4 commits into
dotnet:mainfrom
0101:fix-11667

Conversation

@0101

@01010101 commented Jan 26, 2023

Copy link
Copy Markdown
Contributor

Fixes#11667

@0101
0101 requested a review from a team as a code ownerJanuary 26, 2023 12:20

@vzarytovskiivzarytovskii left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@vzarytovskii
vzarytovskii enabled auto-merge (squash) January 26, 2023 12:31

@abonieabonie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be a unit test too?

@0101

0101 commented Jan 26, 2023

Copy link
Copy Markdown
ContributorAuthor

Should there be a unit test too?

Probably. Although testing for stack overflow can be tricky.

@vzarytovskii
vzarytovskii merged commit 035d908 into dotnet:mainJan 26, 2023
@nojaf

Copy link
Copy Markdown
Contributor

Probably. Although testing for stack overflow can be tricky.

In Fantomas, we had a similar problem once. I've added the following test to reproduce the problem:

[<Test>]let``avoid stack-overflow in long array/list,2485`` ()=letmkStringExpr()=
SynExpr.Const(
SynConst.String((System.Guid.NewGuid().ToString("N"), SynStringKind.Regular, Range.Zero)),
Range.Zero
)letlongArrayExpr:SynExpr =let recmkArray count childExpr =if count =20_000then
childExpr
else
mkArray
(count +1)(SynExpr.Sequential(
DebugPointAtSequential.SuppressNeither,true,
mkStringExpr (),
childExpr,
Range.Zero
))
SynExpr.ArrayOrListComputed(true, mkArray 0(mkStringExpr ()), Range.Zero)letast=
ParsedInput.ImplFile(
ParsedImplFileInput("filename.fsx",true,
QualifiedNameOfFile(Ident("", Range.Zero)),[],[],[ SynModuleOrNamespace([],false,
SynModuleOrNamespaceKind.AnonModule,[ SynModuleDecl.Expr(longArrayExpr, Range.Zero)],
PreXmlDoc.Empty,[],
None,
Range.Zero,{ LeadingKeyword = SynModuleOrNamespaceLeadingKeyword.None })],(false,false),{ ConditionalDirectives =[]
CodeComments =[]},
Set.empty
))let_rootNode= ASTTransformer.mkOak None ast
Assert.Pass()

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Visual Studio hangs/crashes when hovering over a nonexistent union case pattern

4 participants

@0101@nojaf@vzarytovskii@abonie