green(reify): declare/define floor — reify is sx; E :: reify(...) comptime-evaluated

First slice of the re-architecture. The compiler gains two comptime
type-construction builtins — declare() (mint an empty/undefined nominal
slot) and define(handle, info) (decode a TypeInfo VALUE + complete the
slot) — executed by the interpreter against a new `mint` TypeTable handle
(setMintTable). reify becomes PLAIN sx in meta.sx:
  reify :: (info) -> Type { h := declare(); define(h, info); return h; }

`E :: f(...)` where f is a non-generic Type-returning fn (reify, and later
make_enum) is now comptime-evaluated via evalComptimeTypeNamed: wrap the
call in a throwaway comptime fn, run it through the interp with the mint
table enabled so declare/define mint the type, read back the type_tag, and
rename the anonymous slot to the binding name. The compiler has ZERO reify
knowledge at the decl site — the old `E :: reify` hook is deleted.

examples/0614 (inline reify) now runs on this floor. Full suite green (673).

INTERMEDIATE: reifyType + findReturnReifyCall still serve the type-fn path
(0615/0617) and will be deleted in the next slice (type-fn body
comptime-eval), after which the compiler has no reify code at all.
This commit is contained in:
agra
2026-06-16 20:39:02 +03:00
parent ae27cffe9d
commit 442a70b8c9
7 changed files with 241 additions and 14 deletions

View File

@@ -449,6 +449,17 @@ 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.
declare,
define,
};
pub const CompilerCall = struct {