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.7 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,T_SPF_HELO_TEMPERROR 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 A27581F454 for ; Mon, 11 Nov 2019 12:45:26 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 7AA0B120976; Mon, 11 Nov 2019 21:45:11 +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 7E3B8120966 for ; Mon, 11 Nov 2019 21:45:08 +0900 (JST) Received: by filter0062p3iad2.sendgrid.net with SMTP id filter0062p3iad2-31656-5DC957D2-37 2019-11-11 12:45:06.421591304 +0000 UTC m=+311637.275176869 Received: from herokuapp.com (unknown [35.171.185.2]) by ismtpd0100p1mdw1.sendgrid.net (SG) with ESMTP id nzGmoNJBRmmJiZ2yMTa-_g for ; Mon, 11 Nov 2019 12:45:06.321 +0000 (UTC) Date: Mon, 11 Nov 2019 12:45:06 +0000 (UTC) From: manga.osyo@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 71411 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16340 X-Redmine-Issue-Author: osyo X-Redmine-Sender: osyo 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?EoIqruA4Er0CjiyK1+U6TJuuQMCAZ3OX2ybarlx6ke4Hu=2F5FWj4w1aDEBYBWHK?= =?us-ascii?Q?+GK4CcUPga+jb9FfVxuF2UIrI8EZ5GbN=2FUzMBBE?= =?us-ascii?Q?GjEG4DtbirU0saVYgWqfDzw5zzlrjo9QF8C6CGd?= =?us-ascii?Q?usoQoSiyvsy3bKEFRgVA9jVSE=2F=2FzJhcQUn8I7eH?= =?us-ascii?Q?QwdLy44ewezfI=2FuqkLTB4iKBuAVTO2DT2ig=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95786 Subject: [ruby-core:95786] [Ruby master Bug#16340] There are cases where `eval("_ 1")` does not refer to Numbered parameter 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 #16340 has been reported by osyo (manga osyo). ---------------------------------------- Bug #16340: There are cases where `eval("_ 1")` does not refer to Numbered parameter https://bugs.ruby-lang.org/issues/16340 * Author: osyo (manga osyo) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.7.0dev (2019-11-11T10:03:43Z trunk 9d3213ac85) [x86_64-linux] * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- ## Steps to reproduce 1. Define local variable `_1` outside block 2. Call Numbered parameter in block 3. Call `eval("_1")` in same block ## Expected behavior ```ruby _1 = :local_variable proc { _1 # return Numbered parameter(_1) eval("_1") # => :argument }.call :argument ``` ## Actual behavior ```ruby _1 = :local_variable proc { _1 # return local variables outside block eval("_1") # => :local_variable }.call :argument ``` This is strange behavior because I want to expect to reference `_1` in block. ## Note * Return Numbered parameter if not define local variables outside block ```ruby # _1 = :local_variable proc { _1 # Actual behavior # return Numbered parameter eval("_1") # => :argument }.call :argument ``` -- https://bugs.ruby-lang.org/