Skip to content

fix(compiler): inspect sibling datatype instances independently - #1522

Closed
oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/issue-1513-instance-holds-20261012
Closed

oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/issue-1513-instance-holds-20261012

Conversation

@oxura

@oxura oxura commented Oct 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #1513.

ty_holds used a datatype-name set as a global visited set. After opening Box<Num{}>, it skipped the fields of the sibling Box<Fun{}> and missed the host-minted closure. Track active datatype expansions instead: remove the name after scanning its constructor fields. Recursive-name cycle protection remains, but sibling value-indexed instances are inspected independently. No type-key serialization, copied visited sets, checker changes, runtime workaround, or special-case Box/Tag handling.

Adds the original two-Box closure-bang program as a permanent regression for the existing GPU-enabled test gate. The helper's source documentation explains the active-path invariant. Protected bend2/bend.ts, hand-written guide/GUIDE.md, release-only CHANGELOG.md and gates/caps are unchanged.

Real behavior proof

Linux x86_64, Bun CLI 1.3.13, Node v22.23.1, clang 22.1.8. Based on current main 381dc877.

  • Actual CLI and native C (--gpu off --threads 4) run the reported program and print 42. CPU execution is a control: it already succeeds on main and does not reproduce the original Metal failure.
  • Build the same program to C with current main and the fixed compiler. Run actual CUDA-branch preprocessing, clang -E -P -x c -D__CUDACC_RTC__=1 program.c, without emulating a GPU or changing its guards. The host-minted closure is FID 4 in these artifacts. Before: the device evaluator has no case 4 and retains the missing-function error default. After: case 4 is included in the real device dispatch. This proves the changed compiler path, not a GPU runtime pass.
  • 17 existing/new closure, recursive indexed/pair/list, and current plain-number Nat seam CLI executions match their expected outputs.
  • bun gates/repo.ts: 54/54.

An earlier real JS BigInt-seam reproduction was removed from this patch after upstream #1506 changed Nat host values to numbers and removed the old converter. It is not repinned to an incidental new default.

Validation limits

Metal/CUDA hardware and the 48-mini distributed gate were unavailable. The permanent original regression must run on the existing upstream GPU-enabled gate; no actual device success or performance is claimed here. The preprocessing comparison is a throwaway artifact check, not a permanent source-text test.

@Lorenzobattistela

Copy link
Copy Markdown
Collaborator

Thanks for this.
I am chasing a different approach on #1542 , so I'll close this one in favor of that.

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.

ty_holds skips a closure in a later instance of the same datatype

2 participants