On the surface it makes sense: LoadFeedResult is Equatable if the Error in the failure case is Equatable.
This means that the protocol's associatedtype Error need to conform to Equatable, which means that whatever class implements the protocol need to have an Equatable Error type.
This means that the protocol's associatedtype Error need to conform to Equatable, which means that whatever class implements the protocol need to have an Equatable Error type.
Comments
No where in this code did we explicitly conform the Error type to Equatable:
Somehow, the compiler is saying that RemoteFeedLoader.Error conforms to Equatable.
This led me to believe that the compiler was auto-synthesizing RemoteFeedLoader.Error's conformance to Equatable.
But what conditions need to be met in order for that to happen?
Here is an enum *with* associated value types:
Since there are no associated value types the compiler says we can compare instances of this Error type and slaps on the Equatable protocol at compile time.
The more you know!