green: erase the sx reify sugar — declare/define are the only constructors

Per the directive to strip reify entirely: the sx `reify(info)` one-shot is
removed. `define(handle, info)` now RETURNS the (completed) handle, so the
one-shot constructor chains as a single expression:
    T :: define(declare(), .enum(.{ name = "T", variants = ... }));

- meta.sx: drop reify; RecvResult/TryResult use `define(declare(), …)`.
- interp .define returns the handle type_tag (was void); call.zig lowers it
  with `Type` result and sets the info arg's target type to TypeInfo so the
  intercepted call still infers the `.enum(…)` literal.
- returnExprMintsType: a type-fn body that returns `define(…)` (or a bodied
  non-generic Type-returning sx helper) is comptime-evaluated.
- examples 0614 (direct) + 0615 (type-fn) use `define(declare(), …)`.

Full suite green (673). Files/docs still carry the old reify naming — the
rename sweep is the next commit.
This commit is contained in:
agra
2026-06-16 21:12:32 +03:00
parent 8ae655687a
commit 5f2419854e
6 changed files with 58 additions and 44 deletions

View File

@@ -1695,9 +1695,18 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C
return Ref.none;
}
const handle_ref = self.lowerExpr(c.args[0]);
// Lower the info arg with `TypeInfo` as the target type so its `.enum(…)`
// enum-literal infers correctly (we intercept the call, bypassing the
// normal param-type-threading the regular call path does).
const saved_tt = self.target_type;
if (self.module.types.findByName(self.module.types.internString("TypeInfo"))) |ti|
self.target_type = ti;
const info_ref = self.lowerExpr(c.args[1]);
self.target_type = saved_tt;
const args_owned = self.alloc.dupe(Ref, &.{ handle_ref, info_ref }) catch return Ref.none;
return self.builder.callBuiltin(.define, args_owned, .void);
// define returns the (now-completed) handle as a `Type` value, so the
// one-shot constructor form chains: `T :: define(declare(), info)`.
return self.builder.callBuiltin(.define, args_owned, .any);
}
if (std.mem.eql(u8, name, "type_info")) {
// Comptime reflection-into-data (reflect a type INTO a `TypeInfo`