Commit b41ab26f

b41ab26f6304Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 24 files · +8 added · -16 deleted

Description

test: merge 4 poly/ptr Array operator pairs into single files

Each of array_{concat,each_with_object,flat_map,plus} had a parallel _poly / _ptr variant testing the same operator on different element-type shapes. Merge each pair into one file: 8 .rb files → 4. Per the per-test cc -c cost (~944ms on Windows), this saves ~5s on Windows test step and proportional amounts on the other OS jobs, with no loss of regression coverage.

The merged files use distinct local-variable names across the poly and ptr sections so spinel's per-method type inference doesn't unify them to poly across the file (one such collision showed up while merging flat_map: a shared block-param e widened to poly across both blocks). One class Bar definition is shared across the ptr cases per file.

Co-Authored-By: Claude Opus 4.7 (1M context) [email protected]

Details

Commit
b41ab26f6304
Parent
5e21d42ac90f

test/array_concat.rbaddedView file

1+# Array#concat used to silently miss the type-check on both poly_array
2+# and ptr_array — the loop never ran, so the receiver kept its
3+# original length. Both shapes regression-tested here.
4+
5+# poly_array (heterogeneous)
6+a = [1, "x"]
7+a.concat([2, "y"])
8+puts a.length
9+
10+# ptr_array (user objects)
11+class Bar
12+ def initialize(x); @x = x; end
13+ attr_accessor :x
14+end
15+
16+b = [Bar.new(1)]
17+b.concat([Bar.new(2), Bar.new(3)])
18+puts b.length