wcc/check: #24 reject composite-element tuple (array/struct/tuple), declared+inferred, both stages
A tuple whose element chases to TY_ARRAY/STRUCT/TUPLE (>8B) silently miscompiled both stages: t.0[i] read segfaulted and construction dropped the payload into the 8B slot. Reject the type at resolution (DISP-B); faithful inline layout deferred to #60. cstage resolve_type N_TTUPLE (declared) + N_TUPLE expr (inferred literal, was a cstage-only silent miscompile + cs!=ww asymmetry); wwstage tinfofornode covers both. test/wcc/832 + 941 migrated.
This commit is contained in:
@@ -1368,8 +1368,11 @@ static const struct row rows[] = {
|
||||
/* rule-7 (ken demand 1): a NESTED composite element (tuple-in-
|
||||
* tuple here) occupies more than the one GP word the restage walk
|
||||
* counts — pre-guard the checker accepted it and it ran WRONG
|
||||
* (inner words skewed; wwstage SIGSEGV'd). Loud until a consumer
|
||||
* motivates the wiring. */
|
||||
* (inner words skewed; wwstage SIGSEGV'd). #24 now outlaws the
|
||||
* composite-element tuple TYPE at resolution (both stages), so the
|
||||
* reject fires here before the later "tuple arg element kind
|
||||
* unsupported" arg-pass loud — experr migrated to the #24 text.
|
||||
* Full inline support deferred to task #60. */
|
||||
{ "t2_reject_nested_elem_arg",
|
||||
"package main;\n"
|
||||
"fn f(t: ((i64, i64), i64)) i64 = {\n"
|
||||
@@ -1381,7 +1384,7 @@ static const struct row rows[] = {
|
||||
" if (f(t) != 9) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0,
|
||||
K_BUILDERR, "tuple arg element kind unsupported" },
|
||||
K_BUILDERR, "tuple element must be a scalar" },
|
||||
/* variadic-of-tuples ((i64,i64)...): `ts[0].0` is an indexed-slice
|
||||
* tuple-element FIELD read — #121 leg (a) now resolves it (was LOUD
|
||||
* "unsupported field-read shape"; the dispatch fired only for an
|
||||
@@ -1920,13 +1923,19 @@ static const struct row rows[] = {
|
||||
"};\n", 0, K_RUN, NULL },
|
||||
/* nested tuple element: slot rule gives an inner tuple one 8B
|
||||
* eightbyte (tuple_eslot parity) — pins the outer layout. */
|
||||
/* #24: an INFERRED nested-tuple element `((4,2),36)` drops the inner
|
||||
* tuple on construction (build-proved 76 not 42 reading t.0) and is now
|
||||
* outlawed on BOTH stages — same DISP-B reject as 832's tuple_nested_-
|
||||
* exact, but via the inferred-literal path (check.c N_TUPLE expr +
|
||||
* wwstage tinfofornode). Migrated K_RUN -> K_BUILDERR. Full inline
|
||||
* support deferred to task #60. */
|
||||
{ "t44_inferred_nested",
|
||||
"package main;\n"
|
||||
"export fn main() i32 = {\n"
|
||||
" let t = ((4, 2), 36);\n"
|
||||
" if (t.1 != 36) { return 1; };\n"
|
||||
" return 0;\n"
|
||||
"};\n", 0, K_RUN, NULL },
|
||||
"};\n", 0, K_BUILDERR, "tuple element must be a scalar" },
|
||||
/* #57: an IN-CAP tuple literal's cursor fill keyed each element on
|
||||
* its STAMPED type (element-constructed, check.c N_TUPLE), so a
|
||||
* declared-TAGGED element from a concrete rvalue (`(5: size, 9)`)
|
||||
|
||||
Reference in New Issue
Block a user