wwstage: port struct embedding; graduate #59.13

The last frontend-gap pin: wwstage had no Hare struct embedding
(struct { hash.hash, ... }), rejecting lib/crypto/sha256 at parse.

- parse.ww: the three member forms (named / anonymous struct / bare
  dotted-ident embed), consume-then-branch since this parser has no
  peek; embeds carry f.str == "" and the type in f.lhs.
- check.ww N_TSTRUCT flatten: promote the inner struct's flattened
  fields at base+src.offset (check.c:961-990); the embed is one
  nested-struct unit in the slot ladder; the resolved inner AST is
  planted on the TFIELD rhs for cgen.
- check.ww walkers: astoffset / exprtype N_DOT / #251 struct-lit
  field lookups descend embeds through shared helpers; the collision
  and non-struct-embed rejects live in validatestructfields (the
  once-per-decl diagnostic site).
- cgenutil.ww registerstruct: regfieldrun walks the AST against the
  flattened tfield cursor, descending embeds via the planted inner
  AST so promoted fieldinfo entries keep the inner field's own name
  and type node.
- wwi printers unchanged (both stages already emit nameless fields).

sha256_test compiles byte-identically end to end and its 6 tests
pass; 989_lib_byteid is now 44 id / 0 divergent / 0 wwreject.
Fixtures r5913_* (promoted rw, offset shift, anonymous embed,
two-level embed + promoted fn-ptr callee, three rejects); corpus pin
1485/2970.
This commit is contained in:
2026-08-08 02:37:50 +09:00
parent 6553d60e91
commit 5abb1e6069
13 changed files with 472 additions and 95 deletions

View File

@@ -32,9 +32,9 @@ categories out of the ordinary developer target.
| Fixed point and self-host | `test-bootstrap` |
| Host linker/platform behavior | `test-platform` |
The live declarative compiler corpus has 1,478 fixtures and 2,956 C/WW cells:
335 expected rejections (311 shared and 24 stage-specific), 17 compile-only
successes, 191 exit-zero programs, and 935 explicit-exit programs.
The live declarative compiler corpus has 1,485 fixtures and 2,970 C/WW cells:
338 expected rejections (314 shared and 24 stage-specific), 17 compile-only
successes, 191 exit-zero programs, and 939 explicit-exit programs.
147 native C carriers remain. They are partitioned exactly once as five
in-process units, 24 byte/artifact gates, six bootstrap gates, one platform