https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112021-10-08T15:56:46ZRuby Issue Tracking SystemRuby master - Bug #18247: weird results for `Array#slice` or `Array#[]` with argument of type `Enumerator::ArithmeticSequence`https://bugs.ruby-lang.org/issues/18247?journal_id=940892021-10-08T15:56:46ZEregon (Benoit Daloze)
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/94089/diff?detail_id=60967">diff</a>)</li></ul> Ruby master - Bug #18247: weird results for `Array#slice` or `Array#[]` with argument of type `Enumerator::ArithmeticSequence`https://bugs.ruby-lang.org/issues/18247?journal_id=971012022-03-30T23:05:44Zjeremyevans0 (Jeremy Evans)merch-redmine@jeremyevans.net
<ul></ul><p>This is still an issue in the master branch. I've submitted a pull request to fix it: <a href="https://github.com/ruby/ruby/pull/5739" class="external">https://github.com/ruby/ruby/pull/5739</a></p> Ruby master - Bug #18247: weird results for `Array#slice` or `Array#[]` with argument of type `Enumerator::ArithmeticSequence`https://bugs.ruby-lang.org/issues/18247?journal_id=986362022-08-11T10:17:40Zjeremyevans (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="Fix Array#[] with ArithmeticSequence with negative steps (#5739) * Fix Array#[] with ArithmeticS..." href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/cfb9624460a295e4e1723301486d89058c228e07">git|cfb9624460a295e4e1723301486d89058c228e07</a>.</p>
<hr>
<p>Fix Array#[] with ArithmeticSequence with negative steps (<a class="issue tracker-1 status-6 priority-4 priority-default closed" title="Bug: [BUG] object allocation during garbage collection phase (Rejected)" href="https://bugs.ruby-lang.org/issues/5739">#5739</a>)</p>
<ul>
<li>Fix Array#[] with ArithmeticSequence with negative steps</li>
</ul>
<p>Previously, Array#[] when called with an ArithmeticSequence<br>
with a negative step did not handle all cases correctly,<br>
especially cases involving infinite ranges, inverted ranges,<br>
and/or exclusive ends.</p>
<p>Fixes [Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: weird results for `Array#slice` or `Array#[]` with argument of type `Enumerator::ArithmeticSequence` (Closed)" href="https://bugs.ruby-lang.org/issues/18247">#18247</a>]</p>
<ul>
<li>Add Array#slice tests for ArithmeticSequence with negative step to test_array</li>
</ul>
<p>Add tests of rb_arithmetic_sequence_beg_len_step C-API function.</p>
<ul>
<li>
<p>Fix ext/-test-/arith_seq/beg_len_step/depend</p>
</li>
<li>
<p>Rename local variables</p>
</li>
<li>
<p>Fix a variable name</p>
</li>
</ul>
<p>Co-authored-by: Kenta Murata <a href="mailto:3959+mrkn@users.noreply.github.com" class="email">3959+mrkn@users.noreply.github.com</a></p>