wcc/ww: reject (a,) single-element trailing-comma tuple (catB-92)
wwstage's tuple-parse loop checked the RPAREN-break at the top, so `(a,)` parsed as a 1-element N_TUPLE and reached cgen — a silent wrong-accept. A trailing comma is legal only after >=2 elements. Align the loop order to cstage cmd/wcc/parse.c:552-558 (parse each element before the RPAREN-break); `(a,)` now errors at the next parseexpr, `(a, b)` / `(a, b,)` are unchanged. cstage already rejected; this brings wwstage's w6c_ww parser into agreement. Regen w6c/wwdump combined.ww (parser embeds in both). Valid-program codegen unchanged → cs==ww byte-id gate stays green.
This commit is contained in:
7
Makefile
7
Makefile
@@ -247,6 +247,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_arr_strslice_elem \
|
||||
$(BIN)/test_arr_tagged_elem \
|
||||
$(BIN)/test_dup_main_reject \
|
||||
$(BIN)/test_tuple_trailing_comma_reject \
|
||||
$(BIN)/test_size_untyped_int \
|
||||
$(BIN)/test_tagged_staticinit \
|
||||
$(BIN)/test_arr_infer_len \
|
||||
@@ -1449,6 +1450,12 @@ $(BIN)/test_dup_main_reject: test/wcc/842_dup_main_reject.c $(BIN)/ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_tuple_trailing_comma_reject: test/wcc/845_tuple_trailing_comma_reject.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_tagged_staticinit: test/wcc/843_tagged_staticinit.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