wcc: kind-filter type-position name resolution so a value can't shadow a same-named type (#225)

resolve_typename used the kind-blind scope_lookup_prefer, so a same-named value binding (param/let) in a closer scope hid the type it shadowed, wrongly rejecting valid Hare like 'fn f(off: off)'. wwstage already separates type/value namespaces; this aligns the cstage frontend up. New scope_lookup_type skips non-SK_TYPE syms and keeps scanning, preserving same-module preference. Byte-id-neutral: the new branch fires only on the old 'unknown type' error path.
This commit is contained in:
2026-05-31 17:00:42 +09:00
parent 2e760d070d
commit 39292b3c47
5 changed files with 306 additions and 1 deletions

View File

@@ -65,7 +65,9 @@ resolve_typename(Checker *c, Node *n)
const char *nm = n->str;
Type *bi = lookup_builtin(nm);
if (bi) return bi;
Sym *s = scope_lookup_prefer(c->cur, c->cur_mod, nm);
/* #225: kind-filtered so a same-named value binding (param/let/fn)
* in a closer scope can't hide the type binding it shadows. */
Sym *s = scope_lookup_type(c->cur, c->cur_mod, nm);
if (s == NULL && nm) {
/* module-qualified: io.stream → strip the last dot prefix
* and look up the leaf, filtering on the importing module's