Consider the following:
struct XX end
struct YY end
bar(a::A, b::B, c::C) where Tuple{A,B}<:C<:Union{Tuple{XX,YY}, Tuple{YY,XX}} where A where B = C
@show bar(XX(), YY(), (XX(),YY()))
gives:
julia> @show bar(XX(), YY(), (XX(),YY()))
ERROR: UndefVarError: C not defined
Stacktrace:
[1] bar(::XX, ::YY, ::Tuple{XX,YY}) at ./REPL[3]:1
Expected is to return Tuple{XX,YY}
Similarly:
julia> @show bar(YY(), XX(), (YY(),XX()))
ERROR: UndefVarError: C not defined
Stacktrace:
[1] bar(::YY, ::XX, ::Tuple{YY,XX}) at ./REPL[3]:1
Expected is to return Tuple{YY,XX}
For interest:
bar(XX(), YY(), (XX(), XX()) and bar(XX(), XX(), (XX(), XX()) , and bar(XX(), XX(), (YY(),YY())) and bar(YY(), YY(), (YY(),YY())) and bar(YY(),XX(), (YY(),YY())) give method errors
Consider the following:
gives:
Expected is to return
Tuple{XX,YY}Similarly:
Expected is to return
Tuple{YY,XX}For interest:
bar(XX(), YY(), (XX(), XX())andbar(XX(), XX(), (XX(), XX()), andbar(XX(), XX(), (YY(),YY()))andbar(YY(), YY(), (YY(),YY()))andbar(YY(),XX(), (YY(),YY()))give method errors