Commit 9c714398

9c714398c5e6Merged

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

Description

fix(codegen): hash literal {sym:} treats bigint values as int slot

infer_hash_val_type's all-sym-keys arm matched only when the first value type was int / bool / nil, so a promote-widened bigint value ({weight:} where weight was promoted) fell through to the str_int_hash default — producing sp_StrIntHash storage that mismatched the caller's expected sp_SymIntHash return.

Add bigint to the same arm. The matching sp_SymIntHash_set call site already unboxes bigint values to mrb_int (commit dd073e8), so storage stays int-shaped and the type tag matches.

Promote-mode test count: 519 pass / 49 fail / 50 error (cleaner intermediate state — hash_shorthand now hits a downstream poly / sym hash mismatch that requires separate inference work). Default raise mode unchanged at 618 / 0 / 0.

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

Details

Commit
9c714398c5e6
Parent
bbae0e91c820

spinel_codegen.rbmodifiedView file

@@ -3152,7 +3152,7 @@
31523152 end
31533153 return "str_str_hash"
31543154 end
3155- if all_sym_keys == 1 && (first_vt == "int" || first_vt == "bool" || first_vt == "nil")
3155+ if all_sym_keys == 1 && (first_vt == "int" || first_vt == "bigint" || first_vt == "bool" || first_vt == "nil")
31563156 return "sym_int_hash"
31573157 end
31583158 # Symbol values get sym_poly_hash storage so dig / lookup