owner of methods defined after using Module#prepend
The owner of methods defined after using Module#prepend seems to be incorrect.
RUBY_DESCRIPTION # => "ruby 2.1.0dev (2013-03-01 trunk 39546) [x86_64-linux]" class C attr_reader :a prepend Module.new attr_reader :b end C.instance_method(:a).owner # => C C.instance_method(:b).owner # => #<C:0x00000000a52300> C.new.method(:a).owner # => C C.new.method(:b).owner # => #<C:0x00000000a52300> module M attr_reader :a prepend Module.new attr_reader :b end M.instance_method(:a).owner # => M M.instance_method(:b).owner # => # ~> -:19:in `<main>': undefined method `class' for #<M:0x00000000a515b8> (NoMethodError)
Updated by nobu (Nobuyoshi Nakada) over 8 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r44175.
Nobuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
proc.c, vm_method.c: fix super and alias
- proc.c (method_owner): return the class where alias is defined, not
the class original method is defined.
- vm_method.c (rb_method_entry_make, rb_alias): store the originally
defined class in me. [Bug #7993] [Bug #7842] [Bug #9236]
- vm_method.c (rb_method_entry_get_without_cache): cache included
module but not iclass.
Updated by nagachika (Tomoyuki Chikanaga) over 8 years ago
- Backport changed from 1.9.3: DONTNEED, 2.0.0: REQUIRED to 1.9.3: DONTNEED, 2.0.0: DONE
r44175 and r44179 were backported to ruby_2_0_0 at r44345, and additionally r44198 was backported at 44366.
See #9236 too.