Bug #6659

prepend した Class/Module の ancestors に Class が混入する

Added by Tomoyuki Chikanaga almost 3 years ago. Updated almost 3 years ago.

[ruby-dev:45861]
Status:Rejected
Priority:Normal
Assignee:Nobuyoshi Nakada
ruby -v:ruby 2.0.0dev (2012-06-27 trunk 36240) [x86_64-darwin10.8.0] Backport:

Description

Module#prepend を利用した Class/Module に対して ancestors を呼ぶと Class が入りこみます。
ancestors に入るだけで Object#is_a? の判定やメソッド呼び出しができるようになったりはしていないようです。

module M1
end

module M2
prepend M1
end
M2.ancestors # => [M2, M1, Class]

class C
prepend M1
end
C.ancestors # => [C, M1, Class, Object, Kernel, BasicObject]
C.new.is_a(Class) # => false
C.new.superclass # => NoMethodError: undefined method `allocate' for #


Related issues

Duplicates Ruby trunk - Bug #6658: Module#ancestors & prepend Closed 06/28/2012

Associated revisions

Revision 36241
Added by Nobuyoshi Nakada almost 3 years ago

prepend: fix ancestors order

  • class.c (rb_mod_ancestors): fix ancestors order. [Bug #6658] [Bug #6659]

Revision 36241
Added by Nobuyoshi Nakada almost 3 years ago

prepend: fix ancestors order

  • class.c (rb_mod_ancestors): fix ancestors order. [Bug #6658] [Bug #6659]

History

#1 Updated by Tomoyuki Chikanaga almost 3 years ago

  • Status changed from Open to Rejected

#6658 と重複してしまったのでこちらは閉じます。

Also available in: Atom PDF