Hi all
Why can’t I do the following:
julia> function crazy(T)
if T == Int
String
elseif T == String
Int
else
error("use Int or String")
end
end
crazy (generic function with 1 method)
julia> struct B{T <: Union{Int, String}}
a::crazy(T)
end
ERROR: use Int or String
Stacktrace:
[1] error(s::String)
@ Base .\error.jl:33
[2] crazy(T::TypeVar)
@ Main .\REPL[3]:7
[3] top-level scope
@ REPL[4]:1