Skip to content

Conversation

@brianrourkeboll
Copy link
Contributor

@brianrourkeboll brianrourkeboll commented Mar 15, 2024

Description

Fixes one of the problems discovered in #16869 (#16869 (comment)).

Sequential expressions are more likely than most other expression kinds to be very deeply nested, e.g., in very large list or array expressions. Since traverseSynExpr is not tail-recursive, we must treat sequential expressions specially to avoid blowing the stack.

(This change isn't specific to the parens analyzer; the parens analyzer was just more likely to run into the underlying problem, since it always traverses each file's full AST.)

With this change in place, I can now successfully apply the "fix all in document" action to remove unnecessary parens in ServiceDeclarationLists.fs:

Screenshot 2024-03-15 115305

Screenshot 2024-03-15 115408

I can even apply the fix inside of the ~17,000-line array expression in pars.fs:

paren_fix

Checklist

  • Test cases added
    • The existing tests that exercise this pathway still pass.
    • Very big array expr test: beef3a6.
  • Release notes entry updated

* Sequential expressions are more likely than most other expression
  kinds to be deeply nested, e.g., in very large list or array
  expressions. Since `traverseSynExpr` is not tail-recursive, we must
  treat them specially to avoid blowing the stack.
@github-actions
Copy link
Contributor

github-actions bot commented Mar 15, 2024

❗ Release notes required


✅ Found changes and release notes in following paths:

Change path Release notes path Description
src/Compiler docs/release-notes/.FSharp.Compiler.Service/8.0.300.md

@brianrourkeboll brianrourkeboll marked this pull request as ready for review March 15, 2024 20:59
@brianrourkeboll brianrourkeboll requested a review from a team as a code owner March 15, 2024 20:59
Copy link
Contributor

@psfinaki psfinaki left a comment

Choose a reason for hiding this comment

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

Good stuff, thanks a lot. If that megatest is easy to add, go ahead, would be also useful :)

@psfinaki
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 2 pipeline(s).

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

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

7 participants