fix(c): an inferred enum member takes its owner's prefix - #3621
Merged
Merged
Conversation
The C backend wrote `.POS` (a member spelled without its type) as the bare constant `POS`, which the generated header never declares; it declares `TRIT_POS`. A switch case label naming a bare member had the same defect. `Type.member` and `Type::member` were already routed; this was the third spelling of the same rule. The owner is taken only when exactly one enum in the module declares the member. When two do, the name is left alone rather than guessed. Numeric case labels are untouched. Measured on 945 specs with Apple clang 21 and -ferror-limit=0, master 2ef6c2a -> this change: total errors 12721 -> 11704 (-1017) bare POS/NEG/ZERO 788 -> 0 clean units 340 -> 341 files better / worse 19 / 0 Classes that rose (+27 in all) are diagnostics clang could not reach while the identifier was undeclared. Every one sits in a file whose total fell. A mutant deleting the numeric-label branch survives. For a decimal label to_uppercase() is the identity, and for a hex one it yields the same C value. That is recorded in the NOW entry, not claimed as covered. Bookkeeping in this commit: FROZEN_HASH updated; 19 specs resealed (40 seal files), with 0 stale on master before this change and 0 after it; the corpus pin re-blessed, which also absorbs drift already present on master (the pin had 651 specs / 10802 errors against 945 / 12721). The census gate passes. cargo test --release: 3573 passed, 0 failed. Closes #3620 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
September 14, 2026 13:12
Contributor
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
gHashTag
pushed a commit
that referenced
this pull request
Sep 14, 2026
Conflicts were in FROZEN_HASH and in the server-http seals. compiler.rs merged cleanly with #3621. Master's seals were taken and FROZEN_HASH recomputed from the merged source. With the merged binary, check_seal_currency --stale-specs lists exactly one spec out of 945, specs/server/http.t27. It was resealed and the check now lists 0. The NOW entry is re-dated because the required freshness gate accepts only yesterday..tomorrow UTC. The 650-spec rustc measurement in the PR predates this update and was not repeated. cargo test --release: 3573 passed, 0 failed. The census gate passes. Refs #3364 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 #3620
The C backend wrote
.POS(an enum member spelled without its type) as the bare constantPOS. The generated header never declaresPOS; it declaresTRIT_POS. A switch case label naming a bare member had the same defect.Type.memberandType::memberwere already routed, so this is the third spelling of the same rule.Rule: a member gets its owner's prefix only when exactly one enum in the module declares it. If two enums declare it, the name is left alone and nothing is guessed. Numeric case labels are untouched.
Measured on 945 specs with Apple clang 21 and
-ferror-limit=0, master 2ef6c2a → this branch:POS/NEG/ZEROFour diagnostic classes rose, by 27 in all (the largest is
member reference base type … is not a structure or union, +18). Clang could not reach these diagnostics while the identifier was undeclared. Every one is in a file whose total fell.Not covered: a mutant that deletes the numeric-label branch survives the tests. For a decimal label
to_uppercase()is the identity, and a hex label keeps the same C value. The corpus count of such labels was not measured.In the same commit:
FROZEN_HASHcheck_seal_currency --stale-specslisted 0 stale on master before this change and lists 0 after it.tri census pin --gatepasses.cargo test --release: 3573 passed, 0 failed.🤖 Generated with Claude Code