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 binding of Array.get, to make sure it boxes options #217

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jfrolich
Copy link
Contributor

@jfrolich jfrolich commented May 3, 2024

This can cause runtime crashes when the individual members are options. When you are using Option.getExn after an Array.get to get the value if you know the array is in bounds, it will crash if the item in the array an option type and is None for the element. In normal cases you would use Array.getUnsafe for this, but in more complex scenarios this can happen. The types are actually incorrect and it can lead to crashes where you wouldn't expect it.

Copy link
Contributor

@glennsl glennsl left a comment

Choose a reason for hiding this comment

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

This would also apply to every other function that returns option<'a>, wouldn't it? Such as at, pop, shift, find etc.?

@zth
Copy link
Collaborator

zth commented Jun 4, 2024

@jfrolich ping about @glennsl comment

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.

3 participants