`array::copy(from, start, to, offset, length)` copies one element more
marzipankaiser opened this issue · comments
According to the documentation:
/**
* Copies `length`-many elements from `from` to `to`
* starting at `start` (in `from`) and `offset` (in `to`)
*/
def copy[T](from: Array[T], start: Int, to: Array[T], offset: Int, length: Int): Unit / Exception[OutOfBounds]
However, actually:
import array
def main() = {
with on[OutOfBounds].panic
val a = array(10, 0)
val b = array(10, 1)
copy(a, 0, b, 0, 5)
println(b)
}
consistently outputs:
Array(0, 0, 0, 0, 0, 0, 1, 1, 1, 1)
(i.e., with 6 times 0 instead of 5) in all backends I tried.
Probably, here:
effekt/libraries/common/array.effekt
Line 119 in a4d5f58
it should be
>
instead of >=
.