Number.slice
and .static_array
use unsafe casting
#13033
Labels
kind:bug
A bug in the code. Does not apply to documentation, specs, etc.
topic:stdlib:collection
topic:stdlib:numeric
Number.slice
andNumber.static_array
useNumber.new!
to cast values to the item type which does not fail on overflow errors:This is unsafe behaviour and should be fixed.
The easiest fix would be to change
Number.new!
toNumber.new
. This would have a minor performance impact, but that shouldn't be too much of a problem (and safety is definitely more important).Common usage of these macros is with number literals for which we could easily use implicit autocasting.
First reported in #13020 (comment)
The text was updated successfully, but these errors were encountered: