Issue #16856 has been updated by jeremyevans0 (Jeremy Evans).
Status changed from Open to Closed
I believe this was fixed in #16801, which is already marked as required for backport to 2.7. With the master branch, there is no warning for the code.
----------------------------------------
Bug #16856: Structs accepting keyword arguments issue a warning with Ruby 2.7
https://bugs.ruby-lang.org/issues/16856#change-85564
* Author: iGEL (Johannes Barre)
* Status: Closed
* Priority: Normal
* ruby -v: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
This code is issuing a warning with Ruby 2.7, but should not:
``` ruby
class NotFine < Struct.new(:x)
def initialize(x, arg:)
end
end
class Fine
def initialize(x, arg:)
end
end
NotFine.new(1, arg: 1) # This is causing the warning
Fine.new(1, arg: 1) # This is not
```
```
$ ruby test.rb
test.rb:11: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
test.rb:2: warning: The called method `initialize' is defined here
```
--
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>