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:
11
test/wcc/data/forrange_dup_binder_reject/case.ww
Normal file
11
test/wcc/data/forrange_dup_binder_reject/case.ww
Normal 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;
|
||||
};
|
||||
Reference in New Issue
Block a user