Call hierarchy across protocol boundaries

One of the more frustrating limitations of Xcode’s “Find Call Hierarchy” feature is that it does not cross protocol boundaries: Even if a function on a concrete type satisfies a protocol requirement its call hierarchy does not include calls to the protocol type.

(Why) does it have to be this way?

1 Like

Xcode-specific questions are generally off-topic here, but it seems to be that considering callers of a protocol method to be callers of each concrete type’s implementation of that method is too broad. There is no way to prove in general if at a given call site, a generic parameter constrained to to some protocol P, will be substituted with any specific concrete type conforming to P. So if you’re looking at the callers of MyComcreteType.==, it’s probably not useful to see every place that == is called from a generic context.

True, but that case is maybe overly generic (pun intended). In the simpler case where there are (non-generic) protocols with a production and a mock implementation each it would be really helpful in following the control flow.

1 Like