Skip to content

fix(analyser): report a generic function whose type grows too large 📏 - #334

Merged
timfennis merged 1 commit into
feat/type-checkerfrom
fix/limit-type-size
Nov 13, 2026
Merged

timfennis merged 1 commit into
feat/type-checkerfrom
fix/limit-type-size

Conversation

@timfennis

Copy link
Copy Markdown
Owner

Each generic function's type can be twice the size of the type of the one it calls, so a chain of them grows exponentially, the known worst case of Hindley–Milner inference. With fn f0(x) => (x, x) and fn fi(x) => f{i-1}(f{i-1}(x)), analysis ran out of memory at f6, even with the call behind if false.

A generic function whose type has more than 10,000 parts is now reported ("The type of f4 has more than 10000 parts, too many to work with", with help to annotate a parameter or the return type with Any), like rustc's type length limit, and is analysed from there on as taking and returning Any, so the functions that call it don't grow it further. The size is counted once per generic function, stopping at the limit.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T16:41:12.430833Z 0a5fd44 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@timfennis
timfennis merged commit 0192f2a into feat/type-checker Nov 13, 2026
1 check passed
@timfennis
timfennis deleted the fix/limit-type-size branch November 13, 2026 16:42
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.

1 participant