Issue #16339 has been updated by Eregon (Benoit Daloze).


2.6 behaves like:
```ruby
p C.new.target({}, **{})   # => [[], {}]
p C.new.delegate({}, **{}) # => [[], {}]
```

So I'm not sure what's "correct" for that last case.

jeremyevans0 (Jeremy Evans) wrote:
> `forwardable` should be fixed to use `ruby2_keywords`.

Right, or `...` maybe.

> I'm guessing the reason this wasn't done initially is because I worked on forwardable keyword argument support before I developed `ruby2_keywords`.

Didn't forwardable always support keyword arguments since it just did `(*args, &block)` delegation?

----------------------------------------
Bug #16339: Forwardable#def_delegator warns and is incorrect on trunk when passed keyword arguments
https://bugs.ruby-lang.org/issues/16339#change-82640

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: ruby 2.7.0dev (2019-11-10T05:56:38Z master 4570284ce1) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
Because it uses `*args, &block`-style delegation.
```ruby
require 'forwardable'

class C
  extend Forwardable
  def_delegator :self, :target, :delegate
  def target(*args, **kwargs)
    [args, kwargs]
  end
end

p C.new.target(1, b: 2)   # => [[1], {:b=>2}]
p C.new.delegate(1, b: 2)
# ruby-trunk/lib/ruby/2.7.0/forwardable.rb:231: warning: The last argument is used as the keyword parameter
# del.rb:6: warning: for `target' defined here
# => [[1], {:b=>2}]

p C.new.target({}, **{}) # => [[{}], {}]
p C.new.delegate({}, **{})
# ruby-trunk/lib/ruby/2.7.0/forwardable.rb:231: warning: The last argument is used as the keyword parameter
# del.rb:6: warning: for `target' defined here
# => [[], {}]
```

Which also illustrates we're missing important tests/specs for Forwardable.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>