Skip to content

Conversation

@BCSharp
Copy link
Member

@BCSharp BCSharp commented Dec 5, 2024

Fixes issue reported by @slozier in #1828 (review):

Unrelated to this PR, but noticed a slight asymmetry in FixSlice where it does ostart < lb vs ostop < 0. Don't think it hurts anything but seemed odd.

The problem was happening in some cases for arrays with base >= 2 and a negative slice step.

>>> from System import *
>>> arr = Array.CreateInstance(Int32, (3,), (2,))       
>>> arr[-1:-5:-1]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IndexError: Index was outside the bounds of the array.

@slozier slozier merged commit 699824b into IronLanguages:main Dec 6, 2024
8 checks passed
@BCSharp BCSharp deleted the fix_slice_array_ostop branch December 6, 2024 03:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants