Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix downward slices for positive base arrays #1830

Merged
merged 1 commit into from
Dec 6, 2024

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