You're right that your conformance should/could work, but this part is wrong, throwing people off guard. It's the other way around; Any value of type General
is, by it's definition, also a value of type A
, i.e., you can cast General
to A
.
So, if we use <
as a subtype relationship, then
General
<A
,- Since function argument is contravariant,
(A) -> Self
<(General) -> Self
- Now, as class method is covariant w.r.t. its class. It follows that
Sub < P
as we'd like.
The question now is, whether Swift accept the last relationship, because iirc, it doesn't allow methods with subtype signature to satisfy protocol requirement yet.
Well, the requirements form a union, but the typing forms an intersection. So you might be talking past each other here.