Commit c76a3030

c76a30308df0Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

fix(analyze): Array#pack returns string

Add return-type inference for pack so result = arr.pack("C*") infers result as string instead of the int fallback. The existing codegen path in spinel_codegen.rb emits a char *, but without the analyze-side return type the lhs slot stayed mrb_int and the assignment raised an int-from-pointer warning.

Fixes #698

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

Details

Commit
c76a30308df0
Parent
ba65804740de

spinel_analyze.rbmodifiedView file

@@ -4156,6 +4156,9 @@
41564156 if mname == "join"
41574157 return "string"
41584158 end
4159+ if mname == "pack"
4160+ return "string"
4161+ end
41594162 if mname == "uniq"
41604163 if recv >= 0
41614164 return infer_type(recv)