-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]
Description
The issue is:
julia> x = view(["A", "B"], 1:2)
2-element view(::Vector{String}, 1:2) with eltype String:
"A"
"B"
julia> y = Vector{String}(undef, 2)
2-element Vector{String}:
#undef
#undef
julia> copyto!(x, y)
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ .\array.jl:861 [inlined]
[2] copyto_unaliased!(deststyle::IndexLinear, dest::SubArray{String, 1, Vector{String}, Tuple{UnitRange{Int64}}, true}, srcstyle::IndexLinear, src::Vector{String})
@ Base .\abstractarray.jl:1018
[3] copyto!(dest::SubArray{String, 1, Vector{String}, Tuple{UnitRange{Int64}}, true}, src::Vector{String})
@ Base .\abstractarray.jl:998
[4] top-level scope
@ REPL[19]:1
The reason is
Line 1039 in 6026b5f
dest[i + Δi] = src[i] |
If I understand the intention correctly this is a bug in copyto!
as e.g.
julia> x = ["A", "b"]
2-element Vector{String}:
"A"
"b"
julia> y = Vector{String}(undef, 2)
2-element Vector{String}:
#undef
#undef
julia> copyto!(x, y)
2-element Vector{String}:
#undef
#undef
julia> x
2-element Vector{String}:
#undef
#undef
works.
Metadata
Metadata
Assignees
Labels
arrays[a, r, r, a, y, s][a, r, r, a, y, s]