Commit f8386c73

f8386c73d210Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

Array#pack

arr.pack(fmt) lowers to the existing sp_IntArray_pack / sp_PolyArray_pack runtime helpers and types as String. Covers int and poly arrays.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
f8386c73d210
Parent
95a7e0e5e69d

src/analyze.cmodifiedView file

@@ -469,6 +469,7 @@
469469 !strcmp(name, "min") || !strcmp(name, "max")) return ty_array_elem(rt);
470470 if (!strcmp(name, "minmax")) return rt; /* [min, max], same element kind */
471471 if (!strcmp(name, "join")) return TY_STRING;
472+ if (!strcmp(name, "pack") && argc == 1) return TY_STRING;
472473 if (!strcmp(name, "inspect") || !strcmp(name, "to_s")) return TY_STRING;
473474 if (!strcmp(name, "empty?") || !strcmp(name, "include?")) return TY_BOOL;
474475 if (!strcmp(name, "push") || !strcmp(name, "<<") || !strcmp(name, "append") ||