[ruby-cvs:78360] 5069c5f521 (master): Honor refinements for modules that prepend other modules

"Jeremy Evans" <[email protected]>
Newsgroups gmane.comp.lang.ruby.cvs
Message-ID <[email protected]>
Jeremy Evans	2019-10-12 16:01:37 +0900 (Sat, 12 Oct 2019)

  New Revision: 5069c5f521

  https://github.com/ruby/ruby/commit/5069c5f521

  Log:
    Honor refinements for modules that prepend other modules
    
    This previously did not work, and the reason it did not work is
    that:
    
    1) Refining a module or class that prepends other modules places
       the refinements in the class itself and not the origin iclass.
    
    2) Inclusion of a module that prepends other modules skips the
       module itself, including only iclasses for the prepended modules
       and the origin iclass.
    
    Those two behaviors combined meant that the method table for the
    refined methods for the included module never ends up in the
    method lookup chain for the class including the module.
    
    Fix this by not skipping the module itself when the module is
    included.  This requires some code rearranging in
    rb_include_class_new to make sure the correct method tables and
    origin settings are used for the created iclass.
    
    As origin iclasses shouldn't be exposed to Ruby, this also
    requires skipping modules that have origin iclasses in
    Module#ancestors (classes that have origin iclasses were already
    skipped).
    
    Fixes [Bug #16242]

  Modified files:
    class.c
    test/ruby/test_refinement.rb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.