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

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

Merged
merged 1 commit into from Jan 27, 2014

Conversation

Projects
None yet
2 participants
@dmarcotte
Copy link
Contributor

dmarcotte commented Jan 24, 2014

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)

Yielder return value for each_with_object
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

Merge pull request #1440 from dmarcotte/enum-ret-vals
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

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
You can’t perform that action at this time.