docs+rename: erase the reify name everywhere — stream is METATYPE
The compiler concept is declare/define (comptime type construction); the old "reify" framing is gone from the entire repo. - Rename: PLAN-REIFY → PLAN-METATYPE, CHECKPOINT-REIFY → CHECKPOINT-METATYPE, PLAN-POST-REIFY → PLAN-POST-METATYPE (both rewritten around declare/define); examples 0614/0615/0617 → comptime-metatype-* (+ their expected/ triplets), headers rewritten. - Scrub reify from design/execution-evolution-roadmap.md (§7 step 3 contracts, §8.1, §9 decisions, §10 gates) → declare/define / comptime type construction. - core.sx prelude pointer + parser.test.zig surface lock updated to the declare/define builtins (define(handle, info) -> Type; EnumInfo.name). No behavior change; renamed examples match their renamed snapshots. Full suite green (673), all unit tests pass. Zero `reify` tokens remain in src/docs/sx/examples.
This commit is contained in:
@@ -6,12 +6,11 @@ const ast = @import("ast.zig");
|
||||
const Node = ast.Node;
|
||||
const Parser = @import("parser.zig").Parser;
|
||||
|
||||
// REIFY Phase 0.0 (lock): the comptime type-metaprogramming surface added to
|
||||
// `library/modules/std/meta.sx` must PARSE — the data types as struct/enum
|
||||
// decls, and `reify`/`type_info`/`field_type` as bodyless `#builtin` consts.
|
||||
// This locks the declared shape before the interpreter-side construction lands
|
||||
// (Phase 0.2). Mirrors the exact spellings in meta.sx.
|
||||
test "parser: reify TypeInfo data types + #builtin decls parse" {
|
||||
// Lock: the comptime type-metaprogramming surface in `library/modules/std/meta.sx`
|
||||
// must PARSE — the data types as struct/enum decls, and the four comptime builtins
|
||||
// (`declare` / `define` / `type_info` / `field_type`) as bodyless `#builtin`
|
||||
// consts. Mirrors the exact spellings in meta.sx.
|
||||
test "parser: comptime type-metaprogramming surface parses" {
|
||||
var arena = std.heap.ArenaAllocator.init(std.testing.allocator);
|
||||
defer arena.deinit();
|
||||
const alloc = arena.allocator();
|
||||
@@ -22,12 +21,14 @@ test "parser: reify TypeInfo data types + #builtin decls parse" {
|
||||
\\ payload: Type;
|
||||
\\}
|
||||
\\EnumInfo :: struct {
|
||||
\\ name: string;
|
||||
\\ variants: []EnumVariant;
|
||||
\\}
|
||||
\\TypeInfo :: enum {
|
||||
\\ `enum: EnumInfo;
|
||||
\\}
|
||||
\\reify :: (info: TypeInfo) -> Type #builtin;
|
||||
\\declare :: () -> Type #builtin;
|
||||
\\define :: (handle: Type, info: TypeInfo) -> Type #builtin;
|
||||
\\type_info :: ($T: Type) -> TypeInfo #builtin;
|
||||
\\field_type :: ($T: Type, idx: i64) -> Type #builtin;
|
||||
\\
|
||||
@@ -37,12 +38,12 @@ test "parser: reify TypeInfo data types + #builtin decls parse" {
|
||||
|
||||
try std.testing.expect(root.data == .root);
|
||||
const decls = root.data.root.decls;
|
||||
try std.testing.expectEqual(@as(usize, 6), decls.len);
|
||||
try std.testing.expectEqual(@as(usize, 7), decls.len);
|
||||
|
||||
const Found = struct {
|
||||
// A top-level `Name :: struct/enum {…}` parses to a `.struct_decl` /
|
||||
// `.enum_decl` node DIRECTLY (not wrapped in a const_decl); only the
|
||||
// `#builtin` forms are `.const_decl`. Match on the shared `declName`.
|
||||
// `#builtin` forms are `.fn_decl`. Match on the shared `declName`.
|
||||
fn byName(ds: []const *Node, name: []const u8) ?*const Node {
|
||||
for (ds) |d| {
|
||||
if (d.data.declName()) |n| {
|
||||
@@ -70,7 +71,7 @@ test "parser: reify TypeInfo data types + #builtin decls parse" {
|
||||
// Builtins: the `(params) -> Ret #builtin;` form parses as a `.fn_decl`
|
||||
// (the `->` triggers the function-def path) whose body is a `#builtin`
|
||||
// marker — same shape as the existing reflection builtins in core.sx.
|
||||
for ([_][]const u8{ "reify", "type_info", "field_type" }) |bn| {
|
||||
for ([_][]const u8{ "declare", "define", "type_info", "field_type" }) |bn| {
|
||||
const d = Found.byName(decls, bn) orelse return error.MissingDecl;
|
||||
try std.testing.expect(d.data == .fn_decl);
|
||||
try std.testing.expect(d.data.fn_decl.body.data == .builtin_expr);
|
||||
|
||||
Reference in New Issue
Block a user