Commit 05775903

057759034cbdMerged

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

Description

fix(codegen): case-match scrutinee unboxes bigint to mrb_int

Both compile_case_match_stmt and compile_case_match_return declared the case/in predicate temp as mrb_int <tmp> = <pred> for non-string/poly/float scrutinees. A promote-widened Integer predicate landed there as sp_Bigint *, tripping -Wint-conversion.

Mirror the case-stmt / case-expr fixes: explicit bigint arm that unboxes via sp_bigint_to_int and locally rewrites pred_type to "int" so the per-pattern dispatch picks the int compare path.

Promote-mode test count: 508 pass / 47 fail / 63 error -> 509 pass / 47 fail / 62 error. Default raise mode unchanged at 618 / 0 / 0.

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

Details

Commit
057759034cbd
Parent
c8b87a1eacf0

spinel_codegen.rbmodifiedView file

@@ -26966,6 +26966,10 @@
2696626966 else
2696726967 if pred_type == "float"
2696826968 emit(" mrb_float " + tmp + " = " + pred_val + ";")
26969+ elsif pred_type == "bigint"
26970+ @needs_bigint = 1
26971+ emit(" mrb_int " + tmp + " = sp_bigint_to_int((sp_Bigint *)" + pred_val + ");")
26972+ pred_type = "int"
2696926973 else
2697026974 emit(" mrb_int " + tmp + " = " + pred_val + ";")
2697126975 end
@@ -36082,6 +36086,10 @@
3608236086 else
3608336087 if pred_type == "float"
3608436088 emit(" mrb_float " + tmp + " = " + pred_val + ";")
36089+ elsif pred_type == "bigint"
36090+ @needs_bigint = 1
36091+ emit(" mrb_int " + tmp + " = sp_bigint_to_int((sp_Bigint *)" + pred_val + ");")
36092+ pred_type = "int"
3608536093 else
3608636094 emit(" mrb_int " + tmp + " = " + pred_val + ";")
3608736095 end