Skip to content

Replace catching StackOverflowError with fuel#25937

Draft
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/fuel
Draft

Replace catching StackOverflowError with fuel#25937
SolalPirelli wants to merge 4 commits into
scala:mainfrom
dotty-staging:solal/fuel

Conversation

@SolalPirelli
Copy link
Copy Markdown
Contributor

@SolalPirelli SolalPirelli commented Apr 27, 2026

Part of #25799

0 new OpenCB failures: https://scala3.westeurope.cloudapp.azure.com/dashboard/compare?baseScalaVersion=3.9.0-RC1-bin-20260512-954f390&targetBuildId=dotty-staging%2Fdotty%3Asolal%2Ffuel%3A2026-05-12

How much have you relied on LLM-based tools in this contribution?

Not at all

How was the solution tested?

Covered by existing tests (this is a refactoring)

T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#
T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#
T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#
T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#T#
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

avoids a stack overflow; this test was introduced purely as a stress test in d3ac612 and the other elements of it were already reduced in 0ee31f4 so I think removing this line is fine

@SolalPirelli SolalPirelli force-pushed the solal/fuel branch 2 times, most recently from 958aabd to 1e2b230 Compare April 29, 2026 11:17
@SolalPirelli SolalPirelli changed the title no-review: Fuel Replace catching StackOverflowError with fuel Apr 29, 2026
else deps.updated(referenced, newSet)

def traverse(t: Type) = try
def traverse(t: Type) = ctx.handleRecursive("adjust", t.show):
Copy link
Copy Markdown
Member

@bishabosha bishabosha Apr 29, 2026

Choose a reason for hiding this comment

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

this still relies on stack recursion no? (mutual recursion via traverseChildren)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, this PR doesn't change the use of recursion, it changes how stack overflows are detected.

def computeTypeProxy = {
def computeTypeProxy = ctx.handleRecursive("type proxy of", i"$tp"):
val superTp = tp.superType
val baseTp = recur(superTp)
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.

each call to recur still increases stack depth right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah there are ~20 calls to handleRecursive that try and detect potential stack overflows, it'd be nice to rewrite the entire compiler to use an amount of stack space not dependent on user input but that's for (much) later.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants