diff options
author | Jeremy Evans <code@jeremyevans.net> | 2022-03-30 11:03:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-30 11:03:56 -0700 |
commit | fbaadd1cfe7fbfd1b904f193f99d7c845a6ed804 (patch) | |
tree | 298c1393d770cc229d731b43ac13c793dcd93a36 /test/ruby/test_keyword.rb | |
parent | 75efbb98afe854972a1c832ec5d4d66639c41c74 (diff) |
Do not autosplat array in block call just because keywords accepted
If the block only accepts a single positional argument plus keywords,
then do not autosplat. Still autosplat if the block accepts more
than one positional argument in addition to keywords.
Autosplatting a single positional argument plus keywords made sense
in Ruby 2, since a final positional hash could be used as keywords,
but it does not make sense in Ruby 3.
Fixes [Bug #18633]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5665
Merged-By: jeremyevans <code@jeremyevans.net>
Diffstat (limited to 'test/ruby/test_keyword.rb')
-rw-r--r-- | test/ruby/test_keyword.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/test/ruby/test_keyword.rb b/test/ruby/test_keyword.rb index 9094259bc2..0d766905bd 100644 --- a/test/ruby/test_keyword.rb +++ b/test/ruby/test_keyword.rb @@ -3538,7 +3538,7 @@ class TestKeywordArguments < Test::Unit::TestCase assert_equal(splat_expect, pr.call(a), bug8463) pr = proc {|a, **opt| next a, opt} - assert_equal(splat_expect.values_at(0, -1), pr.call(splat_expect), bug8463) + assert_equal([splat_expect, {}], pr.call(splat_expect), bug8463) end def req_plus_keyword(x, **h) |