Commit 78a133bd
78a133bd5d33Merged
Yusuke Endoh <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
fix(codegen): support Array#concat on poly_array
a.concat(b) on a heterogeneous array silently fell through (the
dispatcher only matched int_array | str_array | float_array | sym_array); the loop was never emitted, and a kept its original
length:
a = [1, "x"] a.concat([2, "y"]) puts a.length # ruby: 4, spinel: 2
Follow-up to the introduction of poly_array: concat was missed when the new type was added.
Adds test/array_concat_poly.rb.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- 78a133bd5d33
- Parent
- 9343b0be9d7e
spinel_codegen.rbmodifiedView file
@@ -18667,7 +18667,7 @@
1866718667
if mname == "concat"1866818668
if recv >= 01866918669
rt = infer_type(recv)18670-
if rt == "int_array" || rt == "str_array" || rt == "float_array" || rt == "sym_array"18670+
if rt == "int_array" || rt == "str_array" || rt == "float_array" || rt == "sym_array" || rt == "poly_array"1867118671
rc = compile_expr_gc_rooted(recv)1867218672
arg = compile_arg0(nid)1867318673
pfx = array_c_prefix(rt)test/array_concat_poly.rbaddedView file
Loading diff…