wcc: reject transitive nested-tagged widen at type_assignable (#199 α)
cgen has no wrapped-slot layout — the tagged-union slot is universally [tag:8B][payload:up_to_24B], single level. The recursive walk admitted let r: (size|io.eof|io.error) = u for u: io.underread (transitively in io.error.params); cg_tag_for_variant + taggedvariantindext don't recurse, returned -1, defaulted to tag=0, and the slot read back as variant 0 = size at runtime. Restores SSoT inside the checker pair: is / as / match variant lookup is already non-recursive (#198 sibling), and the LET-init / return / assign arms now agree. Aligns DOWN to the leaner side (rule-10 stage symmetry). ww-stricter than Hare; harec keeps the drill at ref/harec/src/types.c:702-739 (#199b is the deferred wrapped-slot layout port). Pre-flight audit (drew mandate): zero transitive-widen sites in lib/ + selfhost/ + cmd/ + examples/. No wrapper-tagged variant (io.error, strconv.error, fmt.field) is used as a variant of a wider union anywhere in bootstrap. Mechanical fix. Escape hatch for callers: spread (...wrapper) inlines the wrapper's flat variants into the parent set at parse time. Wwstage's gate additionally preserves the recursive drill on op == TK_ELLIPSIS because wwstage stays AST-keyed (cstage flattens at resolve_type). 771_widen_transitive: 5 rows (reject_transitive_widen, spread_alt_widen, direct_flat_variant, branched_callee_widen, wrapper_typed_widen). Row 2 is CS-only — wwstage's is / match on spread-expanded variants is open-bug #190/#198.
This commit is contained in:
7
Makefile
7
Makefile
@@ -321,6 +321,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_io_types_run \
|
||||
$(BIN)/test_dot_aliased_ptr \
|
||||
$(BIN)/test_return_tagged_forward \
|
||||
$(BIN)/test_widen_transitive \
|
||||
$(BIN)/test_use_promote_alias \
|
||||
$(BIN)/test_field_signed $(BIN)/test_frame_argcount \
|
||||
$(BIN)/test_selfhost $(BIN)/test_w6a_ww $(BIN)/test_w6l_ww \
|
||||
@@ -653,6 +654,12 @@ $(BIN)/test_return_tagged_forward: test/wcc/770_return_tagged_forward.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_widen_transitive: test/wcc/771_widen_transitive.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 $@ $<
|
||||
|
||||
$(BIN)/test_arrlit_str_full: test/wcc/711_arrlit_str_full.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
|
||||
Reference in New Issue
Block a user