Commit 7a8c9770
7a8c9770711aMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 1 file · ~1 modified
Description
Widen a concrete str-keyed hash into a str_poly_hash local
Assigning a str_str_hash / str_int_hash value to a local whose slot widened to str_poly_hash now wraps it in sp_StrPolyHash_from_* instead of an incompatible-pointer assignment.
Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]
Details
- Commit
- 7a8c9770711a
- Parent
- 82b0ad9c6178
src/codegen.cmodifiedView file
@@ -3951,6 +3951,12 @@
39513951
else if (lv && lv->type == TY_POLY) {39523952
emit_boxed(c, v, b); /* poly slot: box the (non-poly) RHS */39533953
}3954+
else if (lv && lv->type == TY_STR_POLY_HASH &&3955+
(comp_ntype(c, v) == TY_STR_STR_HASH || comp_ntype(c, v) == TY_STR_INT_HASH)) {3956+
/* widen a concrete str-keyed hash into the poly-valued slot */3957+
buf_printf(b, "sp_StrPolyHash_from_%s(", comp_ntype(c, v) == TY_STR_STR_HASH ? "str_str_hash" : "str_int_hash");3958+
emit_expr(c, v, b); buf_puts(b, ")");3959+
}39543960
else {39553961
emit_expr(c, v, b);39563962
}