In the search to find something that would match an Vector{Union{MyType,Nothing}}
and Vector{MyType}
but not Vector{Nothing}
.
I found the signature that works is Vector{Union{MyType,T}} where T<:Nothing
, but now I need to understand why.
Because apparently:
true == (AbstractArray{Union{Number, Nothing}}) <: (AbstractArray{Union{Number, T}} where T <: Nothing)
false == (AbstractArray{Union{Number, Nothing}}) :> (AbstractArray{Union{Number, T}} where T <: Nothing)
but strangely if you simplify further
true == Union{Number, Nothing} <: (Union{Number, T} where T <: Nothing)
true == Union{Number, Nothing} :> (Union{Number, T} where T <: Nothing)
true == Union{Number, Nothing} == (Union{Number, T} where T <: Nothing)
Is there any easy way to expalain why that happens?