Commit 98168c49
98168c493cb9Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified
Description
fix(codegen): multi-write CallTargetNode coerces int<->bigint per slot
emit_multi_write_target's CallTargetNode arm (obj.attr = val
in a multi-assign destructure) emitted recv_c->iv_attr = value_expr raw, leaving promote-widened bigint slots type-
mismatched against int rhs values.
Probe cls_ivar_type for the matched attr_writer slot and wrap
the rhs through sp_bigint_new_int / sp_bigint_to_int as the slot
direction needs.
Promote-mode test count: 504 pass / 44 fail / 70 error -> 505 pass / 44 fail / 69 error. Default raise mode unchanged at 618 / 0 / 0.
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- 98168c493cb9
- Parent
- 6a39404910fc
spinel_codegen.rbmodifiedView file
@@ -25732,10 +25732,21 @@
2573225732
if recv_t.start_with?("obj_")2573325733
cls_n = recv_t[4, recv_t.length - 4]2573425734
ci_w = find_class_idx(cls_n)25735+
ve_call_t = value_expr25736+
if ci_w >= 025737+
slot_t_ct = cls_ivar_type(ci_w, "@" + mname)25738+
if slot_t_ct == "bigint" && value_type == "int"25739+
@needs_bigint = 125740+
ve_call_t = "sp_bigint_new_int(" + value_expr + ")"25741+
elsif slot_t_ct == "int" && value_type == "bigint"25742+
@needs_bigint = 125743+
ve_call_t = "sp_bigint_to_int((sp_Bigint *)" + value_expr + ")"25744+
end25745+
end2573525746
if cls_has_attr_writer(ci_w, mname) == 125736-
emit(" " + recv_c + "->iv_" + mname + " = " + value_expr + ";")25747+
emit(" " + recv_c + "->iv_" + mname + " = " + ve_call_t + ";")2573725748
else25738-
emit(" sp_" + cls_n + "_" + mname + "_eq(" + recv_c + ", " + value_expr + ");")25749+
emit(" sp_" + cls_n + "_" + mname + "_eq(" + recv_c + ", " + ve_call_t + ");")2573925750
end2574025751
end2574125752
end