Skip to content

fix(comp): rewrite imported C effect guards (#2366) - #2378

Open
bjw-0 wants to merge 2 commits into
bendlang:mainfrom
bjw-0:brian/2366-imported-effect-c-guards
Open

bjw-0 wants to merge 2 commits into
bendlang:mainfrom
bjw-0:brian/2366-imported-effect-c-guards

Conversation

@bjw-0

@bjw-0 bjw-0 commented Dec 4, 2026 •

Copy link
Copy Markdown

Fixes #2366.

Imported C effect files already rewrite CID(x) and FID(x) references, but macro names in preprocessor guards bypass that pass. The guard could compile away registration under the importing module's namespace, leaving the runtime with an alien request.

Rewrite guarded CID_x and FID_x names for imported C sources when the imported module defines the name. Same-module sources, unknown names, and JavaScript output are unchanged.

Added an I/O fixture with an imported C effect. It exercises #ifdef, #ifndef, #if, and #elif guards for CID_answer.

Verification

  • Reproduced the failure on base 7ac3ae5: compilation succeeded, then the program exited with bend: an alien request.
  • The patched C and JS CLI runs both print 42.
  • bun gates/repo.ts: PASS 56/56; comp.ts is 65,987 tokens of the 66,000 cap.
  • git diff --check passes.

The full distributed test gate was not run locally.

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.

An imported effect whose C file guards its registration with #ifdef CID_x never registers

1 participant