JuliaIO / JLD2.jl

HDF5-compatible file format in pure Julia
Other
537 stars 84 forks source link

Round-trip serialization for `Tuple{Type{Int32}}` results in `Tuple{DataType}` #484

Closed topolarity closed 10 months ago

topolarity commented 10 months ago

Type{T} seems to be normalized incorrectly to DataType by JLD2 when it is wrapped by other types.

MWE:

julia> jldsave("example.jld2"; T=Tuple{Type{Int32}})

julia> jldopen("example.jld2", "r") do file file["T"] end
Tuple{DataType}

P.S. Thanks for your hard work on JLD2 - I've really enjoyed my time with the package so far

JonasIsensee commented 10 months ago

Thanks for reporting this. This is a tricky edge case of the bootstrapping for the julia type system. I think I fixed it in #485

julia> Type{Int} isa DataType
true

julia> Type{Int} <: DataType
true

julia> DataType <: Type
true

julia> DataType isa Type
true