* [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil`
@ 2020-06-02 10:01 nobu
2020-08-01 8:34 ` [ruby-core:99430] " nagachika00
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: nobu @ 2020-06-02 10:01 UTC (permalink / raw)
To: ruby-core
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<A
end
a = A.new
b = B.new
p a.t(b) #=> :callable
p a.q(b) #=> nil
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:99430] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil`
2020-06-02 10:01 [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` nobu
@ 2020-08-01 8:34 ` nagachika00
2020-08-01 8:34 ` [ruby-core:99431] " nagachika00
2021-04-04 23:03 ` [ruby-core:103218] " usa
2 siblings, 0 replies; 4+ messages in thread
From: nagachika00 @ 2020-08-01 8:34 UTC (permalink / raw)
To: 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<A
end
a = A.new
b = B.new
p a.t(b) #=> :callable
p a.q(b) #=> nil
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:99431] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil`
2020-06-02 10:01 [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` nobu
2020-08-01 8:34 ` [ruby-core:99430] " nagachika00
@ 2020-08-01 8:34 ` nagachika00
2021-04-04 23:03 ` [ruby-core:103218] " usa
2 siblings, 0 replies; 4+ messages in thread
From: nagachika00 @ 2020-08-01 8:34 UTC (permalink / raw)
To: ruby-core
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`
https://bugs.ruby-lang.org/issues/16931#change-86883
* 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
:callable
end
protected :foo
def t(x)
x.foo
end
def q(x)
defined?(x.foo)
end
end
class B<A
end
a = A.new
b = B.new
p a.t(b) #=> :callable
p a.q(b) #=> nil
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
* [ruby-core:103218] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil`
2020-06-02 10:01 [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` nobu
2020-08-01 8:34 ` [ruby-core:99430] " nagachika00
2020-08-01 8:34 ` [ruby-core:99431] " nagachika00
@ 2021-04-04 23:03 ` usa
2 siblings, 0 replies; 4+ messages in thread
From: usa @ 2021-04-04 23:03 UTC (permalink / raw)
To: ruby-core
Issue #16931 has been updated by usa (Usaku NAKAMURA).
Backport changed from 2.5: REQUIRED, 2.6: REQUIRED, 2.7: DONE to 2.5: REQUIRED, 2.6: DONE, 2.7: DONE
ruby_2_6 r67920 merged revision(s) de9d6a7a8cb0929e0b4cf0a3120971c7b8ee8927,da5bd0047d6c961105da210c69d4c88421324b70,ce91c5615ca96f357519043181fb5b76b57ee223,c53aebb1d2eb5afbb18f9b3db9f9c956a463a4e1,d05f04d27dd86c67e4a8dfff4392f806cf577bdf.
----------------------------------------
Bug #16931: `defined?` against a protected method call on an inherited instance returns wrong `nil`
https://bugs.ruby-lang.org/issues/16931#change-91294
* 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: DONE, 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
:callable
end
protected :foo
def t(x)
x.foo
end
def q(x)
defined?(x.foo)
end
end
class B<A
end
a = A.new
b = B.new
p a.t(b) #=> :callable
p a.q(b) #=> nil
```
--
https://bugs.ruby-lang.org/
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-04-04 23:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-02 10:01 [ruby-core:98624] [Ruby master Bug#16931] `defined?` against a protected method call on an inherited instance returns wrong `nil` nobu
2020-08-01 8:34 ` [ruby-core:99430] " nagachika00
2020-08-01 8:34 ` [ruby-core:99431] " nagachika00
2021-04-04 23:03 ` [ruby-core:103218] " usa
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).