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
Adhere to Base.copy!(x, i, y, j, n) behaviour for n <= 0 #111
Conversation
The usual |
Why not, if that's consistent with Base. Can you put the tests in a testset and make comments more explicit about the fact that we test that no error is thrown for out of bounds indices? |
this is consistent with Array copy!()
added testsets |
Sorry for pushing another commit after the approval, but it's related, so I though it should go in the same PR. |
src/array.jl
Outdated
@@ -396,14 +396,21 @@ copy(A::CategoricalArray) = deepcopy(A) | |||
CatArrOrSub{T, N} = Union{CategoricalArray{T, N}, | |||
SubArray{<:Any, N, <:CategoricalArray{T}}} where {T, N} | |||
|
|||
function copy!(dest::CatArrOrSub, dstart::Integer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICT we don't need to define this method, we can rely on the AbstractArray
fallback. Just remove the default value of n
in the method below.
because n<0 is likely to trigger BoundsError, but the message would be confusing (attempt to access n-element Array at index [m:m-1]) use Base's copy!(x, i, y, j) for the default n
CI passes on 0.6 |
This is consistent with Base
copy!(x, i, y, j, 0)
: no checks fori
orj
are done.IRL it's observed during
join(df1, df2, kind=:inner)
when the result contains no rows.