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

eval: Error on non-integer index and slice expressions #331

Merged
merged 2 commits into from
Apr 13, 2024

Conversation

juliaogris
Copy link
Member

Error on non-integer index and slice expressions as it doesn't make much sense
to use it, e.g. in arr[1.1]. We are reusing the nice error message wording
that was introduced in with the ErrBadRepetion. We have also copied the way
we do normalizeSlices indices from evaluator, basing it on normalizeIndex.

Fixes #317

Refactor slice and index normalization to work the same way that evaluator
does it. In a follow up commit we will add checks for indices being integer
values. This way it can be done in one place.
Error on non-integer index and slice expressions as it doesn't make much sense
to use it, e.g. in arr[1.1]. We are reusing the nice error message wording
that was introduced in with the ErrBadRepetion.

Fixes #317
Copy link
Member

@camh- camh- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍏

@juliaogris juliaogris merged commit 29690b9 into main Apr 13, 2024
3 checks passed
@juliaogris juliaogris deleted the non-int-index-error branch April 13, 2024 05:59
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.

Disallow array and string index with decimal places
2 participants