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=-4.0 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 611EC1F45F for ; Thu, 9 May 2019 03:41:49 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 50E66120AA7; Thu, 9 May 2019 12:41:43 +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 261D2120A85 for ; Thu, 9 May 2019 12:41:39 +0900 (JST) Received: by filter0039p3iad2.sendgrid.net with SMTP id filter0039p3iad2-10572-5CD3A175-6 2019-05-09 03:41:41.107199104 +0000 UTC m=+106262.902611485 Received: from herokuapp.com (unknown [54.227.1.136]) by ismtpd0008p1iad2.sendgrid.net (SG) with ESMTP id wcJjJf6QRaSTo0pH0Fv9yg for ; Thu, 09 May 2019 03:41:41.186 +0000 (UTC) Date: Thu, 09 May 2019 03:41:41 +0000 (UTC) From: merch-redmine@jeremyevans.net Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 68086 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?BI+0rQ3fDfrKA75q1x+fOIQVGd3r6DRw3T2G+7m?= =?us-ascii?Q?pJcem7Fe0zBvtG+cka5APg+BrgfpQQPuXuUl2DS?= =?us-ascii?Q?SZRUizLjycpQxsFyHUeV7UxM=2FC2pc3Ha3t3afoP?= =?us-ascii?Q?=2FxFzxCaF1GF2f3Mfv8WKbhYvbqQV98DbhbA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92603 Subject: [ruby-core:92603] [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). Status changed from Open to Closed nobu committed my fix for this at commit:bb4ac7a6506971dc34b5656f1a69aadc7299fcab ---------------------------------------- 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-77962 * Author: ibylich (Ilya Bylich) * Status: Closed * 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/