diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 2e71683d..9f59c134 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -97,12 +97,15 @@ Pick any (independent): `declare()` never `define()`d (hard error at end of comptime), use-before-define. ### make_enum follow-ups (deferred capability gaps — NOT crashes; clean diagnostics) -`make_enum` itself is DONE (see Last completed step). Two adjacent capabilities -would let the variant list be built more freely; both currently error cleanly +`make_enum` itself is DONE (see Last completed step). Remaining adjacent +capabilities would let the variant list be built more freely; both error cleanly (post-0140) rather than crash, so they're enhancements, not blockers: -- **Comptime slice over a non-string aggregate.** `arr[..]` over a `[]EnumVariant` - array bails — the interp's `.subslice` op (`interp.zig:~1235`) only supports - STRING bases. Needed for `vs[..]`-style construction. Probe `.sx-tmp/probe_me2.sx`. +- ~~Comptime slice over a non-string aggregate~~ — DONE. `arr[lo..hi]` over a + `[]EnumVariant` array now yields a real slice value at comptime (was: bailed, + string-only). Fix threaded `base_ty` onto the `Subslice` op so the interp tells + an array from a `{ptr,len}` slice, folded open-ended `hi` to a fixed array's + static length at lower time (no runtime/.ir change), and added + `interp.zig:subsliceElements`. `examples/0621` locks it. - **Comptime `List` growth.** Building variants via `List(EnumVariant).append` at comptime bails ("struct_get: base has no fields") — the allocator/List protocol path isn't fully interp-evaluable. Probe `.sx-tmp/probe_makeenum.sx`. @@ -131,6 +134,13 @@ would let the variant list be built more freely; both currently error cleanly `examples/1178` locks it). ## Log +- **Comptime subslice over non-string aggregates.** `arr[lo..hi]` at comptime + used to bail (interp `.subslice` was string-only) and the open-ended `hi` came + from a `.length` op that misread a 2-elem array as a `{ptr,len}` fat pointer. + Fix (interp-only; runtime already correct via `LLVMTypeOf`): thread `base_ty` + onto the `Subslice` op, fold open-ended `hi` to a fixed array's static length at + lower time (no IR/.ir change), add `subsliceElements`. `examples/0621` mints an + enum from `dirs[0..2]`. Suite green (679). - **`make_enum` done.** General enum constructor `make_enum(name, variants: []EnumVariant) -> Type` in `meta.sx` (pure sx over declare/define). A non-generic builder assembles the variant list in a local, then mints from it —