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

@@ -335,6 +335,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_fmt_vstream_compositions_run \
$(BIN)/test_fieldfn_leaf_collide_run \
$(BIN)/test_amp_fn_assign_run \
$(BIN)/test_type_value_shadow_run \
$(BIN)/test_xmod_alias_struct_collide_run \
$(BIN)/test_xmod_variant_match \
$(BIN)/test_named_ptr_alias_variant_widen \
@@ -735,6 +736,16 @@ $(BIN)/test_amp_fn_assign_run: test/wcc/783_amp_fn_assign_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #225: a value binding (param/let/fn) that shadows a same-named TYPE
# must not hide it in type-annotation or cast position. cstage was
# kind-blind in resolve_typename; wwstage already separated the type and
# value namespaces. Driver build + run on both stages + cs.s == ww.s.
$(BIN)/test_type_value_shadow_run: test/wcc/788_type_value_shadow_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #223: a struct-field access through a pointer-ALIAS receiver whose
# leaf collides with another module's same-leaf STRUCT. cstage driver
# build + run for runtime, raw w6c vs w6c_ww .s cmp on the combined.ww