We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Array dereference in truffleruby works with arrays, but doesn't work with wrapped delegated arrays
irb(main):001:0> Desc = Class.new(SimpleDelegator) => Desc irb(main):002:0> obj = Desc.new([:first, :second]) => [:first, :second] irb(main):003:0> [obj].each { |first, second| p first, second } [:first, :second] nil => [[:first, :second]] irb(main):004:0> [obj].each { |(first, second)| p first, second } :first :second => [[:first, :second]] irb(main):005:0> first, second = obj => [:first, :second] irb(main):006:0> p first, second :first :second irb(main):007:0> RUBY_VERSION => "3.0.3" irb(main):008:0> exit user@lima-default:/Users/user/projects/github/gruf-demo$ ruby -v truffleruby 22.2.0, like ruby 3.0.3, GraalVM CE Native [x86_64-linux]
In MRI it would be
irb(main):001:0> Desc = Class.new(SimpleDelegator) => Desc irb(main):002:0> obj = Desc.new([:first, :second]) => [:first, :second] irb(main):003:0> [obj].each { |first, second| p first, second } :first :second => [[:first, :second]] irb(main):004:0> [obj].each { |(first, second)| p first, second } :first :second => [[:first, :second]] irb(main):005:0> first, second = obj => [:first, :second] irb(main):006:0> p first, second :first :second irb(main):007:0> RUBY_VERSION => "3.0.3" irb(main):008:0> exit user@lima-default:/Users/user/projects/github/gruf-demo$ ruby -v ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]
The normal array dereference works as expected as well as not wrapped array in each
each
The text was updated successfully, but these errors were encountered:
Thanks for the report.
A minimal repro based on that is:
require 'delegate' Desc = Class.new(SimpleDelegator) obj = Desc.new([:first, :second]) [obj].each { |first, second| p first, second } puts "regular array:" [[:first, :second]].each { |first, second| p first, second }
ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux] :first :second regular array: :first :second truffleruby 22.3.0-dev-16c74eb6, like ruby 3.0.3, Interpreted JVM [x86_64-linux] [:first, :second] nil regular array: :first :second
Sorry, something went wrong.
Fixed in c00d9f4
andrykonchin
No branches or pull requests
Description
Array dereference in truffleruby works with arrays, but doesn't work with wrapped delegated arrays
How to reproduce
In MRI it would be
The normal array dereference works as expected as well as not wrapped array in
each
The text was updated successfully, but these errors were encountered: