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_HELO_NONE,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 836E91F463 for ; Wed, 25 Sep 2019 18:06:02 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id EB5BF120B64; Thu, 26 Sep 2019 03:05:52 +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 40882120A58 for ; Thu, 26 Sep 2019 03:05:50 +0900 (JST) Received: by filter0191p3mdw1.sendgrid.net with SMTP id filter0191p3mdw1-16881-5D8BAC80-68 2019-09-25 18:05:52.285079348 +0000 UTC m=+162346.785273898 Received: from herokuapp.com (unknown [184.73.122.220]) by ismtpd0065p1mdw1.sendgrid.net (SG) with ESMTP id parkd_s-TUeBdDd6gvwz_A for ; Wed, 25 Sep 2019 18:05:52.242 +0000 (UTC) Date: Wed, 25 Sep 2019 18:05:52 +0000 (UTC) From: tom.enebo@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 70645 X-Redmine-Project: ruby-trunk X-Redmine-Issue-Id: 16181 X-Redmine-Issue-Author: enebo X-Redmine-Sender: enebo 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?CEgjm=2FKgaDwZgtms5cDYrJb3X=2F7GsuVdUT8RQZ9PoP3e=2Ff9leZvrbRfJDEYDb5?= =?us-ascii?Q?0Mu=2FlhJEXZty3Wk2UTUtSW+atWVYTUZ7x+NAGQn?= =?us-ascii?Q?UFDlV3SjtzdqY4x55V0H5WiCB9noZS5TD4wGtOA?= =?us-ascii?Q?nM84PaPe=2FyJ2Hu=2F2sLt+yQRIuzBqVzNMzBVUva3?= =?us-ascii?Q?9rhMN33rVbmyC5f3s4A2nXUgigmqBdJ3APA=3D=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 95090 Subject: [ruby-core:95090] [Ruby master Bug#16181] return from a proc in a module/class body returns out of script. Should be LJE. 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 #16181 has been reported by enebo (Thomas Enebo). ---------------------------------------- Bug #16181: return from a proc in a module/class body returns out of script. Should be LJE. https://bugs.ruby-lang.org/issues/16181 * Author: enebo (Thomas Enebo) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- return is not allowed from class/module body. But if we insert a return into a block then we can invoke the block then it returns all the way out of the script. This has to be accidental behavior doesn't it? I believe the case below should end up as a LocalJumpError: ``` class Foo proc { return }.call end puts "NEVER SEEN" ``` This behavior started some time in 2.5 (it used to be an LJE). -- https://bugs.ruby-lang.org/