Commit 6ab20447
6ab20447be4fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): cmeth kwarg call site coerces positional int args to bigint
compile_constant_recv_expr's class-method-with-kwargs path
compiled each positional argument via raw compile_expr + cast_away_volatile_arg, dropping the int->bigint cast that
compile_typed_call_args already applies for ordinary call sites.
A W.write(200, set_cookies: cookies) call against a promote-mode-
widened def self.write(status, set_cookies: {}) then emitted
sp_W_cls_write(200LL, lv_cookies) with the first arg as
mrb_int against a sp_Bigint * param.
Route the positional slot through compile_expr_for_expected_type
when the parameter's declared base type is bigint or int, so
the helper's existing int<->bigint coerce arm fires.
Promote-mode test count: 460 pass / 44 fail / 114 error -> 466 pass / 46 fail / 106 error. Default raise mode unchanged at 618 / 0 / 0.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 6ab20447be4f
- Parent
- 2270a7d25500
spinel_codegen.rbmodifiedView file
while kk < owner_pn.length slot_expr_cm = "" if pos_idx_cm < positional_cm.length slot_expr_cm = cast_away_volatile_arg(positional_cm[pos_idx_cm], compile_expr(positional_cm[pos_idx_cm])) # Route through compile_expr_for_expected_type when the # slot's declared type needs an int<->bigint cast (promote # mode often promotes the param while the call site still # passes a literal int / int-typed local). slot_pt_pos_cm = kk < owner_pt.length ? owner_pt[kk] : "" if slot_pt_pos_cm != "" && (base_type(slot_pt_pos_cm) == "bigint" || base_type(slot_pt_pos_cm) == "int") slot_expr_cm = compile_expr_for_expected_type(positional_cm[pos_idx_cm], slot_pt_pos_cm) else slot_expr_cm = cast_away_volatile_arg(positional_cm[pos_idx_cm], compile_expr(positional_cm[pos_idx_cm])) end pos_idx_cm = pos_idx_cm + 1 else # Try kwarg by name.