Project

General

Profile

Actions

Bug #11213

closed

defined?(super) ignores respond_to_missing?

Added by ko1 (Koichi Sasada) over 9 years ago. Updated almost 4 years ago.

Status:
Closed
Target version:
-
[ruby-dev:49013]

Description

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.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #17509: Custom respond_to? methods in modules break defined?(super)ClosedActions

Updated by ko1 (Koichi Sasada) over 9 years ago

However it is difficult because we can't call self.respond_to_missing? directly because we should ignore C1#respond_to_missing?.

Options:
(1) Ignore this issue as a spec (or known issue)
(2) Do super (it has compatibility issue)
(3) Introduce something special to call respond_to_missing?

My recommendation is (1).

Actions #3

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Status changed from Open to Closed

Applied in changeset git|fac2498e0299f13dffe4f09a7dd7657fb49bf643.


[Bug #11213] let defined?(super) call respond_to_missing?

Actions #4

Updated by nobu (Nobuyoshi Nakada) almost 4 years ago

  • Related to Bug #17509: Custom respond_to? methods in modules break defined?(super) added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0