Actions
Bug #17092
closedArray#flatten with finite depth should flatten recursive arrays
Description
Recursive arrays can not be flattened currently:
a = []; a << a
a.flatten(2) # => tried to flatten recursive array
The only valid reason to raise an error for recursive arrays is for flatten with no argument (or negative argument); the case for finite-depth flatten is not problematic.
This fix has the bonus of speeding up the finite-depth case in general.
I will merge https://github.com/ruby/ruby/pull/3374, @nobu (Nobuyoshi Nakada) asked for backports.
Actions
Like0
Like0Like0