rescript-core icon indicating copy to clipboard operation
rescript-core copied to clipboard

:bug: - Fix binding of Array.get, to make sure it boxes options

Open jfrolich opened this issue 1 year ago • 1 comments
trafficstars

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.

jfrolich avatar May 03 '24 08:05 jfrolich

@jfrolich ping about @glennsl comment

zth avatar Jun 04 '24 08:06 zth