Fix copyto! with #undef
This fixes the following problem:
julia> x = PooledArray(["a", "b"])
2-element PooledVector{String, UInt32, Vector{UInt32}}:
"a"
"b"
julia> y = resize!(PooledArray(String[]), 2)
2-element PooledVector{String, UInt32, Vector{UInt32}}:
#undef
#undef
julia> copyto!(x, y)
ERROR: UndefRefError: access to undefined reference
Then maybe we also need to add in this PR
Base.copyto!(dest::PooledArrOrSub{T, N, R}, doffs::Union{Signed, Unsigned},
src::AbstractArray, soffs::Union{Signed, Unsigned},
n::Union{Signed, Unsigned}) where {T, N, R}
method depending on how https://github.com/JuliaLang/julia/issues/45125 is resolved.
CC @nalimilan
Codecov Report
Merging #83 (ad1f384) into main (65e3316) will decrease coverage by
0.23%. The diff coverage is66.66%.
@@ Coverage Diff @@
## main #83 +/- ##
==========================================
- Coverage 89.22% 88.98% -0.24%
==========================================
Files 1 1
Lines 334 336 +2
==========================================
+ Hits 298 299 +1
- Misses 36 37 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/PooledArrays.jl | 88.98% <66.66%> (-0.24%) |
:arrow_down: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 65e3316...ad1f384. Read the comment docs.
Good catch, but apparently we need to wait for the result of the discussion at https://github.com/JuliaLang/julia/issues/45125 to know whether this behavior should be supported or not, right?
Right.
My assumption is that in https://github.com/JuliaLang/julia/issues/45125 the conclusion will be: propagate #undef if it is possible, and throw an error otherwise.