Hello!
Why is it that
Union{Missing, Float64} <: Union{Any}
yields
true
but
Matrix{Union{Missing, Float64}} <: Matrix{Union{Any}}
yields
false
Hello!
Why is it that
Union{Missing, Float64} <: Union{Any}
yields
true
but
Matrix{Union{Missing, Float64}} <: Matrix{Union{Any}}
yields
false
Julia’s type system uses invariant type parameters.
You instead want
julia> Matrix{Union{Missing, Float64}} <: Matrix{<:Union{Any}}
true
or
julia> Matrix{<:Union{Missing, Float64}} <: Matrix{<:Union{Any}}
true
This is an example of how Julia’s type parameters are invariant. This is discussed in some depth in Types · The Julia Language.