test: extend 708 with mlet/forrange/mcase shadow rows (#28)
708 pinned param + clet + self-import-skip after #19 landed; the other 4 sites where check_module_shadow is wired (N_MLET, N_FORRANGE single, N_FORRANGE tuple, N_MCASE) had no dedicated negative-compile row. Worker-19's note that all 6 sites use identical call shape is true today but unpinned by tests; a future asymmetric edit could silently disable enforcement on one site. Adds neg_mlet (let-tuple binder shadows), neg_forrange_single (`for shadowmod of ...`), neg_forrange_tuple (`for (shadowmod, x) of pairs`), neg_mcase (`case let shadowmod:`). Each errors at the binder decl line with the canonical "<kind> '<name>' shadows imported module '<name>'" message. 708's main now runs 8/8 (param, let, mlet, forrange_single, forrange_tuple, mcase, pos_rename, pos_selfimp).
This commit is contained in:
23
test/wcc/data/paramshadowmod/neg_mcase.ww
Normal file
23
test/wcc/data/paramshadowmod/neg_mcase.ww
Normal file
@@ -0,0 +1,23 @@
|
||||
// neg_mcase — `match (r) { case let shadowmod: i64 => ... }` where
|
||||
// the per-arm binder shadows the imported module. N_MCASE wires
|
||||
// check_module_shadow before scope_define on cs->str, so the rule
|
||||
// fires at the case line.
|
||||
|
||||
use shadowmod;
|
||||
|
||||
fn parse(n: i64) (i64 | i32) = {
|
||||
if (n < 0i64) {
|
||||
return 1i32;
|
||||
};
|
||||
return n;
|
||||
};
|
||||
|
||||
export fn main() i32 = {
|
||||
let r: (i64 | i32) = parse(42i64);
|
||||
let out: i64 = 0i64;
|
||||
match (r) {
|
||||
case let shadowmod: i64 => out = shadowmod;
|
||||
case let e: i32 => return e;
|
||||
};
|
||||
return out: i32;
|
||||
};
|
||||
Reference in New Issue
Block a user