Skip to content

Enumerator#each_with_object should provide the yielder's return value to its block#1440

Merged
enebo merged 1 commit intojruby:jruby-1_7from
dmarcotte:enum-ret-vals
Jan 27, 2014
Merged

Enumerator#each_with_object should provide the yielder's return value to its block#1440
enebo merged 1 commit intojruby:jruby-1_7from
dmarcotte:enum-ret-vals

Conversation

@dmarcotte
Copy link
Contributor

Here's a simple illustration of the problem:

foo = Enumerator.new { |y| p y.yield }
foo.each_with_object({}) { 42 } # prints 42 on MRI, nil on JRuby

This fix also lets us un-exclude test_enumerator#test_with_object as the delete_if.with_object assertion in there was failing because it implicitly relies on this behavior (I also added a regression spec explicitly testing this case).

(Note: I validated that Travis is pleased with this change. The failures we'll get here are fixed in #1439)

Make Enumerator#each_with_object return its yielder's value to match MRI
enebo added a commit that referenced this pull request Jan 27, 2014
Enumerator#each_with_object should provide the yielder's return value to its block
@enebo enebo merged commit 32129c5 into jruby:jruby-1_7 Jan 27, 2014
@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants