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
if cidx >= 0 owner = find_method_owner(target_ci, mname) cast_recv = "(sp_" + owner + " *)" + @instance_eval_self_var tail = build_call_tail(compile_call_args(nid), "") # Use compile_typed_call_args so the per-arg expected-type # coerce (incl. promote-mode int -> bigint) fires; without # it, an int literal arg flows raw into a promoted bigint # param slot. owner_ci_ie = find_class_idx(owner) owner_midx_ie = owner_ci_ie >= 0 ? cls_find_method_direct(owner_ci_ie, mname) : -1 ca_ie = "" if owner_midx_ie >= 0 ca_ie = compile_typed_call_args(nid, owner_ci_ie, owner_midx_ie, 0) else ca_ie = compile_call_args(nid) end tail = build_call_tail(ca_ie, "") return "sp_" + owner + "_" + sanitize_name(mname) + "(" + cast_recv + tail + ")" end end