https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112019-10-06T13:47:56ZRuby Issue Tracking SystemRuby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=819202019-10-06T13:47:56Zosyo (manga osyo)
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/81920/diff?detail_id=55252">diff</a>)</li></ul> Ruby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=819632019-10-08T23:20:54Zwanabe (_ wanabe)s.wanabe@gmail.com
<ul><li><strong>Related to</strong> <i><a class="issue tracker-1 status-5 priority-4 priority-default closed" href="/issues/13446">Bug #13446</a>: refinements with prepend for module has strange behavior</i> added</li></ul> Ruby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=819922019-10-12T23:47:11Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>This issue is specific to modules that are refined and use prepend. The reason it does not work:</p>
<ol>
<li>
<p>Refining a module or class that prepends other modules places the refinements in the class itself and not the origin iclass.</p>
</li>
<li>
<p>Inclusion of a module that prepends other modules skips the module itself, including only iclasses for the prepended modules and the origin iclass.</p>
</li>
</ol>
<p>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.</p>
<p>Fix this by not skipping the module itself when the module is included (see <a href="https://github.com/ruby/ruby/pull/2550" class="external">https://github.com/ruby/ruby/pull/2550</a>). 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.</p>
<p>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).</p> Ruby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=819942019-10-12T23:57:46Zosyo (manga osyo)
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/81994/diff?detail_id=55279">diff</a>)</li></ul> Ruby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=819952019-10-13T00:00:56Zosyo (manga osyo)
<ul></ul><p>Its greated!!<br>
Thanks jeremy :)<br>
I will read pull request.</p> Ruby master - Bug #16242: Refinements method call to failedhttps://redmine.ruby-lang.org/issues/16242?journal_id=828632019-11-28T10:57:38Zjeremyevans (Jeremy Evans)code@jeremyevans.net
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="Honor refinements for modules that prepend other modules This previously did not work, and the r..." href="https://redmine.ruby-lang.org/projects/ruby-master/repository/git/revisions/5069c5f5214ce68df8b3954321ad9114c5368dc3">git|5069c5f5214ce68df8b3954321ad9114c5368dc3</a>.</p>
<hr>
<p>Honor refinements for modules that prepend other modules</p>
<p>This previously did not work, and the reason it did not work is<br>
that:</p>
<ol>
<li>
<p>Refining a module or class that prepends other modules places<br>
the refinements in the class itself and not the origin iclass.</p>
</li>
<li>
<p>Inclusion of a module that prepends other modules skips the<br>
module itself, including only iclasses for the prepended modules<br>
and the origin iclass.</p>
</li>
</ol>
<p>Those two behaviors combined meant that the method table for the<br>
refined methods for the included module never ends up in the<br>
method lookup chain for the class including the module.</p>
<p>Fix this by not skipping the module itself when the module is<br>
included. This requires some code rearranging in<br>
rb_include_class_new to make sure the correct method tables and<br>
origin settings are used for the created iclass.</p>
<p>As origin iclasses shouldn't be exposed to Ruby, this also<br>
requires skipping modules that have origin iclasses in<br>
Module#ancestors (classes that have origin iclasses were already<br>
skipped).</p>
<p>Fixes [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Refinements method call to failed (Closed)" href="https://redmine.ruby-lang.org/issues/16242">#16242</a>]</p>