Skip to content

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

Description

@gHashTag

What

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 for that member 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

The same shape as every repair in this campaign: three backends agree and one has no answer.

Population

1373 errors — the largest family in the generated corpus, found only when the classes were finally ranked (#3466). Concentrated in 12 files: vsa/ops 526, base/ops 351, base/types 288, base/ternary_add 125.

Measured

before after
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.

What this does NOT fix, and it is half the family

use of undeclared identifier 'POS' (412) and 'NEG' (319) are unchanged — 731 errors across 422 distinct lines, in (a == NEG) ? … : (b == POS) ? … shapes. The bare names appear nowhere in the specs: they are introduced by the compiler's own lowering, which emits the variant without its type prefix. Same family, different position, and a separate defect.

Filed together because the ranking found them together, and separated here because they are not the same repair.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions