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
functionconvert(::Type{OrderedDict{K,V}}, d::AbstractDict) where {K,V}
if!isordered(typeof(d))
Base.depwarn("Conversion to OrderedDict is deprecated for unordered associative containers (in this case, $(typeof(d))). Use an ordered or sorted associative type, such as SortedDict and OrderedDict.", :convert)
end
h =OrderedDict{K,V}()
for (k,v) in d
ck =convert(K,k)
if!haskey(h,ck)
h[ck] =convert(V,v)
else
error("key collision during dictionary conversion")
end
end
return h
end
convert(::Type{OrderedDict{K,V}},d::OrderedDict{K,V}) where {K,V} = d
functionconvert(::Type{T}, x::AbstractDict) where T<:AbstractDict
h =T(x)
iflength(h) !=length(x)
error("key collision during dictionary conversion")
endreturn h
end
But for OrderedDict, convert and the constructor don't do the same thing. e.g. OrderedDict{K,V}(::OrderedDictr{K,V}) copies the keys and values, while convert does not. Likewise, OrderedDict{K,V}(::AbstractDict) doesn't raise a deprecation warning, but convert(OrderedDict{K,V}, ::AbstractDict) does.
Is it possible to remove both of these methods? If they are removed, the test suite still passes.
The text was updated successfully, but these errors were encountered:
There are several invalidations in this package that impact downstream dependants:
The final one is the most severe with 242 children. This has some effect on load time:
current:
removing the
convert
methods:The methods in question are:
OrderedCollections.jl/src/ordered_dict.jl
Lines 95 to 110 in 07ee08e
The default method in Base forwards to the constructor:
But for
OrderedDict
,convert
and the constructor don't do the same thing. e.g.OrderedDict{K,V}(::OrderedDictr{K,V})
copies the keys and values, whileconvert
does not. Likewise,OrderedDict{K,V}(::AbstractDict)
doesn't raise a deprecation warning, butconvert(OrderedDict{K,V}, ::AbstractDict)
does.Is it possible to remove both of these methods? If they are removed, the test suite still passes.
The text was updated successfully, but these errors were encountered: