Commit d053fab3
d053fab37953Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified
Description
Hash#values_at and #fetch_values
Collect looked-up values into a poly array (boxing each per the hash's value type). values_at pushes nil for a missing key; fetch_values raises KeyError.
Co-Authored-By: Claude Opus 4.8 [email protected]
Details
- Commit
- d053fab37953
- Parent
- 18cad44a58aa
src/analyze.cmodifiedView file
@@ -632,6 +632,7 @@
632632
!strcmp(name, "count")) return TY_INT;633633
if (!strcmp(name, "keys")) return ty_array_of(ty_hash_key(rt));634634
if (!strcmp(name, "values")) return ty_array_of(ty_hash_val(rt));635+
if (!strcmp(name, "values_at") || !strcmp(name, "fetch_values")) return TY_POLY_ARRAY;635636
{636637
int block = nt_ref(nt, id, "block");637638
if (block >= 0 && (!strcmp(name, "map") || !strcmp(name, "collect"))) {src/codegen.cmodifiedView file
Loading diff…