-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
Environment Information
- JRuby version:
jruby 9.3.2.0 (2.6.8) 2021-12-01 0b8223f905 OpenJDK 64-Bit Server VM 11.0.13+8-LTS on 11.0.13+8-LTS +jit [darwin-x86_64] - OS:
Darwin [hostname.redacted] 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64
Issue
When an array is used in a case/when statement in JRuby 9.3.2.0 the matching behavior differs from CRuby 2.6.9. See inline script below. The incorrect behavior is seen when running the script in JRuby 9.3.2.0 emits "did not match" while JRuby 9.2.20.0 and CRuby 2.6.9 both emit "correct".
Expected behavior: JRuby 9.3.2.0 should emit "correct" the same as CRuby 2.6 does when running the inline script below.
array-compare.rb:
case []
when []
puts 'correct ([])'
else
puts 'did not match'
end
puts "[] == [] : #{[] == []}"
puts "[] === [] : #{[] === []}"
puts "[].eql? [] : #{[].eql? []}"
puts "[].equal? [] : #{[].equal? []}"
➜ rvm 2.6.9 do ruby ./array-compare.rb
correct ([])
[] == [] : true
[] === [] : true
[].eql? [] : true
[].equal? [] : false
➜ rvm jruby-9.2.20.1 do ruby ./array-compare.rb
correct ([])
[] == [] : true
[] === [] : true
[].eql? [] : true
[].equal? [] : false
➜ rvm jruby-9.3.2.0 do ruby ./array-compare.rb
did not match
[] == [] : true
[] === [] : true
[].eql? [] : true
[].equal? [] : false
Reactions are currently unavailable