Project

General

Profile

Bug #14232

Unused refinement still breaks method search

Added by shugo (Shugo Maeda) 9 months ago. Updated 7 months ago.

Status:
Closed
Priority:
Normal
Target version:
-
[ruby-dev:50390]

Description

Given the following t.rb:

module A
  def foo
    puts "A#foo"
    super
  end
end

class B
  def foo
    puts "B#foo"
  end
end

class C < B
  include A

  def foo
    puts "C#foo"
    super
  end
end

module D
  refine A do
    def foo
    end
  end
end

C.new.foo

Even if D is not used, B#foo cannot be called by super in A#foo:

$ ruby t.rb
C#foo
A#foo
Traceback (most recent call last):
        2: from t.rb:30:in `<main>'
        1: from t.rb:19:in `foo'
t.rb:4:in `foo': super: no superclass method `foo' for #<C:0x00005623950b74f8> (NoMethodError)

Associated revisions

Revision e973bde0
Added by nobu (Nobuyoshi Nakada) 9 months ago

vm_method.c: fix super in refined module

  • vm_method.c (rb_method_entry_complement_defined_class): clone the original method entry of refined module instance method with the active ICLASS, to track super method chain. [Bug #14232]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61484 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 61484
Added by nobu (Nobuyoshi Nakada) 9 months ago

vm_method.c: fix super in refined module

  • vm_method.c (rb_method_entry_complement_defined_class): clone the original method entry of refined module instance method with the active ICLASS, to track super method chain. [Bug #14232]

Revision 3b3d4b6b
Added by nagachika (Tomoyuki Chikanaga) 8 months ago

merge revision(s) 61484: [Backport #14232]

vm_method.c: fix super in refined module

* vm_method.c (rb_method_entry_complement_defined_class): clone
  the original method entry of refined module instance method with
  the active ICLASS, to track super method chain.
   [Bug #14232]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@62234 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 62234
Added by nagachika (Tomoyuki Chikanaga) 8 months ago

merge revision(s) 61484: [Backport #14232]

vm_method.c: fix super in refined module

* vm_method.c (rb_method_entry_complement_defined_class): clone
  the original method entry of refined module instance method with
  the active ICLASS, to track super method chain.
   [Bug #14232]

Revision a7cef95f
Added by naruse (Yui NARUSE) 7 months ago

merge revision(s) 61484: [Backport #14232]

vm_method.c: fix super in refined module

* vm_method.c (rb_method_entry_complement_defined_class): clone
  the original method entry of refined module instance method with
  the active ICLASS, to track super method chain.
   [Bug #14232]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@62511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 62511
Added by naruse (Yui NARUSE) 7 months ago

merge revision(s) 61484: [Backport #14232]

vm_method.c: fix super in refined module

* vm_method.c (rb_method_entry_complement_defined_class): clone
  the original method entry of refined module instance method with
  the active ICLASS, to track super method chain.
   [Bug #14232]

History

#1 Updated by nobu (Nobuyoshi Nakada) 9 months ago

  • Status changed from Assigned to Closed

Applied in changeset trunk|r61484.


vm_method.c: fix super in refined module

  • vm_method.c (rb_method_entry_complement_defined_class): clone the original method entry of refined module instance method with the active ICLASS, to track super method chain. [Bug #14232]

#2 Updated by nagachika (Tomoyuki Chikanaga) 8 months ago

  • Backport changed from 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN to 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED

#3 [ruby-dev:50417] Updated by nagachika (Tomoyuki Chikanaga) 8 months ago

  • Backport changed from 2.3: REQUIRED, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: REQUIRED, 2.5: REQUIRED

You cannot refine Module on 2.3.x.
I set DONTNEED for 2.3.

#4 [ruby-dev:50471] Updated by nagachika (Tomoyuki Chikanaga) 8 months ago

  • Backport changed from 2.3: DONTNEED, 2.4: REQUIRED, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONE, 2.5: REQUIRED

ruby_2_4 r62234 merged revision(s) 61484.

#5 [ruby-dev:50481] Updated by naruse (Yui NARUSE) 7 months ago

  • Backport changed from 2.3: DONTNEED, 2.4: DONE, 2.5: REQUIRED to 2.3: DONTNEED, 2.4: DONE, 2.5: DONE

ruby_2_5 r62511 merged revision(s) 61484.

Also available in: Atom PDF