docs(metatype): duplicate-variant validation done; tidy Next step list

This commit is contained in:
agra
2026-06-17 05:27:17 +03:00
parent e291034e46
commit c573e4befb

View File

@@ -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.