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-Status: No, score=-2.8 required=3.0 tests=AWL,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,UNPARSEABLE_RELAY 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 8DB741F5AE for ; Sat, 1 Aug 2020 08:34:18 +0000 (UTC) Received: from neon.ruby-lang.org (localhost [IPv6:::1]) by neon.ruby-lang.org (Postfix) with ESMTP id 3AD56120B99; Sat, 1 Aug 2020 17:33:48 +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 B2A7A120B99 for ; Sat, 1 Aug 2020 17:33:45 +0900 (JST) Received: by filterdrecv-p3mdw1-7ff865655c-s2b8s with SMTP id filterdrecv-p3mdw1-7ff865655c-s2b8s-17-5F252905-27 2020-08-01 08:34:13.536783845 +0000 UTC m=+224278.710066949 Received: from herokuapp.com (unknown) by ismtpd0102p1mdw1.sendgrid.net (SG) with ESMTP id 24ofuZBaRg6QCoXwX0BU8Q for ; Sat, 01 Aug 2020 08:34:13.419 +0000 (UTC) Date: Sat, 01 Aug 2020 08:34:13 +0000 (UTC) From: nagachika00@gmail.com Message-ID: References: Mime-Version: 1.0 X-Redmine-MailingListIntegration-Message-Ids: 75258 X-Redmine-Project: ruby-master X-Redmine-Issue-Tracker: Bug X-Redmine-Issue-Id: 16931 X-Redmine-Issue-Author: nobu X-Redmine-Sender: nagachika 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?O2wxg26uOO6cft6GjkEp=2FGevTnH9lR=2FEdG60AX3F8=2FAYU=2FogZNfHNKfEq5Juwd?= =?us-ascii?Q?V4A8KDaAAVDUkkBxQlbPk1I3Mao6=2FhhuxPhertL?= =?us-ascii?Q?dqb3q2jK015x6=2FKWhG6=2F+DI8LYiI9ABb8CoC3bY?= =?us-ascii?Q?214nGmN16=2FAT7+c2EqKpCtOcjnvlh1iMcYIaoYz?= =?us-ascii?Q?yrdEbGygndVwWBbyHI7RGSY0uNfMo2CJ2FQY9ah?= =?us-ascii?Q?MJKbaIVYOu43bfYe0=3D?= To: ruby-core@ruby-lang.org X-ML-Name: ruby-core X-Mail-Count: 99430 Subject: [ruby-core:99430] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` 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 #16931 has been updated by nagachika (Tomoyuki Chikanaga). I cherry-pick'ed the following commits before backporting d05f04d27dd86c67e4a8dfff4392f806cf577bdf. de9d6a7a8cb0929e0b4cf0a3120971c7b8ee8927 da5bd0047d6c961105da210c69d4c88421324b70 ce91c5615ca96f357519043181fb5b76b57ee223 c53aebb1d2eb5afbb18f9b3db9f9c956a463a4e1 ---------------------------------------- Bug #16931: `defined?` against a protected method call on an inherited instance returns wrong `nil` https://bugs.ruby-lang.org/issues/16931#change-86882 * Author: nobu (Nobuyoshi Nakada) * Status: Closed * Priority: Normal * ruby -v: 2.8.0dev (2020-06-02T08:21:03Z master 56ca006784) * Backport: 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED ---------------------------------------- The following code shows `:callable` first, but `nil` next, since 1.9. If the method is callable, `defined?` expression has to return truthy value. ``` ruby class A def foo :callable end protected :foo def t(x) x.foo end def q(x) defined?(x.foo) end end class B :callable p a.q(b) #=> nil ``` -- https://bugs.ruby-lang.org/