# Supertype of \`Dict\` with \`Vector{\<:Pair}\` as key values

**URL:** <https://discourse.julialang.org/t/supertype-of-dict-with-vector-pair-as-key-values/66345>\
**Category:** General Usage\
**Tags:** type, dictionary\
**Created:** [August 13, 2021, 3:27pm UTC](https://discourse.julialang.org/t/supertype-of-dict-with-vector-pair-as-key-values/66345 "2021-08-13T15:27:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![frankwswang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frankwswang/32/18561_2.png) [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Post date:** [August 13, 2021, 3:27pm UTC](https://discourse.julialang.org/t/supertype-of-dict-with-vector-pair-as-key-values/66345/1 "2021-08-13T15:27:09Z")

</div>

So I was trying to find the type of something like a `Dict(1=>[:a=>1], 2=>[:b=>2])` for function argument type specification and it’s easy to see that since the key values are `Vector{<:Pair}`, the Dict is a `Dict{Int64, <:Vector{<:Pair}}`:

```julia
julia> t1 = typeof(Dict(1=>[:a=>1], 2=>[:b=>2]))
Dict{Int64, Vector{Pair{Symbol, Int64}}}

julia> supertypes(t1)
(Dict{Int64, Vector{Pair{Symbol, Int64}}}, AbstractDict{Int64, Vector{Pair{Symbol, Int64}}}, Any)

julia> t2 = Dict{Int64, <:Vector{<:Pair}}
Dict{Int64, var"#s18"} where var"#s18"<:(Vector{var"#s19"} where var"#s19"<:Pair)

julia> t1 <: t2
true

julia> [:a=>1] isa Vector{<:Pair}
true

```

In the above case, as I demonstrated, the key values in the `Pair` `Vector` element are all `Int` (e.g. `1` in `:a=>1`) but I don’t think if I relax the type constrain (to `Any` or something) the `t1 <: t2` relation would fail since those vectors are still `Vector{<:Pair}`:

```julia
julia> ([:a=>1], [:c=>3.0]) isa Tuple{Vararg{Vector{<:Pair}}}
true

```

However, I got the following result:

```julia
julia> t3 = typeof(Dict(1=>[:a=>1], 3=>[:c=>3.0]))
Dict{Int64, Vector{T} where T}

julia> t3 <: t2
false

```

where the type system directly marks the `Vector{<:Pair}` as `Vector{T} where T`. Am I missing something here or is this a bug? Thank you!
