wcc: stamp N_IDENT-callee destructure bindings in checker (#121)
resolvewalk N_MLET arm distributes the N_IDENT-callee rhs return-tuple element types onto unannotated bindings (the A-narrow slice). Byte-id- neutral — cgen still classifies structurally, stamps inert until the exprfloatkind collapse. N_DOT-callee destructure deferred to #16/#17. Prereq for the #121 collapse (commits 2/3).
This commit is contained in:
@@ -55,7 +55,7 @@ runwait(const char *cmd)
|
||||
return -1;
|
||||
}
|
||||
|
||||
struct row { const char *label; const char *src; int want_exit; };
|
||||
struct row { const char *label; const char *src; int want_exit; int chk_stamped; };
|
||||
|
||||
static const struct row rows[] = {
|
||||
/* mixed (f64, i64): f=2.5 -> i32 2, i=7 -> i32 7, 2+7 = 9. The
|
||||
@@ -105,7 +105,7 @@ static const struct row rows[] = {
|
||||
"export fn main() i32 = {\n"
|
||||
"\tlet (f, i) = mk();\n"
|
||||
"\treturn (f: i32) + (i: i32);\n"
|
||||
"};\n", 9 },
|
||||
"};\n", 9, 1 },
|
||||
/* CONTROL — wide/str element single-var (i64, str) is a 32B tuple
|
||||
* handled by the separate 32B receive branch; the fix's sz==16 gate
|
||||
* excludes it, so it stays byte-id pre- and post-fix. t.0 = 7. */
|
||||
@@ -241,6 +241,29 @@ main(void)
|
||||
"byte-id violation)\n", rows[i].label);
|
||||
fail++;
|
||||
}
|
||||
|
||||
/* (c) #121 A-narrow stamp gate: the un-annotated float-
|
||||
* destructure binding must now carry a checker type stamp, so
|
||||
* w6c_ww emits no `asserttyped:` diagnostic. Non-vacuous —
|
||||
* pre-stamp (HEAD) w6c_ww fires asserttyped on the f64 binding
|
||||
* ident (nil n.type_). */
|
||||
if (rows[i].chk_stamped) {
|
||||
char errf[80];
|
||||
snprintf(errf, sizeof errf,
|
||||
"/tmp/wwtup_%d_%d_err.txt", getpid(), i);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"%s -o /dev/null %s 2>%s", w6c_ww, src, errf);
|
||||
runwait(cmd);
|
||||
snprintf(cmd, sizeof cmd,
|
||||
"grep -q asserttyped %s", errf);
|
||||
if (runwait(cmd) == 0) {
|
||||
fprintf(stderr, "row[%s]: w6c_ww emitted "
|
||||
"asserttyped (destructure binding "
|
||||
"unstamped)\n", rows[i].label);
|
||||
fail++;
|
||||
}
|
||||
unlink(errf);
|
||||
}
|
||||
unlink(src); unlink(cs_s); unlink(ws_s);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user