From: nobu@... Date: 2020-06-02T10:01:21+00:00 Subject: [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` Issue #16931 has been reported by nobu (Nobuyoshi Nakada). ---------------------------------------- Bug #16931: `defined?` against a protected method call on an inherited instance returns wrong `nil` https://bugs.ruby-lang.org/issues/16931 * Author: nobu (Nobuyoshi Nakada) * Status: Open * 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/ Unsubscribe: