JuliaIO/JLD2.jl

JLD2@0.4.37 compatible issue with Measurements@2.10.0

iintSjds opened this issue · 1 comments

Failed to load saved data with Measurements.jl. I tested JLD2@0.4.36 and 0.4.37, this is only happening with 0.4.37. Julia version is 1.9.0.

The error can be triggered by the following code:

using JLD2, Measurements

jldopen("test.jld2", "w") do f
    key = "test"
    if haskey(f, key)
        @warn("replacing existing data for $key")
        delete!(f, key)
    end
    f["test"] = [measurement(8.7e10, 1.5e11)+measurement(1.3e11, 1.0e11)*1im; measurement(8.7e10, 1.5e11)+measurement(1.3e11, 1.0e11)*1im;;;]
end

jldopen("test.jld2", "r") do f
    println(keys(f))
    for k in keys(f)
        println(k)
        println(f[k])
    end
end

The error will be generated when f[k] is called:

ERROR: LoadError: MethodError: no method matching setindex!(::Measurements.Derivatives{Float64}, ::Float64, ::Tuple{Float64, Float64, UInt64})

Hi,

this is a bug introduced in v0.4.37 and should already be fixed on v0.4.38.

I apologise for the inconvenience. Thanks for reporting it!