Project

General

Profile

Actions

Bug #6662

closed

prepend した Class/Module が継承ツリー上にある Class/Module で ancestors に Class が入り込む

Added by nagachika (Tomoyuki Chikanaga) over 12 years ago. Updated over 12 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 2.0.0dev (2012-06-28 trunk 36243) [x86_64-darwin11.4.0]
Backport:
[ruby-dev:45868]

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]

Actions #1

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

Also available in: Atom PDF

Like0
Like0