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
Using v0.2.1 and julia v1.3.1, I've run into a method error when trying to construct a dictionary from an array I'm pretty sure should work. Here's a reduced example:
julia>using Dictionaries
julia> a = ["a"=> [1,2,3], "b"=> ['a', 'b', 'c']]
2-element Array{Pair{String,Array{T,1} where T},1}:"a"=> [1, 2, 3]
"b"=> ['a', 'b', 'c']
julia> b =convert(Array{Pair{String,_A} where _A,1}, a)
2-element Array{Pair{String,_A} where _A,1}:Pair{String,Array{T,1} where T}("a", [1, 2, 3])
Pair{String,Array{T,1} where T}("b", ['a', 'b', 'c'])
julia>dictionary(a) # Works fine2-element HashDictionary{String,Array{T,1} where T}
"b" │ ['a', 'b', 'c']
"a" │ [1, 2, 3]
julia>dictionary(b)
ERROR: MethodError: no method matching _dictionary(::Type{Pair{String,_A} where _A}, ::Array{Pair{String,_A} where _A,1})
Closest candidates are:_dictionary(::Type{Pair{I,T}}, ::Any) where {I, T} at /Users/isaac/.julia/packages/Dictionaries/cZc5T/src/HashDictionary.jl:117
Stacktrace:
[1] dictionary(::Array{Pair{String,_A} where _A,1}) at /Users/isaac/.julia/packages/Dictionaries/cZc5T/src/HashDictionary.jl:111
[2] top-level scope at REPL[9]:1
julia>typeof(a)
Array{Pair{String,Array{T,1} where T},1}
julia>typeof(b)
Array{Pair{String,_A} where _A,1}
Ah, I think I see what's happening now:
julia> Tuple{eltype(b), typeof(b)} <:Tuple{Pair{I, T} where {I, T}, Any}true
julia> Tuple{Type{eltype(b)}, typeof(b)} <:Tuple{Type{Pair{I, T} where {I, T}}, Any}false
But I can't seem to fix it without making inference much worse. Hm.
dictionary(Dict(b)) does the trick as a workaround.
The text was updated successfully, but these errors were encountered:
Using
v0.2.1
and juliav1.3.1
, I've run into a method error when trying to construct a dictionary from an array I'm pretty sure should work. Here's a reduced example:Ah, I think I see what's happening now:
But I can't seem to fix it without making inference much worse. Hm.
dictionary(Dict(b))
does the trick as a workaround.The text was updated successfully, but these errors were encountered: