wcc: stamp fn-ptr-value call results from the callee fn-type

A call whose callee is a fn-VALUE (a fn-pointer struct field like w.emit(...),
or a local/param) had no free SK_FN entry, so exprtype's name lookup missed and
the N_CALL went nil-stamped (the fn-ptr-field class of the asserttyped gap
audit — 3 warns at smoke). When the name lookup misses, fall back to harec's
check_expr_call shape: read the result off the checked callee node's own type —
autodereference + dealias to the TY_FN, take its result (ref/harec/src/check.c
:1566-1581). Name lookup stays primary: a fn-NAME callee node carries its
return type, not its fn-type, so an N_TFN check first would mis-yield void for
a fn-returning-fn; only genuine fn-value callees reach the fallback.

Drives the 901 gap-corpus B count to 0 — with A/D already closed, only the
legitimate abort exemption (C) remains before the bail can arm. Byte-id holds
(cgen's fn-ptr detection is structural, independent of the stamp; the lib/io
return-forwarding site is cs==ww on both bootstrap combined.ww).
This commit is contained in:
2026-05-28 06:28:59 +09:00
parent 884dbb402b
commit 360b58b267
4 changed files with 84 additions and 27 deletions

View File

@@ -21,7 +21,7 @@
*
* Gap classes (counts verified empirically at this revision):
* A module-qual N_DOT call result checked_test 0 (closed)
* B fn-ptr struct-field call smoke 3
* B fn-ptr struct-field call smoke 0 (closed)
* C abort intrinsic callee utf8 8
* D module-leaf == type/fn name fnmatch 0 (closed)
* D module-leaf == type/fn name random 0 (closed)
@@ -109,7 +109,7 @@ main(void)
{ "lib/math/checked/checked_test.combined.ww",
"A module-qual N_DOT call result", 0 },
{ "selfhost/test/smoke.combined.ww",
"B fn-ptr struct-field call", 3 },
"B fn-ptr struct-field call", 0 },
{ "lib/encoding/utf8/utf8.combined.ww",
"C abort intrinsic callee", 8 },
{ "lib/fnmatch/fnmatchtest.combined.ww",
@@ -151,6 +151,6 @@ main(void)
return 1;
}
printf("asserttyped_gap: ww-stage checker warn set matches manifest "
"on %d gap-corpus fixtures (B+C pinned, A+D closed)\n", n);
"on %d gap-corpus fixtures (C pinned, A+B+D closed)\n", n);
return 0;
}