Commit 6594360f
6594360f1b95Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): box_value_to_poly handles bigint via sp_bigint_to_int + sp_box_int
box_value_to_poly had no bigint arm — promote-mode block tails
flowing into a PolyArray push ((0...3).map { i * 10 } widened by
a heterogeneous outer collector) sent the sp_Bigint * straight to
sp_box_int, which expects mrb_int. Big regression target: 8 tests
flipped from fail to pass.
Unbox via sp_bigint_to_int and route through sp_box_int. The value-fits assumption matches every other bigint -> mrb_int coerce in this codebase; if the value doesn't fit, the truncation is the same semantic as any other narrowing path here.
Promote-mode test count: 538 pass / 55 fail / 25 error -> 546 pass / 47 fail / 25 error. Default raise mode 618 / 0 / 0.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 6594360f1b95
- Parent
- 593a14b45ca0
spinel_codegen.rbmodifiedView file
if at == "int" return "sp_box_int(" + val + ")" end if at == "bigint" # No dedicated SP_BUILTIN_BIGINT slot in the box helpers; unbox # to mrb_int and route through sp_box_int. The value fits when # it does (the canonical promote-mode scenario where the bigint # is just an int-sized integer wearing the bigint suit); larger # values truncate, which is the same trade-off as any other # bigint -> mrb_int coerce in this codegen. @needs_bigint = 1 return "sp_box_int(sp_bigint_to_int((sp_Bigint *)" + val + "))" end if at == "string" return "sp_box_str(" + val + ")" end