Commit 46428bcd
46428bcdf724Merged
Yukihiro "Matz" Matsumoto <[email protected]> · 7 months ago · 1 file · ~1 modified
Description
feat: add Array#filter as alias for Array#select
Added to type inference, codegen dispatch, and block parameter type inference.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 46428bcdf724
- Parent
- 957b98143cee
spinel_codegen.rbmodifiedView file
@@ -1924,7 +1924,7 @@
19241924
end19251925
return "int_array"19261926
end1927-
if mname == "select"1927+
if mname == "select" || mname == "filter"19281928
if recv >= 019291929
return infer_type(recv)19301930
end@@ -9351,7 +9351,7 @@
93519351
end93529352
if mname == "times" || mname == "upto" || mname == "downto"93539353
types.push("int")9354-
elsif mname == "each" || mname == "each_pair" || mname == "map" || mname == "select" || mname == "reject" || mname == "find" || mname == "detect" || mname == "any?" || mname == "all?" || mname == "none?" || mname == "count" || mname == "min_by" || mname == "max_by" || mname == "sort_by" || mname == "flat_map"9354+
elsif mname == "each" || mname == "each_pair" || mname == "map" || mname == "select" || mname == "filter" || mname == "reject" || mname == "find" || mname == "detect" || mname == "any?" || mname == "all?" || mname == "none?" || mname == "count" || mname == "min_by" || mname == "max_by" || mname == "sort_by" || mname == "flat_map"93559355
# Element iteration: infer block param from collection type93569356
if recv_type == "str_array"93579357
types.push("string")@@ -12633,7 +12633,7 @@
1263312633
end1263412634
1263512635
# select as expression12636-
if mname == "select"12636+
if mname == "select" || mname == "filter"1263712637
if @nd_block[nid] >= 01263812638
return compile_select_expr(nid)1263912639
end