wcc: #99 alias-of-tuple — chase TY_NAMED in tuple coercion (cstage) + param spill (wwstage)
type pair = (int, int); let x: pair = (3, 4) -- an alias of a tuple initialized from an untyped literal, and passing such a value to a fn -- was a both-stage bug, mirror-twins of the same TY_NAMED-not-chased root: cstage CHECKER over-rejected the init (not assignable to declared pair): type.c's tuple-assignable arm gated on the un-chased dst kind, so a TY_NAMED alias skipped the per-element untyped->int coercion the direct tuple path applies. Fix: chase TY_NAMED both sides (mirrors the #258 slice-borrow arm). Direct and typed-alias tuples already worked; only alias+untyped was rejected. wwstage CGEN dropped the second word of an alias-tuple fn-arg: the tuple-param spill at cgendecl.ww gated on the syntactic N_TTUPLE, so an alias param (N_TNAME) fell to the scalar path and spilled one slot -> t.1 read frame garbage. Fix: chase the alias via aliaslookup to the resolved N_TTUPLE and spill all its slots. cstage cgen was already correct -- the bug was checker-only there. Converges cs==ww byte-id. One commit: same construct, the two halves must ship together (either alone leaves cs!=ww). test/wcc/826 (init/fn-arg/return, 2-field byte-id); test/wcc/944 4 rows graduated err->run-correct. byte-id 990-997 8/8.
This commit is contained in:
7
Makefile
7
Makefile
@@ -254,6 +254,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_inferred_global_let \
|
||||
$(BIN)/test_inferred_float_global \
|
||||
$(BIN)/test_errfirst_union_try \
|
||||
$(BIN)/test_alias_tuple_coerce \
|
||||
$(BIN)/test_slice_str_global_zero \
|
||||
$(BIN)/test_slice_literal_global \
|
||||
$(BIN)/test_global_arr_elem_field \
|
||||
@@ -686,6 +687,12 @@ $(BIN)/test_errfirst_union_try: test/wcc/825_errfirst_union_try.c $(BIN)/ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_alias_tuple_coerce: test/wcc/826_alias_tuple_coerce.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_def_arr_infer_len: test/wcc/814_def_arr_infer_len.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