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=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, 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 032EA1F9FD for ; Mon, 15 Mar 2021 02:58:04 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 9B6A71209CF; Mon, 15 Mar 2021 11:57:05 +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 CB2061209C4 for ; Mon, 15 Mar 2021 11:57:02 +0900 (JST) Received: by filterdrecv-p3las1-c477c4585-94wd5 with SMTP id filterdrecv-p3las1-c477c4585-94wd5-19-604ECD32-25 2021-03-15 02:57:54.776974381 +0000 UTC m=+2866206.622777383 Received: from herokuapp.com (unknown) by geopod-ismtpd-4-0 (SG) with ESMTP id jbrKdXWhTP-iQKM7f8gEig for ; Mon, 15 Mar 2021 02:57:54.608 +0000 (UTC) Date: Mon, 15 Mar 2021 02:57:54 +0000 (UTC) From: marcandre-ruby-core@marc-andre.ca Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 78890 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 17724 X-Redmine-Issue-Author: jnchito X-Redmine-Sender: marcandre 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?6=2FIMxCQLDposcQf5wmbDAtfaKduBAO0bKyhL3BGZtMQ5q7K2TvpbN6A7JIyt9E?= =?us-ascii?Q?aO41+ezmDOb25haCLYFnNbl93Ks=2F7mjf1BWcWjB?= =?us-ascii?Q?geOJp29WDziiA9u=2FbupWLREW8Lvq7pCMlRfHoDe?= =?us-ascii?Q?IDM4ZGJ2n6sf=2Fj8qK7Hi0YT7a3NjJjiRIS5WUGG?= =?us-ascii?Q?9Y7yxvxLBFRxu0n8zbGImOkBRC69fDpTq+ZEpU9?= =?us-ascii?Q?TsAR4jhLms0TdRVumiEfkmtW=2Fhi2VB=2Fyg3v3gq?= To: ruby-core@ruby-lang.org X-Entity-ID: b/2+PoftWZ6GuOu3b0IycA== X-ML-Name: ruby-core X-Mail-Count: 102855 Subject: [ruby-core:102855] [Ruby master Bug#17724] Pattern matching error message is confusing 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 #17724 has been updated by marcandre (Marc-Andre Lafortune). Agreed. Ideally instance variable would be allowed, no? ---------------------------------------- Bug #17724: Pattern matching error message is confusing https://bugs.ruby-lang.org/issues/17724#change-90913 * Author: jnchito (Junichi Ito) * Status: Open * Priority: Normal * ruby -v: ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin20] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN ---------------------------------------- When I use pattern match with instance variables, I get an error message like "expecting local variable or method" ``` ruby @n = 1 case 1 in ^@n # ... end #=> syntax error, unexpected instance variable, expecting local variable or method (SyntaxError) # in ^@n # ^~ ``` However using method is not allowed, either. ``` ruby def n = 1 case 1 in ^n # ... end #=> n: no such local variable (SyntaxError) ``` I think the message "expecting local variable or method" is confusing and should be fixed like "expecting local variable." -- https://bugs.ruby-lang.org/