In ruby#17715 we found that the current override of Array#find:
|
def find(if_none_proc = nil) # :nodoc: |
|
Primitive.attr! :inline_block, :c_trace, :without_interrupts |
|
|
|
unless defined?(yield) |
|
return Primitive.cexpr! 'SIZED_ENUMERATOR(self, 0, 0, ary_enum_length)' |
|
end |
|
i = 0 |
|
until Primitive.rb_jit_ary_at_end(i) |
|
value = Primitive.rb_jit_ary_at(i) |
|
return value if yield(value) |
|
i = Primitive.rb_jit_fixnum_inc(i) |
|
end |
|
if_none_proc&.call |
|
end |
is incorrect and fails 3 specs, see
ruby#17715 (comment)
To avoid blocking the specs update I have disabled that override, which also fixes compatibility but might reduce performance.
I took a quick look but it seems non-trivial to fix because we'd need to pass the if_none_proc argument to SIZED_ENUMERATOR as a 1-element C array or so.
See
|
RETURN_ENUMERATOR(ary, argc, argv); |
for what the original/C definition of
Array#find does.
In ruby#17715 we found that the current override of Array#find:
ruby/array.rb
Lines 291 to 304 in f66235e
is incorrect and fails 3 specs, see ruby#17715 (comment)
To avoid blocking the specs update I have disabled that override, which also fixes compatibility but might reduce performance.
I took a quick look but it seems non-trivial to fix because we'd need to pass the
if_none_procargument toSIZED_ENUMERATORas a 1-element C array or so.See
ruby/array.c
Line 2098 in f66235e
Array#finddoes.