Skip to content

Commit 808c42b

Browse files
authored
Merge pull request #71585 from xedin/fix-printobjc-protocol-requirements-checking
[PrintObjC] Fix `ReferencedTypeFinder::isConstrained` to filter out i…
2 parents 79fcb5e + 14e0756 commit 808c42b

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

lib/AST/GenericSignature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,4 +1386,4 @@ void RequirementSignature::getRequirementsWithInverses(
13861386

13871387
reqs.push_back(req);
13881388
}
1389-
}
1389+
}

lib/PrintAsClang/ModuleContentsWriter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,8 @@ class ReferencedTypeFinder : public TypeDeclFinder {
7878
/// class-bound ("conforms to" AnyObject).
7979
static bool isConstrained(GenericSignature sig,
8080
GenericTypeParamType *paramTy) {
81-
if (sig->getSuperclassBound(paramTy))
82-
return true;
83-
84-
return !sig->getRequiredProtocols(paramTy).empty();
81+
auto existentialTy = sig->getExistentialType(paramTy);
82+
return !(existentialTy->isAny() || existentialTy->isAnyObject());
8583
}
8684

8785
Action visitBoundGenericType(BoundGenericType *boundGeneric) override {

lib/Sema/CSApply.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,7 @@ static bool isOpenedAnyObject(Type type) {
7777
if (!archetype || !archetype->isRoot())
7878
return false;
7979

80-
return (archetype->requiresClass() &&
81-
archetype->getConformsTo().empty() &&
82-
!archetype->getSuperclass());
80+
return archetype->getExistentialType()->isAnyObject();
8381
}
8482

8583
SubstitutionMap

0 commit comments

Comments
 (0)