# Why does (AbstractArray{Union{Number, T}} where T \<: Nothing) != (AbstractArray{Union{Number, Nothing}})

**URL:** <https://discourse.julialang.org/t/why-does-abstractarray-union-number-t-where-t-nothing-abstractarray-union-number-nothing/19531>\
**Category:** General Usage\
**Created:** [January 11, 2019, 7:00pm UTC](https://discourse.julialang.org/t/why-does-abstractarray-union-number-t-where-t-nothing-abstractarray-union-number-nothing/19531 "2019-01-11T19:00:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ndinsmore](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ndinsmore/32/7433_2.png) [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Post date:** [January 11, 2019, 7:00pm UTC](https://discourse.julialang.org/t/why-does-abstractarray-union-number-t-where-t-nothing-abstractarray-union-number-nothing/19531/1 "2019-01-11T19:00:31Z")

</div>

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:

```julia
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

```julia
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?

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [January 11, 2019, 7:33pm UTC](https://discourse.julialang.org/t/why-does-abstractarray-union-number-t-where-t-nothing-abstractarray-union-number-nothing/19531/2 "2019-01-11T19:33:50Z")

</div>

The key is that your `T` can match anything that’s a subtype of `Nothing`. Now while it may feel like that should just be `Nothing` itself and nothing more, it also includes the “bottom” type — `Union{}`.

```julia
julia> Union{} <: (T where T <: Nothing)
true

```

Thus it’s not just substituting in a `Nothing` where that `T` goes — a `Union{}` could go there, too. And if that happens, we end up with simply:

```julia
julia> Union{Number, Union{}}
Number

```

So that means that we have an additional subtype here:

```julia
julia> AbstractArray{Number} <: AbstractArray{Union{Number, T}} where T <: Nothing
true

```
