green(reify): implement reify(.enum) — mint a flat enum from TypeInfo

REIFY Phase 0.2 (Phase 0 complete). Lowering.reifyType (lower/nominal.zig)
reads the flat-enum TypeInfo literal off the AST, synthesizes an
ast.EnumDecl, and feeds it through the SAME type_bridge.buildEnumInfo
path source enums use — so the minted type is byte-identical to a
hand-written `enum { value: i64; closed; }` and flows through enum
codegen (layout / construct / match) UNMODIFIED (Contract 2).

Wired at the `E :: reify(...)` const-decl hook in lower/decl.zig
(replacing the Phase-0.0 loud bail). Unsupported argument shapes bail
loudly via reifyBail — never a silent default. The generic.zig inline
reify path now reports it's only supported in a `::` binding (Phase 0).

examples/0614 green: reify a {value: i64, closed} enum, construct
.value(3) and .closed, match both -> "value 3" / "closed". Full suite
green (670 examples, 447 unit).
This commit is contained in:
agra
2026-06-16 18:32:05 +03:00
parent b25a2f60d6
commit 353109206b
10 changed files with 155 additions and 30 deletions

View File

@@ -1219,15 +1219,14 @@ pub fn resolveTypeCallWithBindings(self: *Lowering, cl: *const ast.Call) TypeId
.field_access => |fa| fa.field,
else => return .unresolved,
};
// Comptime type-construction builtins (REIFY). `reify`/`field_type`
// appear in type position (`E :: reify(...)`, `field_type(T, i)` as a
// type arg). Until the interpreter-side construction lands (Phase 0.2 /
// Phase 2), bail LOUDLY rather than fall through to the misleading
// "unknown type 'reify'" diagnostic below — a silent default here would
// poison every downstream use of the type.
// Comptime type-construction builtins (REIFY). `reify` is minted in a
// `::` type-binding position by `decl.zig` (`E :: reify(...)`); reaching it
// HERE means an inline type position (`x : reify(...)`, a nested type arg),
// which Phase 0 does not support — bail LOUDLY rather than fall through to
// the misleading "unknown type 'reify'" diagnostic below.
if (std.mem.eql(u8, callee_name, "reify")) {
if (self.diagnostics) |d|
d.addFmt(.err, cl.callee.span, "reify is not yet implemented (REIFY Phase 0.2)", .{});
d.addFmt(.err, cl.callee.span, "reify is only supported in a `::` type binding (e.g. `E :: reify(...)`) in Phase 0", .{});
return .unresolved;
}
if (std.mem.eql(u8, callee_name, "field_type")) {