Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Array#flatten to discard Iterator::Stop #13388

Merged

Conversation

straight-shoota
Copy link
Member

@straight-shoota straight-shoota commented Apr 25, 2023

When calling Array#flatten with an iterator as part of the flattened collections, the resulting array would have Iterator::Stop as part of the element type.

Iterator::Stop is just an indicator for the end of an iterator and not part of its elements. So it must be filtered out when typing the flattened array. FlattenHelper failed to do that.
This patch refactors the implementation to be more like Enumerable.element_type which has a similar purpose just without flattening.

@straight-shoota straight-shoota added kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection labels Apr 25, 2023
@straight-shoota straight-shoota self-assigned this Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind:bug A bug in the code. Does not apply to documentation, specs, etc. topic:stdlib:collection
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants