Project

General

Profile

Actions

Bug #10826

closed

Refinements make instance_methods(false) return methods of superclasses

Added by shugo (Shugo Maeda) about 9 years ago. Updated about 9 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 2.3.0dev (2015-02-04 trunk 49489) [x86_64-linux]
[ruby-dev:48854]

Description

If a method is refined for a subclass X of the owner of the method,
X.instance_methods(false) returns that method even if it's not defined
in X.

class X
  def foo
  end
end

class Y < X
end

module Bar
  refine Y do
    def foo
    end
  end
end

p Y.instance_methods(false).include?(:foo) # false expected, but true is returned

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #10765: Module#remove_method remove refined method entry.Closedshugo (Shugo Maeda)01/21/2015Actions
Actions #1

Updated by shugo (Shugo Maeda) about 9 years ago

  • Related to Bug #10765: Module#remove_method remove refined method entry. added
Actions #2

Updated by shugo (Shugo Maeda) about 9 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

Applied in changeset r49493.


  • class.c (method_entry_i, class_instance_method_list,
    rb_obj_singleton_methods): should not include methods of
    superclasses if recur is false. [ruby-dev:48854] [Bug #10826]

Updated by shugo (Shugo Maeda) about 9 years ago

  • Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED

Updated by naruse (Yui NARUSE) about 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: REQUIRED to 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE

ruby_2_2 r49592 merged revision(s) 49493.

Updated by usa (Usaku NAKAMURA) about 9 years ago

  • Backport changed from 2.0.0: REQUIRED, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE

ruby_2_0_0 r49738 merged revision(s) 49222,49480,49493.

Actions #6

Updated by nagachika (Tomoyuki Chikanaga) about 9 years ago

  • Backport changed from 2.0.0: DONE, 2.1: REQUIRED, 2.2: DONE to 2.0.0: DONE, 2.1: DONE, 2.2: DONE

Backported into ruby_2_1 branch at r49992.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0