archive (unofficial mirror)
 help / color / Atom feed
Subject: [ruby-core:99431] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil`
Date: Sat, 01 Aug 2020 08:34:21 +0000 (UTC)
Message-ID: <> (raw)
In-Reply-To: <>

Issue #16931 has been updated by nagachika (Tomoyuki Chikanaga).

Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: REQUIRED to 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE

ruby_2_7 23d130a9ddcaf766d6ce309f8518b434a2537fc1 merged revision(s) d05f04d27dd86c67e4a8dfff4392f806cf577bdf.

Bug #16931: `defined?` against a protected method call on an inherited instance returns wrong `nil`

* 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: DONE
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
  protected :foo
  def t(x)
  def q(x)
class B<A
a =
b =
p a.t(b) #=> :callable
p a.q(b) #=> nil


      parent reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02 10:01 [ruby-core:98624] " nobu
2020-08-01  8:34 ` [ruby-core:99430] " nagachika00
2020-08-01  8:34 ` nagachika00 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link archive (unofficial mirror)

Archives are clonable: git clone --mirror

Example config snippet for mirrors

Newsgroups are available over NNTP:

 note: .onion URLs require Tor:

AGPL code for this site: git clone