Repository navigation
t27c: a spliced use becomes a comment, and @builtin is not a reference (Closes #7281, Closes #7292) - #7322
Merged
Conversation
#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>
gHashTag
enabled auto-merge (squash)
October 7, 2026 06:43
This was referenced Oct 7, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #7281
Closes #7292
Refs #7176 #7191
Two fixes to the
useresolver inbootstrap/src/use_resolve.rs, which is already listed intools/policy/foreign-exceptions.txt.#7281: a
usewhose items the splice declared becomes a commentThe resolver splices each item that
use a::b::Item;names, but it left theuseline in place. When the body readsItem.x, the Zig backend lowers thatuseas an import, so it wroteconst Trit = @import("Trit.zig");next to the splicedTrit, and zig stopped with "duplicate struct member name".// use a::b::E; -- E spliced below by t27c (#7281).use, an alias and an undeclared item stay as they were.Lab A/B, the #7242 tree with and without the change, 1484
.t27files x gen, gen-c, gen-rust, gen-verilog and typecheck:// use X: no references in this modulecomment, 29 lines in all.#7292: a builtin call
@pow(...)is not a read ofpowThe resolver read the token after
@as an identifier. A spec that called@powand importedmath::constantstherefore got that module's ownpow,floor,exp_approx,ln_approxandEspliced 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:
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
@abswritten into C verbatim, is gen-c: real Zig builtins (@abs, @intFromEnum, @min, ...) reach the C verbatim -- 85 of 1362 outputs, 769 sites #7297.Both touch
compiler.rsand are owner-only.🤖 Generated with Claude Code