Commit 0f1fdab0

0f1fdab035e5Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(codegen): inlined str_array [] unboxes bigint index

compile_expr_remap's str_array [] arm passed the index raw, so a promote-widened bigint index inside an inlined yield body landed as sp_StrArray_get(arr, <sp_Bigint *>). Mirror the int_array arm's bigint unbox via sp_bigint_to_int.

Promote-mode test count: 526 pass / 50 fail / 42 error -> 527 pass / 50 fail / 41 error. Default raise mode unchanged at 618 / 0 / 0.

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
0f1fdab035e5
Parent
234b26524e2f

spinel_codegen.rbmodifiedView file

@@ -35155,6 +35155,14 @@
3515535155 rc_r = compile_expr_remap(recv, map_from, map_to)
3515635156 if rt_r == "str_array" && mname == "[]"
3515735157 arg_r = compile_expr_remap_arg0(nid, map_from, map_to)
35158+ args_id_sr = @nd_arguments[nid]
35159+ if args_id_sr >= 0
35160+ aa_sr = get_args(args_id_sr)
35161+ if aa_sr.length > 0 && infer_type(aa_sr[0]) == "bigint"
35162+ @needs_bigint = 1
35163+ arg_r = "sp_bigint_to_int((sp_Bigint *)" + arg_r + ")"
35164+ end
35165+ end
3515835166 return "sp_StrArray_get(" + rc_r + ", " + arg_r + ")"
3515935167 end
3516035168 if rt_r == "int_array" && mname == "[]"