You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For context but otherwise unimportant encountered in simplecov-ruby/simplecov#847 (which will contain a workaround I used after I finished reporting this)
Environment Information
tobi@speedy:~$ ruby -v
jruby 9.2.9.0 (2.5.7) 2019-10-30 458ad3e OpenJDK 64-Bit Server VM 12.0.1+12 on 12.0.1+12 +jit [linux-x86_64]
tobi@speedy:~$ uname -a
Linux speedy 5.3.0-28-generic #30~18.04.1-Ubuntu SMP Fri Jan 17 06:14:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Expected Behavior
CRuby behavior as tested in the oldest and newest I have installed (2.4.6 and 2.7.0):
irb(main):001:0> [[1, 1]].each_slice(2).map do |(a1, a2), (b1, b2)| [[a1, a2], [b1, b2]] end
=> [[[1, 1], [nil, nil]]]
irb(main):002:0> [[1, 1]].each_slice(2).map do |slice, slice2| [slice, slice2] end
=> [[[1, 1], nil]]
irb(main):003:0> [[1, 1]].each_slice(2).map do |all| all end
=> [[[1, 1]]]
Actual Behavior
irb(main):001:0> [[1, 1]].each_slice(2).map do |(a1, a2), (b1, b2)| [[a1, a2], [b1, b2]] end
=> [[[1, nil], [1, nil]]]
irb(main):002:0> [[1, 1]].each_slice(2).map do |slice, slice2| [slice, slice2] end
=> [[1, 1]]
irb(main):003:0> [[1, 1]].each_slice(2).map do |all| all end
=> [[[1, 1]]]
See how the first and second example differ. I'm showing the 3rd example that's the same for completeness sake (aka not everything is different).
1. confuses me the most as to why the 1s that should be together suddenly end up (through the destructuring) ending up in separate elements instead of the one they should be in. 2. JRuby is missing the extra nil here, which it should have as the behaviour of each_slice should be to add in another nil. Somewhat curiously it's also missing a level of array nesting.
Maybe it's also a general problem with each_slice(2) that can be simplified further, I wasn't able to spot anything more though.
Thanks for all your work, enjoy a bunny picture!
The text was updated successfully, but these errors were encountered:
PragTob
added a commit
to simplecov-ruby/simplecov
that referenced
this issue
Jan 30, 2020
Hello my friends, it's been too long 馃挌
Sadly, I come to you with a bug today!
For context but otherwise unimportant encountered in simplecov-ruby/simplecov#847 (which will contain a workaround I used after I finished reporting this)
Environment Information
Expected Behavior
CRuby behavior as tested in the oldest and newest I have installed (2.4.6 and 2.7.0):
Actual Behavior
See how the first and second example differ. I'm showing the 3rd example that's the same for completeness sake (aka not everything is different).
1. confuses me the most as to why the
1
s that should be together suddenly end up (through the destructuring) ending up in separate elements instead of the one they should be in.2. JRuby is missing the extra nil here, which it should have as the behaviour of
each_slice
should be to add in another nil. Somewhat curiously it's also missing a level of array nesting.Maybe it's also a general problem with each_slice(2) that can be simplified further, I wasn't able to spot anything more though.
Thanks for all your work, enjoy a bunny picture!
The text was updated successfully, but these errors were encountered: