Project

General

Profile

Actions

Bug #6659

closed

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

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

Status:
Rejected
Priority:
Normal
Target version:
ruby -v:
ruby 2.0.0dev (2012-06-27 trunk 36240) [x86_64-darwin10.8.0]
Backport:
[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 #<C:0x0000010103ba90>


Related issues 1 (0 open1 closed)

Is duplicate of Ruby master - Bug #6658: Module#ancestors & prependClosed06/28/2012Actions

Updated by nagachika (Tomoyuki Chikanaga) almost 10 years ago

  • Status changed from Open to Rejected

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

Actions

Also available in: Atom PDF