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:
@@ -17,8 +17,11 @@ EnumVariant :: struct {
|
||||
payload: Type;
|
||||
}
|
||||
|
||||
// The shape of an enum/tagged-union being reflected or constructed.
|
||||
// The shape of an enum/tagged-union being reflected or constructed. `name` is
|
||||
// the type's name — it travels WITH the shape (so `define` can name the slot and
|
||||
// `type_info` round-trips it); the compiler derives nothing from a binding LHS.
|
||||
EnumInfo :: struct {
|
||||
name: string;
|
||||
variants: []EnumVariant;
|
||||
}
|
||||
|
||||
@@ -61,7 +64,7 @@ reify :: (info: TypeInfo) -> Type {
|
||||
|
||||
// A blocking recv: a value, or the channel was closed (drained).
|
||||
RecvResult :: ($T: Type) -> Type {
|
||||
return reify(.enum(.{ variants = .[
|
||||
return reify(.enum(.{ name = "RecvResult", variants = .[
|
||||
EnumVariant.{ name = "value", payload = T },
|
||||
EnumVariant.{ name = "closed", payload = void },
|
||||
] }));
|
||||
@@ -70,7 +73,7 @@ RecvResult :: ($T: Type) -> Type {
|
||||
// A non-blocking try-recv: a value, currently empty, or closed — three states
|
||||
// a bool can't express.
|
||||
TryResult :: ($T: Type) -> Type {
|
||||
return reify(.enum(.{ variants = .[
|
||||
return reify(.enum(.{ name = "TryResult", variants = .[
|
||||
EnumVariant.{ name = "value", payload = T },
|
||||
EnumVariant.{ name = "empty", payload = void },
|
||||
EnumVariant.{ name = "closed", payload = void },
|
||||
|
||||
Reference in New Issue
Block a user