Open jw3126 opened 8 years ago
Certainly not desired. https://github.com/JuliaLang/DataStructures.jl/blob/52615e84024f2ac666469fb8f2af95a6194ad84c/src/multi_dict.jl is almost certainly missing a relevant constructor. Pull requests welcome!
Yeah I tried to fix it, but so far I keep hitting https://github.com/JuliaLang/julia/issues/19159.
@wildart I originally thought this issue was related to SortedMultiDicts
, because I forgot that you had contributed a MultiDict
implementation. Since there are no docs for MultiDict
, it's hard to know what the expected behavior or solution is here. Would you be able to add some documentation under doc/source/
?
same problem for SortedDict
:
julia> SortedDict(1 => 1, 2 => "two")
ERROR: MethodError: no method matching DataStructures.SortedDict{K,D,Ord<:Base.Order.Ordering}(::Pair{Int64,Int64}, ::Pair{Int64,String})
Closest candidates are:
DataStructures.SortedDict{K,D,Ord<:Base.Order.Ordering}{K,D}(::Pair{K,D}...) at /Users/arthurb/.julia/v0.5/DataStructures/src/sorted_dict.jl:35
DataStructures.SortedDict{K,D,Ord<:Base.Order.Ordering}{K,D,Ord<:Base.Order.Ordering}(::Ord<:Base.Order.Ordering, ::Pair{K,D}...) at /Users/arthurb/.julia/v0.5/DataStructures/src/sorted_dict.jl:48
DataStructures.SortedDict{K,D,Ord<:Base.Order.Ordering}(::Any) at /Users/arthurb/.julia/v0.5/DataStructures/src/sorted_dict.jl:57
...
Yes, it does appear that there is a constructor missing for SortedDict (and also SortedMultiDict). As a temporary workaround, you can try
SortedDict(Dict(1 => 1, 2 => "two"))
I can do
but
throws an error:
is this expected?