-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
The behavior of Enumerable#each_with_index has changed in JRuby 9.1.9.0 #4610
Comments
Huh, I wonder what changed. |
I do not see any modifications to This code is unfortunately rather fragile. MRI seems to have strange rules (or else no rules at all) about which Enumerable methods will break up arguments this way and which will box them in array. We probably fixed it for one method and broke it for others. |
Hello friends 👋 Just one "me too" for the simplecov gem (and I'm about to check if shoes4 is affected). Honestly, I think I'd appreciate a patch level release.. but well, I can also do simplecov patch level release :) |
See if we run into the each_with_index problem outlined in jruby/jruby#4610
* refernces jruby/jruby#4610 * references simplecov-ruby/simplecov#582
simplecov-html 0.10.1 released with a fix. Shoes4 otherwise unaffected :) |
Thank you for the quick answer. I understood that it was an unexpected regression. |
I’m looking forward to a patch release that fixes this… I’m eager to upgrade to 9.1.9.x but this regression makes me nervous. |
Depending on if block arity is being checked, this could make sense; an arity of 1 could thus infer passing the array object produced by That might make sense for the change from Oddly enough, a quick check of both JRuby 9.1.9.0 and MRI 2.3.3 works for the following: # convert array to Hash of index => value
Hash[ [:foo, :bar, :baz].each_with_index.map {|value, index| [index, value] }] |
I reverted this in ad368ee. With the millions of specs/test asserts we do apparently this is not covered and I did not try/think of this permutation. The original intent is that we are slowly cleaning up our internal call paths for blocks/closures such that we can replace them with our own IR instructions when we inline a block back through a method. Unfortunately, the Enumerable stuff is the most difficult to follow. I will put out 9.1.10.0 this week with this fix and a second fix for become_java! (unrelated to users of this issue). |
Thank you for the release of JRuby 9.1.10.0. I confirmed that this regression was resolved. |
It seems like this bug is back in 9.1.11.0 and 9.1.12.0. See: |
@mojavelinux thanks for letting us know. Opened #4724 to track this second regression :( |
👍 |
Environment
Expected Behavior
This is behavior of JRuby 9.1.8.0 and MRI 2.4.1 and MRI 2.5.0dev (2017-05-16 trunk 58738) .
Actual Behavior
This is behavior of JRuby 9.1.9.0.
JRuby 9.1.9.0 returns array object. Is this intentionally changed?
The text was updated successfully, but these errors were encountered: