Project

General

Profile

Bug #6659

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

Added by nagachika (Tomoyuki Chikanaga) almost 6 years ago. Updated almost 6 years ago.

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

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

Is duplicate of Ruby trunk - Bug #6658: Module#ancestors & prependClosed2012-06-28

Associated revisions

Revision 3f322590
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

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

Revision 36241
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

Revision 36241
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

Revision 36241
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

Revision 36241
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

Revision 36241
Added by nobu (Nobuyoshi Nakada) almost 6 years ago

prepend: fix ancestors order

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

History

#1 [ruby-dev:45862] Updated by nagachika (Tomoyuki Chikanaga) almost 6 years ago

  • Status changed from Open to Rejected

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

Also available in: Atom PDF