-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Closed
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch
Description
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
Metadata
Metadata
Assignees
Labels
types and dispatchTypes, subtyping and method dispatchTypes, subtyping and method dispatch