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

@@ -0,0 +1,11 @@
//ww:error "redeclared in same scope"
// A duplicate name within one destructure pattern; the old TODO(#11)
// silent-accept rested on a stale premise (resolvewalk has block
// scopes since #53). Bindings live in a per-LOOP scope, so sequential
// same-name loops stay legal.
package main;
export fn main() i32 = {
let s: [](i64, i64) = alloc([], 1u64)!;
for (let (a, a) .. s) { };
return 0;
};