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-Status: No, score=-2.8 required=3.0 tests=AWL,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY 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 351BF1F5AE for ; Sat, 25 Jul 2020 04:41:10 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 46F7E1209F3; Sat, 25 Jul 2020 13:40:40 +0900 (JST) Received: from xtrwkhkc.outbound-mail.sendgrid.net (xtrwkhkc.outbound-mail.sendgrid.net [167.89.16.28]) by neon.ruby-lang.org (Postfix) with ESMTPS id A2C5E1209EB for ; Sat, 25 Jul 2020 13:40:37 +0900 (JST) Received: by filterdrecv-p3mdw1-75c584b9c6-55xs5 with SMTP id filterdrecv-p3mdw1-75c584b9c6-55xs5-19-5F1BB7E0-39 2020-07-25 04:41:05.024631016 +0000 UTC m=+2460692.252171878 Received: from herokuapp.com (unknown) by ismtpd0016p1iad2.sendgrid.net (SG) with ESMTP id g55CgrxxQ6-OvcaCq4vaiA for ; Sat, 25 Jul 2020 04:41:04.937 +0000 (UTC) Date: Sat, 25 Jul 2020 04:41:05 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75117 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16854 X-Redmine-Issue-Author: jamesnakagawa X-Redmine-Sender: nagachika 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?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FCyb5Vujl0orvRmPnzzqJ?= =?us-ascii?Q?y20VMXipZFi1ner+4=2FuQbKf6HDNBLJFBuBepnPc?= =?us-ascii?Q?MEdtyNn8IpJFPtapWCy+vPPMOZBQIytkbISBztL?= =?us-ascii?Q?k0LMeBpKKAZuX7LKfF+pFYqS3Slsk5HtVhedlEC?= =?us-ascii?Q?sj5sniI+gYGisX2uukercB6HqCJLSQSXn9mawXS?= =?us-ascii?Q?hWaYSJL6kOLYBoaI0=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99325 Subject: [ruby-core:99325] [Ruby master Bug#16854] Using (...) when the method name is a keyword generates error 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 #16854 has been updated by nagachika (Tomoyuki Chikanaga). Backport changed from 2.5: DONTNEED, 2.6: DONTNEED, 2.7: REQUIRED to 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ruby_2_7 be359442cb07c25fdc769431ffed3249b9016829 merged revision(s) 71c166e11e761dcaaa943f9b94da38f86ada1bdb. ---------------------------------------- Bug #16854: Using (...) when the method name is a keyword generates error https://bugs.ruby-lang.org/issues/16854#change-86720 * Author: jamesnakagawa (James Nakagawa) * Status: Closed * Priority: Normal * ruby -v: 2.7.0 * Backport: 2.5: DONTNEED, 2.6: DONTNEED, 2.7: DONE ---------------------------------------- Although I wouldn't generally recommend it, naming a method `true` is allowed. However, in combination with the new argument forwarding keyword `...`, a syntax error is generated which does not occur with other argument choices. This came up for me on my Rails project where an enumerated database column was defined to allow the values `:true`, `:false` (not an unreasonable request in itself). Active Record's generated class tried to contain methods by these names. Try this code for yourself: ```ruby class Works def true(*args) puts(*args) end end Works.new.true 1, 2, 3 # => 1, 2, 3 class WontWork def true(...) puts(...) end end # => freezes ``` -- https://bugs.ruby-lang.org/