Bug #6654

Module#prepend does not honor included modules

Added by Konstantin Haase almost 3 years ago. Updated almost 3 years ago.

[ruby-core:45914]
Status:Closed
Priority:Normal
Assignee:-
ruby -v: Backport:

Description

=begin
I really love that Module#prepend landed in core. I just had a play with it. I'm not sure if the following behavior is intentional:

module A
  def a; end
end

module B
  include A
  def b; end
end

class C
  prepend B
end


p C.new.respond_to? :b # true
p C.new.respond_to? :a # false (expected true)

=end

Associated revisions

Revision 36237
Added by Nobuyoshi Nakada almost 3 years ago

ancestor modules

  • class.c (rb_prepend_module): ancestors of prepending module also should be included. [Bug #6654]

Revision 36237
Added by Nobuyoshi Nakada almost 3 years ago

ancestor modules

  • class.c (rb_prepend_module): ancestors of prepending module also should be included. [Bug #6654]

History

#1 Updated by Nobuyoshi Nakada almost 3 years ago

  • Tracker changed from Feature to Bug

#2 Updated by Nobuyoshi Nakada almost 3 years ago

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

This issue was solved with changeset r36237.
Konstantin, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


ancestor modules

  • class.c (rb_prepend_module): ancestors of prepending module also should be included. [Bug #6654]

Also available in: Atom PDF