Commit b6d93414
b6d93414ef23Merged
Yusuke Endoh <[email protected]> · 6 months ago · 2 files · +1 added · ~1 modified
Description
fix(codegen): support Array#concat on ptr_array
a.concat(b) on a ptr_array silently fell through, the loop was
never emitted, and a kept its original length:
a = [Bar.new(1)] a.concat([Bar.new(2), Bar.new(3)]) puts a.length # ruby: 3, spinel: 1
Follow-up to the introduction of ptr_array (mirrors the earlier poly_array fix): concat was missed when the new type was added.
Adds test/array_concat_ptr.rb.
Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]
Details
- Commit
- b6d93414ef23
- Parent
- dcafcbb1d9f2
spinel_codegen.rbmodifiedView file
@@ -18734,7 +18734,7 @@
1873418734
if mname == "concat"1873518735
if recv >= 01873618736
rt = infer_type(recv)18737-
if is_array_type(rt) == 118737+
if is_array_type(rt) == 1 || is_ptr_array_type(rt) == 11873818738
rc = compile_expr_gc_rooted(recv)1873918739
arg = compile_arg0(nid)1874018740
pfx = array_c_prefix(rt)test/array_concat_ptr.rbaddedView file
Loading diff…