ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:96563] [Ruby master Bug#16465] False keyword warning against Struct#initialize
       [not found] <redmine.issue-16465.20191229074951@ruby-lang.org>
@ 2019-12-29  7:49 ` mame
  2019-12-29  7:53 ` [ruby-core:96564] " mame
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2019-12-29  7:49 UTC (permalink / raw)
  To: ruby-core

Issue #16465 has been reported by mame (Yusuke Endoh).

----------------------------------------
Bug #16465: False keyword warning against Struct#initialize
https://bugs.ruby-lang.org/issues/16465

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:96564] [Ruby master Bug#16465] False keyword warning against Struct#initialize
       [not found] <redmine.issue-16465.20191229074951@ruby-lang.org>
  2019-12-29  7:49 ` [ruby-core:96563] [Ruby master Bug#16465] False keyword warning against Struct#initialize mame
@ 2019-12-29  7:53 ` mame
  2019-12-29  8:04 ` [ruby-core:96565] " mame
  2019-12-29  8:30 ` [ruby-core:96566] " nobu
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2019-12-29  7:53 UTC (permalink / raw)
  To: ruby-core

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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:96565] [Ruby master Bug#16465] False keyword warning against Struct#initialize
       [not found] <redmine.issue-16465.20191229074951@ruby-lang.org>
  2019-12-29  7:49 ` [ruby-core:96563] [Ruby master Bug#16465] False keyword warning against Struct#initialize mame
  2019-12-29  7:53 ` [ruby-core:96564] " mame
@ 2019-12-29  8:04 ` mame
  2019-12-29  8:30 ` [ruby-core:96566] " nobu
  3 siblings, 0 replies; 4+ messages in thread
From: mame @ 2019-12-29  8:04 UTC (permalink / raw)
  To: ruby-core

Issue #16465 has been updated by mame (Yusuke Endoh).


https://github.com/ruby/ruby/pull/2795

----------------------------------------
Bug #16465: False keyword warning against Struct#initialize
https://bugs.ruby-lang.org/issues/16465#change-83503

* 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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ruby-core:96566] [Ruby master Bug#16465] False keyword warning against Struct#initialize
       [not found] <redmine.issue-16465.20191229074951@ruby-lang.org>
                   ` (2 preceding siblings ...)
  2019-12-29  8:04 ` [ruby-core:96565] " mame
@ 2019-12-29  8:30 ` nobu
  3 siblings, 0 replies; 4+ messages in thread
From: nobu @ 2019-12-29  8:30 UTC (permalink / raw)
  To: ruby-core

Issue #16465 has been updated by nobu (Nobuyoshi Nakada).


Your patch seems eventually same as:

```diff
diff --git a/struct.c b/struct.c
index 79131db2bd..07bfe59b97 100644
--- a/struct.c
+++ b/struct.c
@@ -326,9 +326,7 @@ static VALUE
 setup_struct(VALUE nstr, VALUE members, int keyword_init)
 {
     long i, len;
-    VALUE (*new_func)(int, const VALUE *, VALUE) = rb_class_new_instance;
-
-    if (keyword_init) new_func = struct_new_kw;
+    VALUE (*new_func)(int, const VALUE *, VALUE) = struct_new_kw;
 
     members = struct_set_members(nstr, members);
 
```

----------------------------------------
Bug #16465: False keyword warning against Struct#initialize
https://bugs.ruby-lang.org/issues/16465#change-83504

* 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/

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-29  8:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <redmine.issue-16465.20191229074951@ruby-lang.org>
2019-12-29  7:49 ` [ruby-core:96563] [Ruby master Bug#16465] False keyword warning against Struct#initialize mame
2019-12-29  7:53 ` [ruby-core:96564] " mame
2019-12-29  8:04 ` [ruby-core:96565] " mame
2019-12-29  8:30 ` [ruby-core:96566] " nobu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).