lock(reify): meta.sx surface + bodyless #builtin decls + loud bails
REIFY Phase 0.0. Add the comptime type-metaprogramming surface as the
on-demand module modules/std/meta.sx (NOT the prelude — declaring its
data types in always-loaded core.sx interns them into every module's
type table and shifts every .ir snapshot):
- EnumVariant / EnumInfo / TypeInfo data types. TypeInfo's variant uses
the backtick raw escape `enum so it reads as the keyword.
- reify / type_info / field_type as bodyless #builtin decls.
Each builtin bails LOUDLY when reached unimplemented (no silent default):
- reify(...) in a :: type-alias position -> decl.zig .call branch
(also the Phase 0.2 construction hook); poisons the alias .unresolved.
- reify / field_type in any other type position ->
generic.zig resolveTypeCallWithBindings.
- type_info(...) in expression position -> call.zig tryLowerReflectionCall.
Unit test src/parser.test.zig (registered in root.zig) locks that the
decls parse. zig build test green (447 unit, 669 examples).
This commit is contained in:
@@ -31,6 +31,11 @@ field_value_int :: ($T: Type, idx: i64) -> i64 #builtin;
|
||||
field_index :: ($T: Type, val: T) -> i64 #builtin;
|
||||
error_tag_name :: (e: $T) -> string #builtin;
|
||||
|
||||
// Comptime type metaprogramming (`type_info` / `reify` / `field_type`) lives in
|
||||
// the on-demand `modules/std/meta.sx`, NOT here — declaring its data types in
|
||||
// the always-loaded prelude would intern them into every module's type table
|
||||
// and shift every `.ir` snapshot. Import `modules/std/meta.sx` to use reify.
|
||||
|
||||
// Call-site location, synthesized by the `#caller_location` directive when it
|
||||
// is a parameter's default value (ERR E4.1b). `process.exit` / `assert` use it
|
||||
// to report where they were invoked.
|
||||
|
||||
Reference in New Issue
Block a user