Hi, I am trying to define a struct that can take an Array of type T or a nothing, as recommended since Nullables has been deprecated.
using Compat
struct bar{T <: Real, M <: String}
a::Union{Nothing,Array{T}}
b::Array{M}
end
foo = bar(nothing, ["a", "b"])
But I get this error
MethodError: no method matching bar(::Void, ::Array{String,1})
Closest candidates are:
bar(::Union{Array{T<:Real,N} where N, Void}, ::Array{M<:String,N} where N) where {T<:Real, M<:String} at In[37]:2
Which seems very contradictory since the error shows the declared union as possible.