Actions
Bug #6662
closedprepend した Class/Module が継承ツリー上にある Class/Module で ancestors に Class が入り込む
Description
prepend した Class/Module で Module#ancestors の順番や Class が入り込む問題は r36241 で対処されましたが
まだ ancestors を呼ぶ Class/Module そのものではなくてその superclass や include している Module で
prepend を使っていると順番が include と同じになる & Class が入り込むようです。
module M; end
class C1
prepend M
end
class C2 < C1
end
C2.ancestors => [C2, C1, M, Class, Object, Kernel, BasicObject]
Updated by nobu (Nobuyoshi Nakada) over 12 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r36266.
Tomoyuki, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
prepend: fix mixing with include
- class.c (rb_include_module): include modules after the origin.
- class.c (include_modules_at): skip prepended modules.
- class.c (rb_prepend_module): now basic.klass in ICLASS refers the
old original class/module. [ruby-dev:45868][Bug #6662] - class.c (rb_mod_ancestors): ditto.
- vm_method.c (search_method): search method entry from the origin
iclass.
Actions
Like0
Like0