When is the signature of a method is a UnionAll?

let’s assume that I have a function f, and it has few methods.
I want to see an example where one of those methods’ signature is UnionAll instead of Tuple?

Is there such an example?

And as my second question, you can see the type of field named “sig” is Type.
So it can be Tuple, UnionAll or some other type? What are the commonly used types for method signature?


julia> f(x::Vector{T}) where T = 0
f (generic function with 1 method)

julia> methods(f).ms[1].sig
Tuple{typeof(f),Array{T,1}} where T

julia> typeof(methods(f).ms[1].sig)

The signature is basically the tuple type (could be union(all) of it) that is describing the argument tuple. What do you want to do with them? (i.e. why are you interested in the “commonly used types” there, do you have something more specific in mind).

Thank you, I have an idea about covariant and contravariant dispatch.