From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS4713 221.184.0.0/13 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from neon.ruby-lang.org (neon.ruby-lang.org [221.186.184.75]) by dcvr.yhbt.net (Postfix) with ESMTP id 5007F1F463 for ; Sun, 29 Dec 2019 08:30:31 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 410CB120B1D; Sun, 29 Dec 2019 17:30:05 +0900 (JST) Received: from o1678948x4.outbound-mail.sendgrid.net (o1678948x4.outbound-mail.sendgrid.net [167.89.48.4]) by neon.ruby-lang.org (Postfix) with ESMTPS id 5E300120AC1 for ; Sun, 29 Dec 2019 17:30:02 +0900 (JST) Received: by filterdrecv-p3mdw1-56c97568b5-d7vf5 with SMTP id filterdrecv-p3mdw1-56c97568b5-d7vf5-18-5E086409-62 2019-12-29 08:30:01.989505882 +0000 UTC m=+1064815.492396291 Received: from herokuapp.com (unknown [54.145.162.235]) by ismtpd0004p1iad1.sendgrid.net (SG) with ESMTP id fFSAT2RZSEaHBsErc8Udkg for ; Sun, 29 Dec 2019 08:30:01.940 +0000 (UTC) Date: Sun, 29 Dec 2019 08:30:02 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 72225 X-Redmine-Project: ruby-master X-Redmine-Issue-Id: 16465 X-Redmine-Issue-Author: mame X-Redmine-Issue-Assignee: jeremyevans0 X-Redmine-Sender: nobu X-Mailer: Redmine X-Redmine-Host: bugs.ruby-lang.org X-Redmine-Site: Ruby Issue Tracking System X-Auto-Response-Suppress: All Auto-Submitted: auto-generated X-SG-EID: =?us-ascii?Q?q8Dly+pU2+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4BzYF0OW1uoJpVlI3cgv8=2F?= =?us-ascii?Q?Hq+yAyC6DdeWst6FzqUg9FKnEHaVBy3ZYQ2G=2FoJ?= =?us-ascii?Q?kERirUr9NEDsROI9BeEPQosp6AnGeLpM4OlTEjZ?= =?us-ascii?Q?ggWhCwg+S+aHacY48IUB8+v+PZw9a+k2aJd3b+P?= =?us-ascii?Q?DctyvabdrLWmyp0d6GYCw1nGSAAPkWldEaxFgqF?= =?us-ascii?Q?Cn=2FVK2jeUDcOPUkEI=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 96566 Subject: [ruby-core:96566] [Ruby master Bug#16465] False keyword warning against Struct#initialize X-BeenThere: ruby-core@ruby-lang.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: Ruby developers List-Id: Ruby developers List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ruby-core-bounces@ruby-lang.org Sender: "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/