Skip to content

Array#delete_if - no size update #1877

@regfaker

Description

@regfaker

jruby-1.7.6 [ x86_64 ](using rvm)

a=[1,2,3,4]
a.delete_if { |e| puts a.size; e % 2 == 0 }

4
4
4
4
=> [1, 3]

End result ok - array elements were deleted, but size was not updated during delete_if iterations and it should be.
If I run this in ruby-1.9.3-p484 [ x86_64 ]:
4
4
3
3
=> [1, 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions