Skip to content
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

Fix copyto! with #undef #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix copyto! with #undef #83

wants to merge 1 commit into from

Conversation

bkamins
Copy link
Member

@bkamins bkamins commented Apr 30, 2022

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 JuliaLang/julia#45125 is resolved.

CC @nalimilan

@codecov
Copy link

codecov bot commented Apr 30, 2022

Codecov Report

Merging #83 (ad1f384) into main (65e3316) will decrease coverage by 0.23%.
The diff coverage is 66.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%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65e3316...ad1f384. Read the comment docs.

@nalimilan
Copy link
Member

Good catch, but apparently we need to wait for the result of the discussion at JuliaLang/julia#45125 to know whether this behavior should be supported or not, right?

@bkamins
Copy link
Member Author

bkamins commented May 2, 2022

Right.

My assumption is that in JuliaLang/julia#45125 the conclusion will be: propagate #undef if it is possible, and throw an error otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants