w6c,ww: re-emit ... union-spread marker in .wwi producer (M4 E3, #95)
The N_TTAGGED serializer emitted each variant via wwi_type but never re-emitted the `...` prefix for TK_ELLIPSIS spread variants, so an exported `(...inner | str)` round-tripped through .wwi as `(inner | str)`. The consumer's checker then could not flatten inner's members into the alias and variadic-assignability rejected bare members — under separate compilation this broke fmt/log/getopt. Re-emit `...` before the variant type, both stages; the producer stays purely syntactic (flatten/dedup remain the consumer's type-store job, per ref/hare/hare/unparse/type.ha:290-300). Gate: test/wcc/989_wwispread_sep.c — table-driven (2-arm + 3-arm spreads) x both stages, asserts the marker survives the .wwi, the consumer binds bare members under --sep (exit 0), and cs==ww .wwi byte-identity.
This commit is contained in:
@@ -45855,6 +45855,10 @@ fn wwitype(fd: i32, t: *syntax.node) void = {
|
||||
let e: *syntax.node = t.list;
|
||||
for (e != nil) {
|
||||
if (e != t.list) { wputs(fd, " | "); };
|
||||
// #95: re-emit the spread marker purely syntactically;
|
||||
// the consumer's type-store flattens
|
||||
// (ref/hare/hare/unparse/type.ha:290-300).
|
||||
if (e.op == syntax.tkind.TK_ELLIPSIS) { wputs(fd, "..."); };
|
||||
wwitype(fd, e);
|
||||
e = e.next;
|
||||
};
|
||||
|
||||
@@ -365,6 +365,10 @@ fn wwitype(fd: i32, t: *syntax.node) void = {
|
||||
let e: *syntax.node = t.list;
|
||||
for (e != nil) {
|
||||
if (e != t.list) { wputs(fd, " | "); };
|
||||
// #95: re-emit the spread marker purely syntactically;
|
||||
// the consumer's type-store flattens
|
||||
// (ref/hare/hare/unparse/type.ha:290-300).
|
||||
if (e.op == syntax.tkind.TK_ELLIPSIS) { wputs(fd, "..."); };
|
||||
wwitype(fd, e);
|
||||
e = e.next;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user