selfhost/cmd/wcc: stamp typed-suffix N_FLOATLIT (#51b)

cstage cmd/wcc/check.c:702 cexpr N_FLOATLIT arm uses lookup_builtin
(n->tsuffix) with fall-through to ty_untyped_float. wwstage's
exprtype N_FLOATLIT arm at check.ww L1582 was unconditional
untyped_float — the symmetric-stage gap flagged at the tail of #51.

New arm: when e.tsuffix is non-empty, mktname+tinfofornode resolves
the builtin and stamps e.type_; on nil tinfo fall through to the
existing untyped_float path. Same shape as the #51 INTLIT arm one
block up.

Byte-identity (994/995) is the behavior gate; full make test green
at 133/133 confirms.
This commit is contained in:
2026-05-22 23:12:07 +09:00
parent 1ce0f638bf
commit 3eef2828c6
3 changed files with 36 additions and 0 deletions

View File

@@ -8650,6 +8650,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
return tn;
};
if (k == nkind.N_FLOATLIT) {
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
// untyped_float when the suffix doesn't resolve.
if (e.tsuffix.len > 0) {
let suf: *node = mktname(c, e.tsuffix);
let ti: *tinfo = tinfofornode(c, suf);
if (ti != nil) {
e.type_ = ti: *void;
return suf;
};
};
let tn: *node = mktname(c, "untyped_float");
e.type_ = tinfofornode(c, tn): *void;
return tn;

View File

@@ -1580,6 +1580,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
return tn;
};
if (k == nkind.N_FLOATLIT) {
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
// untyped_float when the suffix doesn't resolve.
if (e.tsuffix.len > 0) {
let suf: *node = mktname(c, e.tsuffix);
let ti: *tinfo = tinfofornode(c, suf);
if (ti != nil) {
e.type_ = ti: *void;
return suf;
};
};
let tn: *node = mktname(c, "untyped_float");
e.type_ = tinfofornode(c, tn): *void;
return tn;

View File

@@ -8650,6 +8650,18 @@ fn exprtype(c: *checker, e: *node, hint: *node) *node = {
return tn;
};
if (k == nkind.N_FLOATLIT) {
// Typed-float literal (`1.5f32`, `0.0f64`): tsuffix names a
// builtin primitive. Mirrors cstage cmd/wcc/check.c:702-709
// cexpr's `lookup_builtin(n->tsuffix)`; falls through to
// untyped_float when the suffix doesn't resolve.
if (e.tsuffix.len > 0) {
let suf: *node = mktname(c, e.tsuffix);
let ti: *tinfo = tinfofornode(c, suf);
if (ti != nil) {
e.type_ = ti: *void;
return suf;
};
};
let tn: *node = mktname(c, "untyped_float");
e.type_ = tinfofornode(c, tn): *void;
return tn;