mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user