Skip to content

t27c: a spliced use becomes a comment, and @builtin is not a reference (Closes #7281, Closes #7292) - #7322

Merged
gHashTag merged 2 commits into
masterfrom
claude/use-splice-7281-land
Oct 7, 2026
Merged

gHashTag merged 2 commits into
masterfrom
claude/use-splice-7281-land

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 7, 2026

Copy link
Copy Markdown
Collaborator

Closes #7281
Closes #7292
Refs #7176 #7191

Two fixes to the use resolver in bootstrap/src/use_resolve.rs, which is already listed in tools/policy/foreign-exceptions.txt.

#7281: a use whose items the splice declared becomes a comment

The resolver splices each item that use a::b::Item; names, but it left the use line in place. When the body reads Item.x, the Zig backend lowers that use as an import, so it wrote const Trit = @import("Trit.zig"); next to the spliced Trit, and zig stopped with "duplicate struct member name".

  • The line now becomes // use a::b::E; -- E spliced below by t27c (#7281).
  • A brace list keeps the items the splice did not declare.
  • A whole-module use, an alias and an undeclared item stay as they were.
  • Each line maps to one line, so diagnostics keep the importer's line numbers.

Lab A/B, the #7242 tree with and without the change, 1484 .t27 files x gen, gen-c, gen-rust, gen-verilog and typecheck:

#7292: a builtin call @pow(...) is not a read of pow

The resolver read the token after @ as an identifier. A spec that called @pow and imported math::constants therefore got that module's own pow, floor, exp_approx, ln_approx and E spliced in as dead code. The identifier set now skips the token right after @; the call's arguments are still read.

Lab A/B, the #7281 build vs this change, 1363 specs x gen, gen-c, gen-rust, gen-verilog and typecheck:

  • No exit code or stderr changes.
  • Output changes in 7 files, removed lines only.
  • Two new tests. With the check reverted, both fail and the other 40 pass.

Gates run locally on the rebased head

dupe_scan, assertionless tests, documented commands, NOW shape (2 entries), L2 regen, own-language, gitleaks (0 leaks; negative control fires) and ASCII.

Left out

Both touch compiler.rs and are owner-only.

🤖 Generated with Claude Code

gHashTag and others added 2 commits October 7, 2026 13:42
#7281)

The resolver splices each item `use a::b::Item;` names, but left the
`use` line in place. The Zig backend lowers a `use` as an import when the
body reads `Item.x`, so it wrote `const Trit = @import("Trit.zig");`
beside the spliced `Trit` and zig stopped at "duplicate struct member
name" (bigint, hybrid_bigint and runner once #7191 names their paths).

The line now becomes `// use a::b::E; -- E spliced below by t27c (#7281)`.
A brace list keeps the items the splice did not declare. A whole-module
`use`, an alias and an undeclared item stay as they were. Each line maps
to one line, so diagnostics keep the importer's line numbers.

Lab A/B, #7242 tree with and without the change, 1484 .t27 files x gen,
gen-c, gen-rust, gen-verilog, typecheck: no exit code or stderr changes.
gen output changes in 7 files, and each changed line is a removed
`// use X: no references in this module` comment (29 lines). typecheck
stdout differs on 2 files, but that is HashMap-order warnings (#7283):
the unchanged binary flips too. With #7191's slices applied, collisions
go from 3 specs (5 names) to 0. Removing the call fails both new tests.

Refs #7176 #7191

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The use resolver read the token after `@` as an identifier, so a spec that
calls `@pow` and imports `math::constants` got that spec's own `pow`,
`floor`, `exp_approx`, `ln_approx` and `E` spliced in as dead code. The
identifier set now skips a token right after `@`; the call's arguments are
still read.

Lab A/B, #7281 build vs this change, 1363 specs x gen/gen-c/gen-rust/
gen-verilog/typecheck: no exit or stderr change; output changes in 7 files,
removed lines only. Two tests; with the check reverted both fail, 40 pass.
The gen-c side effect (it writes `@abs` into C verbatim) is #7297.

Refs #7191

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

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-07 06:50:06 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 49
PRs with All Checks Green 1
READY 0
FAILING 49
PENDING 0
NO CHECKS YET 0

These columns do not partition: 0 + 49 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b23641f01baa != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 5a3485e into master Oct 7, 2026
38 of 41 checks passed
@gHashTag
gHashTag deleted the claude/use-splice-7281-land branch October 26, 2026 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

1 participant