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=-2.9 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FORGED_GMAIL_RCVD,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_PASS shortcircuit=no autolearn=no 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 4345D1F453 for ; Wed, 24 Apr 2019 16:18:11 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 766F5120A80; Thu, 25 Apr 2019 01:18:06 +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 41EEF120A3A for ; Thu, 25 Apr 2019 01:18:04 +0900 (JST) Received: by filter0191p3mdw1.sendgrid.net with SMTP id filter0191p3mdw1-28306-5CC08C3C-2E 2019-04-24 16:18:04.646469922 +0000 UTC m=+164938.988203085 Received: from herokuapp.com (unknown [54.175.145.89]) by ismtpd0029p1mdw1.sendgrid.net (SG) with ESMTP id kyCn5_d7QYuaMMWAv728Pw for ; Wed, 24 Apr 2019 16:18:04.557 +0000 (UTC) Date: Wed, 24 Apr 2019 16:18:04 +0000 (UTC) From: ibylich@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 67883 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 15789 X-Redmine-Issue-Author: ibylich X-Redmine-Sender: ibylich 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?YKoZF84VNWDllkl9Baa6rcaFO8tu0qUf5SpWFI5G5syeS7FRZ2ehM3KJs27MJV?= =?us-ascii?Q?GpAgwt+AvoAy08GnMmHslNlvBzfkxBYJehHPp3X?= =?us-ascii?Q?PL8RpO6Ih8B=2FJP41VW7PtFZLTamX6sgQl5WoEfj?= =?us-ascii?Q?4DkKsZw02bGTjTgrwnjg=2F5pUyiuoVRe5LOYfOS7?= =?us-ascii?Q?k0sRYAWkb9Oto6TYxywNmu5vjInt8UcDjfw=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 92400 Subject: [ruby-core:92400] [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 reported by ibylich (Ilya Bylich). ---------------------------------------- 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 * 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. -- https://bugs.ruby-lang.org/