Skip to content

gen-c: an enum member is a constant, not a field access - #3468

Merged
gHashTag merged 1 commit into
masterfrom
c/trit-family
Sep 8, 2026
Merged

gen-c: an enum member is a constant, not a field access#3468
gHashTag merged 1 commit into
masterfrom
c/trit-family

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Closes #3467

var t = Trit.pos;   →   __auto_type t = Trit.pos;
error: unexpected type name 'Trit': expected expression

C has no Type.member. The constant gen_c_enum has been emitting all along
is TRIT_POS — the type and the member, both upper-cased — and the use
site never learned to spell it that way.

Only C is wrong

backend emits
gen-rust Trit::pos correct
gen-zig Trit.pos correct for Zig
gen-c Trit.pos not C

Measured — -ferror-limit=0

before after
errors 14040 13340
unexpected type name 'Trit' 642 12
files better / worse 15 / 0

vsa/ops 569 → 99 · jones_topology_decision_gate 106 → 40 · fpga/mac
84 → 25. The largest single repair this campaign has made — and the family
was found only because the previous pass stopped re-counting one class and
ranked them all.

The measurement came first and earned the code: printing the sites by shape
showed 604 distinct lines all of one form, which is what made a single
rewrite plausible before it was written.

Half the family is a different defect, and is filed as such

use of undeclared identifier 'POS' (412) and 'NEG' (319) are unchanged
— 731 errors over 422 lines, in (a == NEG) ? … shapes. Those bare names
appear nowhere in the specs: the compiler's own lowering introduces them
without the type prefix. Same symptom family, different repair.

A mutant survived on a guard that looked decorative

Keying the rewrite on either side — the member's name or the base's —
passed every test, because no test had a member whose name was also an enum
type.

enum Colour { red, green }
struct S { Colour : i32, }
fn f(s: S) -> i32 { return s.Colour; }

s.Colour must stay a field access. Added; the mutant dies.

mutant dead tests
enum set never matches 3
keyed on the member name 0 → 1 after the collision test
case not normalised 3

Full suite: 2652 passed, 0 failed. 17 seals refreshed in the same commit.

Closes #3467

    enum Trit { pos, neg, zero }
    var t = Trit.pos;
    __auto_type t = Trit.pos;
    error: unexpected type name 'Trit': expected expression

C has no `Type.member`. The constant `gen_c_enum` emits is `TRIT_POS` -- the
type and the member, both upper-cased -- and the use site never learned to
spell it that way. The declaration and the use had two spellings and nothing
brought them together.

Only C is wrong. `gen-rust` emits `Trit::pos` and `gen-zig` emits `Trit.pos`,
each correct for its language: three backends agree and one had no answer,
which is the shape of every repair in this campaign.

MEASURED, whole corpus, -ferror-limit=0:

    errors                          14040 -> 13340
    unexpected type name 'Trit'       642 ->    12
    files better / worse               15 / 0

`vsa/ops` 569 -> 99, `demos/jones_topology_decision_gate` 106 -> 40,
`fpga/mac` 84 -> 25.

THE MEASUREMENT CAME FIRST AND EARNED THE CODE. Printing the sites by shape
showed 604 distinct lines all of one form, which is what made a single rewrite
plausible before it was written. The family itself was found only because the
previous pass stopped re-counting one class and ranked them all.

HALF THE FAMILY IS A DIFFERENT DEFECT and is filed rather than assumed fixed.
`use of undeclared identifier 'POS'` (412) and `'NEG'` (319) are unchanged --
731 errors over 422 lines, in `(a == NEG) ? ...` shapes. Those bare names
appear NOWHERE in the specs: the compiler's own lowering introduces them
without the type prefix.

A MUTANT SURVIVED ON A GUARD THAT LOOKED DECORATIVE. Keying the rewrite on
either side -- the member's name OR the base's -- passed every test, because
no test had a member whose name was also an enum type. `struct S { Colour :
i32 }` beside `enum Colour` is that case, and `s.Colour` must stay a field
access. Added; the mutant dies. Three others were already dead.

17 seals refreshed in the same commit.

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

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-08 07:35:12 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 13
PRs with All Checks Green 3
READY 2
FAILING 13
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=c109ae58ae20 != 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 enabled auto-merge (squash) September 8, 2026 07:35
@gHashTag
gHashTag merged commit ddea3dc into master Sep 8, 2026
29 of 33 checks passed
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.

gen-c: an enum member reaches C as Type.member — 1373 errors, the corpus's largest family

1 participant