wcc: forrange bindings get a per-loop scope; dup binders reject

The TODO(#11) silent-accept of `for (let (a, a) .. xs)` rested on a
stale premise -- resolvewalk has per-block scopes since #53 and IS
the live w6c_ww checker pass. Bindings now install in a per-LOOP
scope (the N_MCASE pattern), so a duplicate name within one pattern
errs "redeclared in same scope" (cstage parity via stamptuplebinds'
scopedefine-nil check) while sequential same-name loops stay legal.
kwtab restores its stated alphabetical order (`import` before `is`,
both stages, kinds swapped in lockstep with names).
This commit is contained in:
2026-08-09 01:59:33 +09:00
parent 411515a83b
commit 999b110001
5 changed files with 45 additions and 20 deletions

View File

@@ -24,8 +24,8 @@ static const struct kwent kwtab[] = {
{ "fn", TK_FN },
{ "for", TK_FOR },
{ "if", TK_IF },
{ "is", TK_IS },
{ "import", TK_USE },
{ "is", TK_IS },
{ "let", TK_LET },
{ "match", TK_MATCH },
{ "nil", TK_NIL },