This is related to a SO question (here):
Why does this work:
foo(x::Vector{Union{Missing, T}}) where T<:Number = sum(collect(skipmissing(x)))
foo([1, 2, missing])
>> 3
but not this
bar(x::Vector{Union{Missing, <:Number}}) = sum(collect(skipmissing(x)))
bar([1, 2, missing])
ERROR: MethodError: no method matching bar(::Array{Union{Missing, Int64},1})
Closest candidates are:
bar(::Array{Union{Missing, #s1} where #s1<:Number,1}) at REPL[58]:1
Stacktrace:
[1] top-level scope at none:0