Incorrect concrete type for Vector{Pair{Any, Any}}?

Yes, this is correct and expected behaviour. Vector{Pair{Any, Any}} is a concrete type that can be instantiated, it would be a vector of pairs of different types. Concrete types cannot have subtypes, therefore Vector{Pair{Int, Int}} cannot be its subtype.

This has to do with invariant and contravariant types, you can read more about this here: Types · The Julia Language

In particular, you can find this warning in the docs:

This last point is very important: even though Float64 <: Real we DO NOT have Point{Float64} <: Point{Real} .

An alternative convenient test could be

1.7.0> [1=>2] isa Vector{<:Pair}
true
6 Likes