-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Milestone
Description
Hello there!
While investigating a CI failure related to the newest version of the sucker_punch gem in as part of DataDog/dd-trace-rb#1369 I spotted two behavior differences between MRI and JRuby (as well as TruffleRuby, I've filed truffleruby/truffleruby#2260 with them -- the tickets are quite similar)
Testcase 1:
puts RUBY_DESCRIPTION
kwargs = {}
def foo
end
foo(**kwargs)
puts "Works!"Behavior with JRuby:
jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64bafb9 OpenJDK 64-Bit Server VM 25.275-b01 on 1.8.0_275-b01 [darwin-x86_64]
ArgumentError: wrong number of arguments (given 1, expected 0)
foo at splat-bug-1.rb:5
<main> at splat-bug-1.rb:5
Behavior with MRI:
$ ruby splat-bug-1.rb
ruby 2.4.10p364 (2020-03-31 revision 67879) [x86_64-darwin19]
splat-bug-1.rb:3:in `foo': wrong number of arguments (given 1, expected 0) (ArgumentError)
from splat-bug-1.rb:5:in `<main>'
$ ruby splat-bug-1.rb
ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-darwin19]
Works!
$ ruby splat-bug-1.rb
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
Works!
$ ruby splat-bug-1.rb
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
Works!
$ ruby splat-bug-1.rb
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
Works!
For the life of me, I cannot find any references to a change in behavior in 2.5 for this, so perhaps it was a side-effect of some fix, rather than something deliberate.
Testcase 2:
As a bonus, while trying to create a reduced test case for the issue, I found a second behavior that also differs in JRuby, but that seems to have been changed back in MRI 2.2:
puts RUBY_DESCRIPTION
def foo; end
foo(**{})
puts "Works!"Behavior with JRuby:
jruby 9.2.14.0 (2.5.7) 2020-12-08 ebe64bafb9 OpenJDK 64-Bit Server VM 25.275-b01 on 1.8.0_275-b01 [darwin-x86_64]
ArgumentError: wrong number of arguments (given 1, expected 0)
foo at splat-bug-2.rb:3
<main> at splat-bug-2.rb:3
Behavior with MRI:
$ ruby splat-bug-2.rb
ruby 2.1.10p492 (2016-04-01 revision 54464) [x86_64-darwin19.0]
splat-bug-2.rb:2:in `foo': wrong number of arguments (1 for 0) (ArgumentError)
from splat-bug-2.rb:3:in `<main>'
$ ruby splat-bug-2.rb
ruby 2.2.10p489 (2018-03-28 revision 63023) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 2.4.10p364 (2020-03-31 revision 67879) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 2.5.8p224 (2020-03-31 revision 67882) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-darwin19]
Works!
$ ruby splat-bug-2.rb
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
Works!
Reactions are currently unavailable