Skip to content

fix(c): an inferred enum member takes its owner's prefix - #3621

Merged
gHashTag merged 1 commit into
masterfrom
c/inferred-enum-literal
Sep 14, 2026
Merged

gHashTag merged 1 commit into
masterfrom
c/inferred-enum-literal

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #3620

The C backend wrote .POS (an enum member spelled without its type) as the bare constant POS. The generated header never declares POS; it declares TRIT_POS. A switch case label naming a bare member had the same defect. Type.member and Type::member were 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:

figure before after
total errors 12721 11704
bare POS / NEG / ZERO 788 0
clean translation units 340 341
files better / worse 19 / 0

Four 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_HASH
  • 19 resealed specs (40 seal files). check_seal_currency --stale-specs listed 0 stale on master before this change and lists 0 after it.
  • The corpus pin, re-blessed. The pin was already stale on master (651 specs / 10802 errors), so the bless also absorbs that older drift.
  • The NOW entry.

tri census pin --gate passes. cargo test --release: 3573 passed, 0 failed.

🤖 Generated with Claude Code

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
gHashTag enabled auto-merge (squash) September 14, 2026 13:12
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-14 13:12:23 UTC

Summary

Status Count
Total Open PRs 17
PRs with Failing Checks 9
PRs with All Checks Green 8
READY 6
FAILING 9
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=62abdd84894b != 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).

@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@gHashTag
gHashTag merged commit 42ba2f5 into master Sep 14, 2026
32 of 33 checks passed
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>
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.

C backend: an inferred enum literal emits a bare constant the header never declares

1 participant