Repository navigation
Zig keywords emitted as identifiers: 20 specs -> 0, across four binding sites #5157
Description
Re-filed from #2539. An attempt claimed that issue on 2026-09-24 and left an empty branch, and a dispatch row that has spent its retry ceiling keeps its issue for good - so no bee could take it again, however much the brief improved. The work below is carried over unchanged.
A spec may legitimately name a field error or a local packed. Zig reserves both and reports expected '.', found ':' on the field line. @"error" is the exact answer the language provides.
Unlike the six field types in #2393 or the [hidden_size] split in #2405, nothing here is a judgement — the keyword list is the language's, and the quoting rule is mechanical.
Four sites, found one at a time
The name is bound in four places, and fixing the obvious ones left the rest:
| site | what it missed |
|---|---|
| struct field | error: []const u8, — 20 specs |
| top-level const | |
| import binding | const opaque = @import("opaque.zig"); |
| local in a body | const packed = pack_trit(...), const error = error_create(...) |
The fourth only surfaced because the scan still reported 4 specs after the first three were wired, and following those pointed at test and function bodies. Had I stopped at "fields are fixed", the count would have read 20 → 4 and looked finished.
Keyword sites across the corpus: 20 specs → 0.
Measured
zig ast-check over 520 specs: 135 -> 135 valid, 0 regressions, 0 gains
class `expected X, found Y`: 68 -> 60
spec parse gate: 154 events / 0 blind, ratchet holds
Eight specs left that class and none became valid — the fourth consecutive fix tonight where a class shrinks and the headline does not move (#2527, #2529, #2537, and now this). The defects are layered: clearing one exposes the next on the same file.
Control: variant.t27, which uses no keyword as a name, emits zero @" — the rule fires only where it should.
Note on the module file name
Only the binding is quoted. const @"opaque" = @import("opaque.zig"); keeps the real spelling on the right, because that is a path, not an identifier.
Boundary
specs/tri/collections/variant.t27
The instruments
Every one of these reads and prints; none of them writes. Run them from the repository root, with <spec> replaced by the file in ## Boundary:
.t27 is not Rust and not Zig, and a bee fluent in either writes one by
accident. Measured 2026-09-20: a bee filled eight bodies in
specs/file/watcher.t27 with return Ok(());, Err(FileError::WatcherNotFound)
and for i in 0..watchers.length. The parse ratchet refused the whole file --
Unexpected token in expression: RParen, line 123 -- and a spec that does not
parse generates nothing, so every test it already carried stopped running.
At the top level the parser accepts exactly these eight forms, with an optional
pub, and no others:
const var fn enum struct test invariant bench
There is no trait, no impl, no type X = ..., no generics, no macro. What
a bee reaches for from another language, and what happens:
- Rust's result sugar (
Ok(()),Err(E::V),?) is not a construct here. - Rust macros (
println!,format!,vec!) are not constructs here. - A range loop (
for i in 0..n) is Rust and Zig, not this language. - Zig builtins (
catch unreachable,@intCast,@constCast) are not constructs here. - Cross-module reuse (
use other::fn;) parses and then generates a comment and an unqualified call, so the Zig fails withuse of undeclared identifier(use a::b; generates no import, so no spec can reuse a function from another spec #4298). It does not work yet.
t27c parse <spec> answers in one line whether what you wrote is the language.
Run it before you report, every time.
t27c spec-status <spec>- the compiler's one-word verdict: IMPLEMENTED, PARTIAL, UNWRITTEN, NOPARSE, NOFN. Exit code is 0 whatever it says, so read the word.t27c symbols <spec>- every name the file declares, with its kind. Answers "does this already exist here?" before you add it.t27c outline <spec>- per function: its locals, what it calls, what it returns. The contract you are implementing against.t27c coverage <spec>- which functions have a test and which do not. The issue asks for tests; this is how you check you wrote them.t27c lint <spec>- style and shape warnings. It OVER-REPORTShas no test or invariant: measured 2026-09-20 over 60 specs it printed 677 of those wherecoveragefound 190 untested functions, disagreeing on 59 of the 60 - it warns aboutbit_to_trit_pairinspecs/base/ternary_encoding.t27, whichtest bit_to_trit_pair_zerocalls on line 249. Read it as a hint;coverageis the answer.t27c typecheck <spec>- types, before generation. PrintsTypecheck OK (0 errors, 0 warnings)or the errors.t27c test-report <spec>- builds this spec and runs its own tests, which is what the oracle does.BLOCKEDmeans the generated Zig does not compile, with the error beside it.python3 tools/dupe_scan.py --name <function>- where that function already lives, if it does. 576 of 4021 bodies here are byte-identical copies.
The rest of the toolbelt is in docs/BEE_TOOLBELT.md.
Activity
gHashTag commentedon Oct 3, 2026
Done on master (3cea5b2).
zig_ident(bootstrap/src/compiler.rs:8374) quotes Zig keywords wherever a name is bound:t27c gen specs/tools/schema.t27emits@"error": str?,and a probe with a localpackedemitsconst @"packed": u8 = 3;. 3932eb6 (#4778) then added enum members as the fifth binding site, after the four listed here. The control holds:variant.t27emits zero@". Closing as done.Triage for the review jam, #5776: this card was escalated because it states no acceptance criterion the Queen can read. Reopen if this is wrong.