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

Merged
merged 1 commit into from Jan 27, 2014

Projects

None yet

2 participants

@dmarcotte
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)

@dmarcotte dmarcotte Yielder return value for each_with_object
Make Enumerator#each_with_object return its yielder's value to match MRI
1735d48
@enebo enebo merged commit 32129c5 into jruby:jruby-1_7 Jan 27, 2014

1 check failed

default The Travis CI build failed
Details
@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