Repository navigation
fix(compiler): key display descriptors by layout - #1166
Merged
nicolas-abril merged 2 commits intoSep 28, 2026
Merged
Conversation
…out object The key already names the type; putting the layout's JSON beside it replaces String(box) in one line and shares a node between equal layouts reached by different paths. The emitted C and JS match the nested map on every test. A parameterized sum type witnesses the bug beyond Sigma. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
the pure
mainin #1129 prints garbage and can fault natively, while the interpreter and JS print the right value. Array elements and direct values can have different field layouts even when their type and top-level boxing match.i'm evaluating Bend alongside our TypeScript monorepo and reproduced this while comparing native and JS output.
Fixes #1129.
Scope
Cache
show_main's descriptors by the existing layout object and normalized type, usingmemofor each layout's entries. One net compiler line, no new helpers, and an update to the existing explanatory comment.Two short regressions cover array-first and value-first traversal, with one-constructor and two-constructor types. Existing tests stay intact.
Blast radius
The display descriptors for pure-main results. The change separates layouts that need different field offsets and child descriptors. IO mains have no display descriptor.
Verification
On macOS arm64, Bun 1.3.11 and clang 23.1.2:
e41fa7b. With the fix, checking, interpreter, emitted JS and native execution pass.bun gates/repo.ts: 49/49.git diff --checkpasses. Compiler size is 63,981/64,000 tokens, 14 more than the base.Cluster, GPU and benchmark gates were not run.