[ruby-core:96564] [Ruby master Bug#16465] False keyword warning against Struct#initialize
From:
mame@...
Date:
2019-12-29 07:53:36 UTC
List:
ruby-core #96564
Issue #16465 has been updated by mame (Yusuke Endoh).
It was reported in http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-list/50860
----------------------------------------
Bug #16465: False keyword warning against Struct#initialize
https://bugs.ruby-lang.org/issues/16465#change-83502
* Author: mame (Yusuke Endoh)
* Status: Open
* Priority: Normal
* Assignee: jeremyevans0 (Jeremy Evans)
* Target version:
* ruby -v: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN
----------------------------------------
The following code is warned:
```ruby
Sample2 = Struct.new(:s1, :s2, :s3) do
def initialize(a1:, a2:)
super(a1, a2, a1 + a2)
end
end
p Sample2.new(a1:1, a2:2)
#=> test.rb:6: 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
```
I think the code is innocent and the warning is false positive. I'll create a pull request.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:[email protected]?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>