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, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, 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 4F0DB1F45F for ; Sun, 5 May 2019 04:47:08 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 6F39B1209FF; Sun, 5 May 2019 13:47:03 +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 AD9E31209E8 for ; Sun, 5 May 2019 13:47:00 +0900 (JST) Received: by filter0102p3iad2.sendgrid.net with SMTP id filter0102p3iad2-15609-5CCE6AC4-17 2019-05-05 04:47:00.936825671 +0000 UTC m=+206456.050986036 Received: from herokuapp.com (unknown [54.80.106.145]) by ismtpd0013p1iad2.sendgrid.net (SG) with ESMTP id Y5ZmbeYHSNedKqnZuMUjtg for ; Sun, 05 May 2019 04:47:00.916 +0000 (UTC) Date: Sun, 05 May 2019 04:47:01 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68027 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15789 X-Redmine-Issue-Author: ibylich X-Redmine-Sender: jeremyevans0 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?RVE3t853K5scBhbmJHUzZTFFeVC=2FZSUmHZ0Dc+26wcEi2CTgsF1oz0wTSSxGGN?= =?us-ascii?Q?BIszXrvSOw1+d54rdmfYQsNQKDu0=2FE3kvzTdFRr?= =?us-ascii?Q?30D5CnfZsn0JptmA3GL94WqarNnd8m66S6rrI1A?= =?us-ascii?Q?PaNYlG8q=2FaD3vdHm4ifTgFHZaOBpJfCg5vb9Y0=2F?= =?us-ascii?Q?7Lmmw6WcOQHzNk90peJZ2Ak5w3m89QROJCg=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92544 Subject: [ruby-core:92544] [Ruby trunk Bug#15789] Parse error when numbered parameter is used in a lambda that is a default value of other optarg 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 #15789 has been updated by jeremyevans0 (Jeremy Evans). File fix-numbered-parameter-in-optarg-default-value-v2.patch added jeremyevans0 (Jeremy Evans) wrote: > Attached is a one-line patch that fixes this issue, hopefully without causing additional issues: Here's a patch that includes tests for this fix. ---------------------------------------- Bug #15789: Parse error when numbered parameter is used in a lambda that is a default value of other optarg https://bugs.ruby-lang.org/issues/15789#change-77902 * Author: ibylich (Ilya Bylich) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-04-24 trunk cf930985da) [x86_64-darwin18] * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Sorry if the name of the ticket is not desccriptive While working on backporting these commits into a parser gem: https://github.com/ruby/ruby/commit/6ca9e7cc0785c33f6d382176dbd79d6c91db72fe https://github.com/ruby/ruby/commit/ae07b66aaa092c59ac9d544c9b582712290dc357 ... I've found a weird case that throws a SyntaxError: ``` ruby > def m(a = ->{@1}); end SyntaxError ((irb):10: ordinary parameter is defined) def m(a = ->{@1}); end ^~ ``` And same errors gets thrown when I pass a lambda with numparams to lambda optarg: ``` ruby > ->(optarg = ->{@1}) {} SyntaxError ((irb):1: ordinary parameter is defined) ->(optarg = ->{@1}) {} ^~ ``` I guess the reason for that is that p->max_numparam should be organized as a stack, not a plain shared value. ---Files-------------------------------- fix-numbered-parameter-in-optarg-default-value.patch (546 Bytes) fix-numbered-parameter-in-optarg-default-value-v2.patch (1.42 KB) -- https://bugs.ruby-lang.org/