wcc/ww: match-as-expression unifies arm yields (coarse-family gate)

exprtype N_MATCH took the first arm's yield type without walking the
rest — int-vs-str arms silently produced garbage downstream. Walk all
arms: typeeq-equal accepts; a definite coarse-family mismatch
(num/str/bool via the new yieldclass classifier, unknown classes stay
lenient) rejects. Same-family non-assignable pairs remain lenient —
the documented precision residual is task #52 (needs tinfo-level
type_assignable). The wave's table-driven reject test lands here:
989_catA_f2_reject, 19 rows x 2 stages, each member pre-fix-red-proven.
This commit is contained in:
2026-06-12 11:31:53 +09:00
parent 780e680c1b
commit 87367ae332
5 changed files with 548 additions and 3 deletions

View File

@@ -248,6 +248,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_arr_cap_reject \
$(BIN)/test_tagged_subset_reject \
$(BIN)/test_callarg_typecheck \
$(BIN)/test_catA_f2_reject \
$(BIN)/test_idxarg_run \
$(BIN)/test_chainidx_run \
$(BIN)/test_tupfieldsize_run \
@@ -648,6 +649,17 @@ $(BIN)/test_callarg_typecheck: test/wcc/989_callarg_typecheck.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_catA_f2_reject drives the #38/F2 checker-reject wave (review items
# #2/#6/#7/#10/#39): each REJECT row must FAIL to build on BOTH driver
# twins, each control must build+run. Needs the full cstage + wwstage tool
# sets plus libwwrt for the link.
$(BIN)/test_catA_f2_reject: test/wcc/989_catA_f2_reject.c \
$(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_idxarg_run (F7-c2, #45/#46): an indexed slice/str element passed as
# a call arg must push its full multi-word header. Builds+runs each fixture
# on BOTH the cstage `ww` and wwstage `ww_ww` drivers (rule-10), so it needs