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.9 required=3.0 tests=AWL,BAYES_00, 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 B10721F4B4 for ; Sun, 4 Apr 2021 23:44:21 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 64C22120D02; Mon, 5 Apr 2021 08:43:21 +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 EBFCC120CFE for ; Mon, 5 Apr 2021 08:43:19 +0900 (JST) Received: by filterdrecv-p3las1-699f5f7ff5-vl2kb with SMTP id filterdrecv-p3las1-699f5f7ff5-vl2kb-20-606A4F50-2E 2021-04-04 23:44:16.997538221 +0000 UTC m=+1055474.712469078 Received: from herokuapp.com (unknown) by ismtpd0155p1mdw1.sendgrid.net (SG) with ESMTP id YIjiWBSWQFaRtCaqvAGZKg for ; Sun, 04 Apr 2021 23:44:16.843 +0000 (UTC) Date: Sun, 04 Apr 2021 23:44:17 +0000 (UTC) From: usa@garbagecollect.jp Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 79268 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17533 X-Redmine-Issue-Author: nobu X-Redmine-Sender: usa 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?9Ij0W+xF+66shKwcOf8RvdqxJGkEJjaCZuueI4cieuA2WPK2wNJa3n1anRiob5?= =?us-ascii?Q?IdnuFApecuTbTgwMi8SwrXoHxbtTt8WOdSY1b6+?= =?us-ascii?Q?svHNfRxOZ0SUyzwZD=2FWsi3uIz6yZ5TG0JJIiuqO?= =?us-ascii?Q?lBviHdecbZo0TgGDm6hDRV49DHiXVW7tvNAmhZu?= =?us-ascii?Q?PnQphbOTGFDFSpnpvfAwGxm40X0t8YH0WWDaMPb?= =?us-ascii?Q?lU+UkmtizMIJqv+wc=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 103223 Subject: [ruby-core:103223] [Ruby master Bug#17533] Named capture is not assigned to the same variable as reserved words. 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 #17533 has been updated by usa (Usaku NAKAMURA). Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE, 3.0: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE, 3.0: DONE backported into ruby_2_6 at r67927 ---------------------------------------- Bug #17533: Named capture is not assigned to the same variable as reserved words. https://bugs.ruby-lang.org/issues/17533#change-91301 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * Backport: 2.5: REQUIRED, 2.6: DONE, 2.7: DONE, 3.0: DONE ---------------------------------------- It is expected that named captures don't add new variables same as reserved words, and such variables couldn't be made usually at the time when named capture was implemented. Keyword arguments since 2.0 can be the same as reserved words, however an assignment to an such already defined variable has been also suppressed now. ```ruby def test(s, nil: :ng) /(?.)/ =~ s binding.local_variable_get(:nil) end p test("a") #=> :ng ``` ```ruby tap do |nil: :ng| /(?.)/ =~ "c" p binding.local_variable_get(:nil) #=> :ng end ``` -- https://bugs.ruby-lang.org/