green(reify): type-fn bodies comptime-evaluated; reify fully removed from the compiler

Second slice of the re-architecture — the compiler now has ZERO type-
construction code beyond declare/define.

- instantiateTypeFunction: a type-fn body returning a computed Type (a call
  to a non-generic, bodied, Type-returning fn) is comptime-evaluated with the
  type bindings active, then renamed to the mangled instantiation name for
  identity (renameNominalType). Replaces the old reify-call pattern-matching.
- DELETED: reifyType (lower/nominal.zig), findReturnReifyCall (lower/generic.zig),
  and the stale inline-position reify gate in resolveTypeCallWithBindings.
- evalComptimeType (was evalComptimeTypeNamed): pure eval, no rename; the
  type-fn caller renames explicitly. renameReifiedType → renameNominalType.
- The TYPE NAME now travels in the data: EnumInfo gains `name`, and define()
  names the slot from it (the compiler derives no name from a binding LHS).
  examples/0614/0615 carry `name = "..."`; RecvResult/TryResult set it too.
- field_type stays a reflection #builtin (reads a type); only construction
  moved out. All reify mentions stripped from compiler source.

examples 0614/0615/0617 run on the floor. Full suite green (673).
This commit is contained in:
agra
2026-06-16 21:03:16 +03:00
parent 442a70b8c9
commit 8ae655687a
11 changed files with 112 additions and 194 deletions

View File

@@ -449,15 +449,16 @@ pub const BuiltinId = enum(u16) {
type_eq,
type_is_unsigned,
has_impl,
// Comptime type CONSTRUCTION (REIFY floor). The compiler's ONLY
// type-minting primitives — `reify` / `make_enum` / `RecvResult` etc.
// are sx in `meta.sx`, built over these. Both are comptime-only (the
// interp mutates the type table via its `mint` handle); reaching them
// at runtime / emit is a hard error.
// declare() → mint an EMPTY (undefined) nominal slot, return
// it as a `Type` value. Using the slot before
// `define` is a loud diagnostic (F5).
// define(handle, info) → decode the `TypeInfo` VALUE + complete the slot.
// The compiler's ONLY comptime type-CONSTRUCTION primitives. Higher-level
// constructors (one-shot, channel-result, etc.) are ordinary sx built over
// these — the compiler knows none of them by name. Both are comptime-only
// (the interp mutates the type table via its
// `mint` handle); reaching them at runtime / emit is a hard error.
// declare() → mint an EMPTY (undefined) nominal slot, returned
// as a `Type` value. Using the slot before its
// `define` is a loud diagnostic.
// define(handle, info) → decode the `TypeInfo` VALUE (the name travels in
// it) and complete the slot.
declare,
define,
};