From c573e4befb3dcdbb9376643214cd01f06689b34f Mon Sep 17 00:00:00 2001 From: agra Date: Wed, 17 Jun 2026 05:27:17 +0300 Subject: [PATCH] docs(metatype): duplicate-variant validation done; tidy Next step list --- current/CHECKPOINT-METATYPE.md | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/current/CHECKPOINT-METATYPE.md b/current/CHECKPOINT-METATYPE.md index 9f59c134..66badfb8 100644 --- a/current/CHECKPOINT-METATYPE.md +++ b/current/CHECKPOINT-METATYPE.md @@ -93,8 +93,9 @@ Pick any (independent): add `` .`struct ``/`` .`tuple `` to the `TypeInfo` enum in `meta.sx`, teach `reflectTypeInfo` to build them, and teach `defineEnum` (→ a `defineType`) to decode them. Round-trips a struct through `define` once it lands. -- **Validation + loud diagnostics** (remaining) — duplicate variant names, a - `declare()` never `define()`d (hard error at end of comptime), use-before-define. +- **Validation + loud diagnostics** (remaining) — ~~duplicate variant names~~ DONE + (`define` bails naming the dup; `examples/1180`). Still pending: a `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). Remaining adjacent @@ -114,13 +115,6 @@ capabilities would let the variant list be built more freely; both error cleanly before the return is unresolved. Workaround: build the list inline in the return, or use a non-generic `() -> Type` builder (whose whole body is evaluated — this is what `examples/0620` uses). Probe `.sx-tmp/probe_me5.sx`. -- **Widen `type_info` / `TypeInfo` past `` `enum ``** — struct/tuple variants: - add `` .`struct ``/`` .`tuple `` to the `TypeInfo` enum in `meta.sx`, teach - `reflectTypeInfo` to build them, and teach `defineEnum` (→ a `defineType`) to - decode them. Round-trips a struct through `define` once it lands. -- **Validation + loud diagnostics** (remaining) — duplicate variant names, a - `declare()` never `define()`d (hard error), use-before-define. (By-value - self-reference already rejected — issue 0139.) ## Known issues - issue 0140 — comptime type-construction bail panicked instead of diagnosing — @@ -134,6 +128,10 @@ capabilities would let the variant list be built more freely; both error cleanly `examples/1178` locks it). ## Log +- **Duplicate variant-name validation.** Two same-named variants in a constructed + enum used to silently succeed (ambiguous construction/match). `defineEnum` now + bails naming the duplicate; `evalComptimeType` renders it (post-0140). + `examples/1180` locks it. Suite green (680). - **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.