Commit 6f2af8ea
6f2af8ea3e38Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): poly dispatch arm unboxes sp_RbVal arg to bigint via .v.i
Extending the per-arm coercion: when the arg's actual emit is
sp_RbVal (caught by expr_emits_poly_rb_val) and the arm's param
is bigint, unbox via sp_bigint_new_int((arg).v.i). The int / float
/ string / bool branches were already wired -- bigint was missing
because earlier passes coerced everything via compile_arg0_as_int
which only fires for primitives.
Also mark the arg type as already-coerced (arg_types[pk] = arm_pt_base)
so the int↔bigint bridge that follows doesn't double-wrap on the same arg.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 6f2af8ea3e38
- Parent
- c2d339e3d1ef
spinel_codegen.rbmodifiedView file
@@ -22400,7 +22400,15 @@
2240022400
elsif arm_pt_base == "bool"2240122401
@needs_rb_value = 12240222402
arg_v = "(" + arg_v + ").v.b"22403+
elsif arm_pt_base == "bigint"22404+
@needs_rb_value = 122405+
@needs_bigint = 122406+
arg_v = "sp_bigint_new_int((" + arg_v + ").v.i)"2240322407
end22408+
# Mark arg as already coerced so the post-step int↔bigint22409+
# bridge below doesn't double-wrap.22410+
arg_types_v = arg_types[pk]22411+
arg_types[pk] = arm_pt_base2240422412
end2240522413
if arm_pt_base == "poly" && pk < arg_types.length && arg_types[pk] != "poly" && arg_types[pk] != ""2240622414
arg_v = box_value_to_poly(arg_types[pk], arg_v)