I have the definitions:
func compare<T>(lhs: T, rhs: T) -> Bool where T: Equatable {
return lhs == rhs
}
func compare<T>(lhs: T, rhs: T) -> Bool where T: AnyObject {
return lhs === rhs
}
func compare<T>(lhs: T, rhs: T) -> Bool {
return false
}
When I call compare on an reference type object that also conforms to Equatable, how does the compiler decide which of these functions to call?
A full accepted answer would be link to official swift manifesto explaining how the priority is done, especially when the generic conforms to two different protocols that both have specializations