From: nobu@ruby-lang.org
To: ruby-dev@ruby-lang.org
Subject: [ruby-dev:50971] [Ruby master Bug#11213] defined?(super) ignores respond_to_missing?
Date: Tue, 17 Nov 2020 12:20:37 +0000 (UTC) [thread overview]
Message-ID: <redmine.journal-88543.20201117122037.17@ruby-lang.org> (raw)
In-Reply-To: <redmine.issue-11213.20150602195939.17@ruby-lang.org>
Issue #11213 has been updated by nobu (Nobuyoshi Nakada).
https://github.com/ruby/ruby/pull/3777
----------------------------------------
Bug #11213: defined?(super) ignores respond_to_missing?
https://bugs.ruby-lang.org/issues/11213#change-88543
* Author: ko1 (Koichi Sasada)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* ruby -v: 2.3dev
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN
----------------------------------------
```ruby
class C0
def method_missing *args
p [:method_missing] + args
end
def respond_to_missing? *args
true
end
end
class C1 < C0
def foo
super
defined?(super)
end
end
p C1.new.foo
```
This script prints
```
[:method_missing, :foo]
nil
```
In this case, we can call super, but defined? returns nil.
It should be a bug.
--
https://bugs.ruby-lang.org/
parent reply other threads:[~2020-11-17 12:21 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <redmine.issue-11213.20150602195939.17@ruby-lang.org>]
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-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=redmine.journal-88543.20201117122037.17@ruby-lang.org \
--to=nobu@ruby-lang.org \
--cc=ruby-dev@ruby-lang.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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 NNTP newsgroup(s).