[ruby-dev:50971] [Ruby master Bug#11213] defined?(super) ignores respond_to_missing?
From:
nobu@...
Date:
2020-11-17 12:20:37 UTC
List:
ruby-dev #50971
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/