wcc: name-bind the size type in type position (#85 fold-2)

Resolve `size` -> TY_SIZE at the type-name resolver (C lookup_builtin /
ww tinfofornode's N_TNAME chain), mirroring uintptr, both stages. This
makes `size` writable as a type (`let x: size`, struct field, etc.),
the prerequisite for lib/types SIZE_MAX.

Twins every NAME-keyed uintptr arm in the wwstage so it behaves like
the cstage's kind-keyed Type switches (already TY_SIZE-aware from
fold-1): primtypesize + astalign (8B/8-align), primsize + letscalarprim
(8B scalar slot), isinttypeast + isnumerictname (int/numeric). rule-10
symmetric; dead on the size-free selfhost corpus so 990-997 stay byte-id.

Coexists with the size(T) size-of operator (separate c.top SK_FN seed +
N_CALL fold, NOT a type path) and `.size` field access (N_DOT); neither
touched. No c.top SK_TYPE "size" seed (would collide with the operator
seed at check.ww:96). Regenerates w6c/wwdump combined.ww (checker
embedded). New probe 957_size_type_run exercises type-position `size`
and the operator in one scope.
This commit is contained in:
2026-05-26 01:55:54 +09:00
parent bd7181ae1f
commit 9a265a31f5
8 changed files with 164 additions and 6 deletions

View File

@@ -49,6 +49,7 @@ lookup_builtin(const char *name)
if (strcmp(name, "int") == 0) return ty_int;
if (strcmp(name, "uint") == 0) return ty_uint;
if (strcmp(name, "uintptr") == 0) return ty_uintptr;
if (strcmp(name, "size") == 0) return ty_size; /* #85 fold-2 */
if (strcmp(name, "f32") == 0) return ty_f32;
if (strcmp(name, "f64") == 0) return ty_f64;
if (strcmp(name, "str") == 0) return ty_str;