Open theMomax opened 2 years ago
The bug is a consequence of the fact that SymbolGraph::recordDefaultImplementationRelationships()
seems to implement it's own thing here: https://github.com/apple/swift/blob/9ee5d6b34291ebfc89f57068ed89842285dc9688/lib/SymbolGraphGen/SymbolGraph.cpp#L410
TypeChecker::inferDefaultWitnesses()
already computes this information, and records it in eg ProtocolDecl::getDefaultWitness()
.
Describe the bug
Members that are marked as
throws
and/orasync
are recorded as default implementation targets for protocol requirements without the respective keyword(s).This is caused by the name-based comparison here:
Steps To Reproduce
public extension E { func foo() throws { } }
Expected behavior The detection of default implementation should follow the rules applied by the Swift compiler, i.e. a member can only implement a protocol requirement if it requires a subset of the call modifiers (
try
,await
) required by the protocol requirement.E.g. in the example above, the implementation cannot implement the requirement because the former
throws
, whereas the latter doesn't:Environment (please fill out the following information)