Skip to content

Limit inferred type sizes #2382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 15, 2025
Merged

Limit inferred type sizes #2382

merged 5 commits into from
May 15, 2025

Conversation

swernli
Copy link
Collaborator

@swernli swernli commented May 8, 2025

This change introduces a notion of type "size" as a way to detect and avoid degenerate type inference cases. The examples found by the fuzzer can create large, complex types that result in hangs during type inference. Much like the type inference recursion limit, this size limit is a heuristic that is unlikely to be hit during normal use of the language but prevents crashes or hangs during extreme usage such as with generated code that incurs artificially large or deeply nested types.
Fixes #2369

This change introduces a notion of type "size" as a way to detect and avoid degenerate type inference cases. The examples found by the fuzzer can create large, complex types that result in hangs during type inference. Much like the type inference recursion limit, this size limit is a heuristic that is unlikely to be hit during normal use of the language but prevents crashes or hangs during extreme usage such as with generated code that incurs artificially large or deeply nested types.
Fixes #2369
@swernli swernli requested review from idavis and minestarks as code owners May 8, 2025 06:25
@swernli swernli added this pull request to the merge queue May 15, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 15, 2025
@swernli swernli enabled auto-merge May 15, 2025 17:48
@swernli swernli added this pull request to the merge queue May 15, 2025
Merged via the queue into main with commit fe2e402 May 15, 2025
18 checks passed
@swernli swernli deleted the swernli/issue2369 branch May 15, 2025 18:17
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.

Fuzz: "==4635== ERROR: libFuzzer: timeout after 1265 seconds" (ubuntu-latest)
2 participants