Skip to content

Keep the emitter inside the self-hosted subset - #801

Merged
ctate merged 1 commit into
mainfrom
ctate/keep-emitter-inside-f92972
Oct 9, 2026
Merged

ctate merged 1 commit into
mainfrom
ctate/keep-emitter-inside-f92972

Conversation

@ctate

@ctate ctate commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

The compiler can no longer compile itself on main: the bootstrap seed builds fail with SC1090: constructing through a class value whose class has no lowering at new LlEmitter(...). Two recent emitter additions use forms the self-hosted subset refuses:

  • WeakMap field. LlEmitter tracked immortal temps in a WeakMap<BlockBuilder, Set<string>> field. That field has no lowering ("'unknown'-typed class fields"), so LlEmitter itself was never lowered. The set now lives on BlockBuilder as immortalTemps, since the builder owns the temp names it holds.
  • in checks. mentionsLocal probed IR nodes with "localId" in node and "captures" in node. It now narrows by node kind: varRef, incDec, assignExpr, closure and classRef for expressions, and varDecl, assign, forOf and rethrow for statements. That is every expression and statement kind with a localId or a captures list, as listed by the type checker over IrExpr and IrStmt.

Validation: the Node-frontend compile of src/native/cli.ts now lowers fully and emits IR (it previously stopped at LlEmitter). The borrowed-receiver, virtual-borrow, string self-concat and literal-choice corpus programs pass in both differential lanes (52 programs, sanitized). The emitter, string-construction and class unit tests pass, and lint and format are clean. The bootstrap seed jobs in CI are the end-to-end check.

Separately, the only diagnostic reported was the follow-on "class has no lowering" error, not the field's own diagnostic. That will be addressed separately.

🤖 Generated with Claude Code

The compiler stopped compiling itself. Two recent emitter additions use
forms the self-hosted subset refuses:

- LlEmitter tracked immortal temps in a WeakMap field keyed by block
  builder. That field has no lowering, so LlEmitter itself was not
  lowered. The set now lives on BlockBuilder, which owns the temp names.
- mentionsLocal probed IR nodes with `"localId" in node` and
  `"captures" in node`. It now narrows by node kind, covering every
  expression and statement kind that names a local or captures one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
scriptc Ready Ready Preview, v0 Oct 9, 2026 6:33pm UTC

@ctate
ctate merged commit 2197389 into main Oct 9, 2026
70 of 77 checks passed

This branch was successfully deployed

1 active deployment
Preview — ff7d687c Deployed Oct 9, 2026 by vercel[bot]
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