-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
The code
abstract MyType{T}
f{T}(::MyType{T}, ::T) = 1
f{S}(::S, ::MyType{S}) = 2
produces the ambiguity warning
Warning: New definition f(S,MyType{S}) is ambiguous with f(MyType{T},T).
Make sure f(MyType{T},MyType{S}) is defined first.
This seems like
S has been instantiated to MyType{T} in the intersection, and
T has been instantiated to MyType{S}.
But that would mean that T == MyType{MyType{T}}. No type could fulfill this, right?
(8 out of the 19 ambiguity warnings here seem to be of this kind.)
The similar case
g{T}(::MyType{T}, ::T) = 1
g{S}(::S, ::S) = 2
does not produce an ambiguity warning, though it would have been ambiguous if there were a type T such that T == MyType{T}.
Metadata
Metadata
Assignees
Labels
No labels