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
Enumerable#each_entry behaves differently from MRI #4532
Comments
confirmed on latest 9K (9.1.8.0) as well: |
I pushed a possible fix. Feels like we are endlessly tweaking this logic back and forth. I did try to do a Ruby implementation, and I don't think it's possible without extra logic to tell the kind of arguments passed in from
|
@headius I commented on the PR but we seemingly changed all other yield calls in RubyEnumerable to yield from yieldSpecific already. This is the last one in that file. Glancing at other yieldSpecific in other files and they mostly seem ok since we know the argument we are passing internally. |
@enebo Ok, might as well go with it then. |
@headius def each_entry
each {|*a| yield(a.size > 1 ? a : a[0])}
end |
Enumerable#each_entry
is supposed to convert multiple arguments to an array, but the behaviour is different from MRI and jruby 1.7 when multiple arguments are yielded.jruby -v
:jruby 9.0.5.0 (2.2.3) 2016-01-26 7bee00d Java HotSpot(TM) 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [linux-amd64]
jruby 9.1.5.0 (2.3.1) 2016-09-07 036ce39 Java HotSpot(TM) 64-Bit Server VM 24.76-b04 on 1.7.0_76-b13 +jit [linux-x86_64]
test file:
Expected output:
jruby 9.x output:
The text was updated successfully, but these errors were encountered: