Actions
Bug #16856
closedStructs accepting keyword arguments issue a warning with Ruby 2.7
Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
Description
This code is issuing a warning with Ruby 2.7, but should not:
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
Actions
Like0
Like0