I'm using Julia 1.5.2 on Win10
version 1: This one compiles. It actually works if all values of the Dict are of type 'V'. But that is not exactly what I want.
struct MyData{K,V}
data::AbstractVector{<:AbstractDict{<:K,V}}
end
version 2: This is what I actually want, but the compiler throws an UndefVarError: V not defined exception. The only different is {<:K,V} vs {<:K,<:V}
struct MyData{K,V}
data::AbstractVector{<:AbstractDict{<:K,<:V}}
end
Update: How to reproduce
julia> struct MyStruct{K,V}
data::AbstractVector{<:AbstractDict{<:K,<:V}}
end
julia> ar = [Dict{String,Any}("a" => 1)]
1-element Array{Dict{String,Any},1}:
Dict("a" => 1)
julia> MyStruct(ar)
ERROR: UndefVarError: V not defined
Stacktrace:
[1] MyStruct(::Array{Dict{String,Any},1}) at .\REPL[1]:2
[2] top-level scope at REPL[3]:1
Any idea why that is and how to fix it?
thanks for your help