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:
@@ -1677,10 +1677,10 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C
|
||||
if (self.reflectionTypeArgGuard(name, c)) |sentinel| return sentinel;
|
||||
|
||||
if (std.mem.eql(u8, name, "declare")) {
|
||||
// Comptime type-construction primitive (REIFY floor): mint an empty
|
||||
// nominal slot. Comptime-only — emitted as a builtin_call the interp
|
||||
// executes against its `mint` table; never reaches codegen (reify and
|
||||
// friends, which call it, are only ever comptime-evaluated).
|
||||
// Comptime type-construction primitive: mint an empty nominal slot.
|
||||
// Comptime-only — emitted as a builtin_call the interp executes against
|
||||
// its `mint` table; never reaches codegen (its sx callers are only ever
|
||||
// comptime-evaluated).
|
||||
if (c.args.len != 0) {
|
||||
if (self.diagnostics) |d| d.addFmt(.err, c.callee.span, "declare() takes no arguments", .{});
|
||||
return Ref.none;
|
||||
@@ -1688,8 +1688,8 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C
|
||||
return self.builder.callBuiltin(.declare, &.{}, .any);
|
||||
}
|
||||
if (std.mem.eql(u8, name, "define")) {
|
||||
// Comptime type-construction primitive (REIFY floor): complete a
|
||||
// declare()'d slot from a TypeInfo value. `define(handle, info)`.
|
||||
// Comptime type-construction primitive: complete a declare()'d slot
|
||||
// from a TypeInfo value. `define(handle, info)`.
|
||||
if (c.args.len != 2) {
|
||||
if (self.diagnostics) |d| d.addFmt(.err, c.callee.span, "define(handle, info) takes exactly two arguments", .{});
|
||||
return Ref.none;
|
||||
@@ -1700,13 +1700,13 @@ pub fn tryLowerReflectionCall(self: *Lowering, name: []const u8, c: *const ast.C
|
||||
return self.builder.callBuiltin(.define, args_owned, .void);
|
||||
}
|
||||
if (std.mem.eql(u8, name, "type_info")) {
|
||||
// Comptime reflection-into-data (REIFY). Until the interpreter-side
|
||||
// reflection lands (Phase 2), bail loudly rather than fall through to
|
||||
// the no-body `#builtin` const_decl path (which would mis-lower as a
|
||||
// zero-arg call). A silent fall-through would hand the caller a
|
||||
// garbage TypeInfo value.
|
||||
// Comptime reflection-into-data (reflect a type INTO a `TypeInfo`
|
||||
// value). Until the interpreter-side reflection lands, bail loudly
|
||||
// rather than fall through to the no-body `#builtin` const_decl path
|
||||
// (which would mis-lower as a zero-arg call). A silent fall-through
|
||||
// would hand the caller a garbage TypeInfo value.
|
||||
if (self.diagnostics) |d|
|
||||
d.addFmt(.err, c.callee.span, "type_info is not yet implemented (REIFY Phase 2)", .{});
|
||||
d.addFmt(.err, c.callee.span, "type_info is not yet implemented", .{});
|
||||
return Ref.none;
|
||||
}
|
||||
if (std.mem.eql(u8, name, "size_of")) {
|
||||
|
||||
Reference in New Issue
Block a user