Why is Vector{Float16} <: AbstractVector{AbstractFloat} being false?

julia> Float16 <: AbstractFloat
true

julia> Vector{Float16} <: AbstractVector
true

julia> Vector{Float16} <: AbstractVector{AbstractFloat}
false

why?

See https://docs.julialang.org/en/v1.1/manual/types/index.html#Parametric-Composite-Types-1. AbstractVector{<:AbstractFloat}, or, equivalently, AbstractVector{T} where T<:AbstractFloat should do what you want.

3 Likes