You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using JLD2
struct Foo end
struct Bar{T} end
struct Baz{T <: Union{Foo, Bar}} end
@save "foo.jld2" Baz
gives:
ERROR: MethodError: Cannot `convert` an object of type Type{Bar} to an object of type DataType
Closest candidates are:
convert(::Type{T}, ::T) where T at essentials.jl:154
Stacktrace:
[1] setindex!(::Array{DataType,1}, ::Type, ::Int64) at ./array.jl:769
[2] copyto!(::IndexLinear, ::Array{DataType,1}, ::IndexLinear, ::Array{Any,1}) at ./abstractarray.jl:731
[3] copyto! at ./abstractarray.jl:723 [inlined]
[4] Type at ./array.jl:497 [inlined]
[5] h5convert!(::JLD2.IndirectPointer, ::Type{JLD2.Vlen{JLD2.OnDiskRepresentation{(0, 16),Tuple{String,Array{Any,1}},Tuple{JLD2.Vlen{String},JLD2.Vlen{JLD2.RelOffset}}}()}}, ::JLD2.JLDFile{JLD2.MmapIO}, ::Union, ::JLD2.JLDWriteSession{Dict{UInt64,JLD2.RelOffset}}) at /Users/kristoffer/.julia/packages/JLD2/KjBIK/src/data.jl:964
Seems like a Vector{DataType} is allocated and then the UnionAll is assigned to that which doesn't work.
The text was updated successfully, but these errors were encountered:
Reported in KristofferC/NearestNeighbors.jl#71 (comment).
MWE:
gives:
Seems like a
Vector{DataType}
is allocated and then the UnionAll is assigned to that which doesn't work.The text was updated successfully, but these errors were encountered: