Skip to content

Fold known match arms in JS expressions - #2235

Draft
oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/2181-js-unfold-20261124
Draft

oxura wants to merge 1 commit into
bendlang:mainfrom
oxura:fix/2181-js-unfold-20261124

Conversation

@oxura

@oxura oxura commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Fixes #2181 on the JS side. pick(boom(k), 0n, 100n) now prints 100 instead of evaluating boom(k) and hitting the Nat limit. JS expression calls reuse the C emitter's fold, so the chosen arm keeps the arguments it needs. This doesn't change the tail-call path or settle general strictness.

The original case now prints 100 through the CLI too. The new regression checks both the dropped argument and a live argument on Node, Bun and native C. Four existing JS call/closure cases and the repo gate (56/56) passed. Keeping it draft: mini test/perf, macOS and Metal/CUDA weren't run.

Reuse the native emitter’s bounded fold for JS expression calls. Keep tail dispatch unchanged.

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

Labels

None yet

Projects

None yet

1 participant