Can't deserialize serialized data

question

#1

I am running a serialize/deserialize pair in 0.5.0, and deserializing fails with the error message below.

julia>  open(joinpath("00002_dump.jls"), "w") do io
        serialize(io, matched_data)
        end

julia>  dd = open(deserialize, joinpath(BASEDIR, "00002_dump.jls"), "r")
ERROR: TypeError: Array: in parameter, expected Type{T}, got Dict{Date,Dict{Int64,A
rray{T,1}}}                                                                       
 in deserialize_datatype(::SerializationState{IOStream}) at ./serialize.jl:830
 in handle_deserialize(::SerializationState{IOStream}, ::Int32) at ./serialize.jl:5
71                                                                                
 in collect_to!(::Array{DataType,1}, ::Base.Generator{UnitRange{Int64},Base.Seriali
zer.##3#4{SerializationState{IOStream}}}, ::Int64, ::Int64) at ./array.jl:340     
 in collect(::Base.Generator{UnitRange{Int64},Base.Serializer.##3#4{SerializationSt
ate{IOStream}}}) at ./array.jl:308                                                
 in deserialize(::SerializationState{IOStream}, ::Type{SimpleVector}) at ./serializ
e.jl:588                                                                          
 in handle_deserialize(::SerializationState{IOStream}, ::Int32) at ./serialize.jl:5
81                                                                                
 in deserialize(::SerializationState{IOStream}) at ./serialize.jl:541
 in deserialize_datatype(::SerializationState{IOStream}) at ./serialize.jl:829
 in handle_deserialize(::SerializationState{IOStream}, ::Int32) at ./serialize.jl:5
71                                                                                
 in deserialize(::SerializationState{IOStream}, ::Type{Dict{Date,Dict{Int64,Array{T
,1}}}}) at ./serialize.jl:894                                                     
 in deserialize_datatype(::SerializationState{IOStream}) at ./serialize.jl:835
 in handle_deserialize(::SerializationState{IOStream}, ::Int32) at ./serialize.jl:5
71                                                                                
 in open(::Base.Serializer.#deserialize, ::String, ::String) at ./iostream.jl:113

The data is huge, but I can try to create an MWE if necessary. The data in question is a Dict{Date,Dict{Int64,Array{T,1}}}, could that T be the problem?


#2

Yes, it is the T. MWE:

function generate(T)
    dd = Dict{Int,Dict{Int,T}}()
    for i in 1:10
        dd[i] = Dict{Int,T}()
        for j in 1:10
            dd[i][j] = rand(Int,10)
        end
    end
    dd
end

function roundtrip(data)
    io = IOBuffer(true, true)
    serialize(io, data)
    seekstart(io)
    deserialize(io)
end

roundtrip(generate(Vector{Int})) # OK
roundtrip(generate(Vector))     # fails

Should I open an issue?