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=-4.1 required=3.0 tests=AWL,BAYES_00, 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 B3CC11F4B4 for ; Wed, 13 Jan 2021 12:15:01 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id A4A34120A62; Wed, 13 Jan 2021 21:14:09 +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 951E1120A15 for ; Wed, 13 Jan 2021 21:14:07 +0900 (JST) Received: by filterdrecv-p3iad2-577c7fd65d-rzjvm with SMTP id filterdrecv-p3iad2-577c7fd65d-rzjvm-18-5FFEE439-2F 2021-01-13 12:14:49.501567033 +0000 UTC m=+62174.793898003 Received: from herokuapp.com (unknown) by ismtpd0122p1mdw1.sendgrid.net (SG) with ESMTP id lBdFhYAxTCa_9ClODu7yQw for ; Wed, 13 Jan 2021 12:14:49.327 +0000 (UTC) Date: Wed, 13 Jan 2021 12:14:49 +0000 (UTC) From: nobu@ruby-lang.org Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 77963 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17533 X-Redmine-Issue-Author: nobu 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+3ektTtZVXgZtbJPXwqo7p86jCsvYTW4BwRpa2YvZkWYkoxGk104d?= =?us-ascii?Q?KeMUMTYkFkt3kLddUabtjrvTMwWc05t4HXEiGC=2F?= =?us-ascii?Q?z3xA=2Faa24n6CJjeclxnzTEkT=2Fq7G4blW4iGcNA9?= =?us-ascii?Q?GFeK+xNG3UBhv5+F5jEq5HwQxrnYJVUYCXgkmTL?= =?us-ascii?Q?KHf+ytQXeRvXjlR8=2F5WDc2+BxnuGb5Z9Xwb3dZV?= =?us-ascii?Q?xQAUgn2AadPdv3=2FD0=3D?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 102060 Subject: [ruby-core:102060] [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 reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Bug #17533: Named capture is not assigned to the same variable as reserved words. https://bugs.ruby-lang.org/issues/17533 * Author: nobu (Nobuyoshi Nakada) * Status: Open * Priority: Normal * Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED, 3.0: REQUIRED ---------------------------------------- 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/