Fix NegativeArrayException on 018_heap
Closed this issue · 1 comments
JC626 commented
In 018_heap/main
a NegativeArrayException can occur for:
type Heap is ({
int[] data,
int length
} h)
This is due to the length of the Heap being less than zero.
The length of the Heap could also be outside of the bounds of the array, data
.
Therefore, type constraints would need to be added to ensure the length is within the array's bounds.
DavePearce commented
Nice!