[PrintObjC] Fix ReferencedTypeFinder::isConstrained to filter out invertible protocols

The checking should be as simple as checking for `isAny()` or `isAnyObject()`
on an existential type because all of the non-inverse protocol requirements
are going to form a protocol composition type.
This commit is contained in:
Pavel Yaskevich
2024-02-13 11:26:18 -08:00
parent 72486c975f
commit f7ce3e9983
2 changed files with 3 additions and 5 deletions

View File

@@ -78,10 +78,8 @@ class ReferencedTypeFinder : public TypeDeclFinder {
/// class-bound ("conforms to" AnyObject).
static bool isConstrained(GenericSignature sig,
GenericTypeParamType *paramTy) {
if (sig->getSuperclassBound(paramTy))
return true;
return !sig->getRequiredProtocols(paramTy).empty();
auto existentialTy = sig->getExistentialType(paramTy);
return !(existentialTy->isAny() || existentialTy->isAnyObject());
}
Action visitBoundGenericType(BoundGenericType *boundGeneric) override {