Commit 2bcdb4b4

2bcdb4b43e01Merged

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

Description

fix(codegen): instance_eval inlined call routes args via typed_call_args

compile_no_recv_call_expr's @instance_eval_self_var arm built the user-method call with compile_call_args raw, missing the per-arg expected-type coerce. A literal add(10) inside b. configure { ... } (where configure does instance_eval(&block)) flowed 10LL into a promote-widened sp_Bigint * add param.

Look up the owner class index + method index for the resolved target, then call compile_typed_call_args so each arg routes through compile_expr_for_expected_type. Falls back to compile _call_args when the lookup fails (preserves the original behavior).

Promote-mode test count: 528 pass / 50 fail / 40 error -> 529 pass / 50 fail / 39 error. Default raise mode unchanged at 618 / 0 / 0.

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

Details

Commit
2bcdb4b43e01
Parent
0146c4d1a8ed

spinel_codegen.rbmodifiedView file

@@ -14591,7 +14591,19 @@
1459114591 if cidx >= 0
1459214592 owner = find_method_owner(target_ci, mname)
1459314593 cast_recv = "(sp_" + owner + " *)" + @instance_eval_self_var
14594- tail = build_call_tail(compile_call_args(nid), "")
14594+ # Use compile_typed_call_args so the per-arg expected-type
14595+ # coerce (incl. promote-mode int -> bigint) fires; without
14596+ # it, an int literal arg flows raw into a promoted bigint
14597+ # param slot.
14598+ owner_ci_ie = find_class_idx(owner)
14599+ owner_midx_ie = owner_ci_ie >= 0 ? cls_find_method_direct(owner_ci_ie, mname) : -1
14600+ ca_ie = ""
14601+ if owner_midx_ie >= 0
14602+ ca_ie = compile_typed_call_args(nid, owner_ci_ie, owner_midx_ie, 0)
14603+ else
14604+ ca_ie = compile_call_args(nid)
14605+ end
14606+ tail = build_call_tail(ca_ie, "")
1459514607 return "sp_" + owner + "_" + sanitize_name(mname) + "(" + cast_recv + tail + ")"
1459614608 end
1459714609 end