Commit fbf02ef3
fbf02ef3725cMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +1 added · ~2 modified
Description
codegen,analyze: Range#begin/#end, PolyArray#include?, String#delete_(pre|suf)fix!
Three small adjacent dispatch gaps:
-
Range#begin / Range#end (and Range#min / Range#max for the inclusive numeric form) alias to first / last in the range-method emitter, plus analyzer return-type entries.
-
Array#include? on poly_array now routes through sp_PolyArray_include with the arg boxed via box_expr_to_poly, matching the heterogeneous-array semantics.
-
String#delete_prefix! / String#delete_suffix! on mutable_str follow the existing chomp!/strip!/... pattern (sp_String_replace with the non-bang helper's output) and return the receiver.
Fixes #932 Fixes #942 Fixes #929
Co-Authored-By: Claude Opus 4.7 [email protected]
Details
- Commit
- fbf02ef3725c
- Parent
- 24ec1cf637a4
spinel_analyze.rbmodifiedView file
if mname == "delete_prefix" || mname == "delete_suffix" return "string" end if mname == "delete_prefix!" || mname == "delete_suffix!" # Bang variants mutate self in place. When recv is mutable_str # the call returns the same mutable_str; on a frozen literal # the codegen path would already FrozenError before this fires. if recv >= 0 rt_dpb = infer_type(recv) if rt_dpb == "mutable_str" return "mutable_str" end end return "string" end if mname == "eql?" return "bool" end end return "int_array" end if mname == "first" || mname == "last" if mname == "first" || mname == "last" || mname == "begin" || mname == "end" if recv >= 0 rt = infer_type(recv) # Literal `[nil, ...].first` / `.last`: every element is nil sospinel_codegen.rbmodifiedView file
Loading diff…
test/range_begin_end_polyarr_include_delete_bang.rbaddedView file
Loading diff…