Skip to content

Commit 400accb

Browse files
authored
Merge pull request swiftlang#33871 from AnthonyLatsis/o-some
2 parents 107ba0b + 1926cc7 commit 400accb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lib/AST/ASTContext.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4556,12 +4556,18 @@ CanGenericSignature ASTContext::getSingleGenericParameterSignature() const {
45564556
// constraints while existential values do.
45574557
CanGenericSignature ASTContext::getOpenedArchetypeSignature(CanType existential,
45584558
ModuleDecl *mod) {
4559+
assert(existential.isExistentialType());
4560+
4561+
// The opened archetype signature for a protocol type is identical
4562+
// to the protocol's own canonical generic signature.
4563+
if (const auto protoTy = dyn_cast<ProtocolType>(existential)) {
4564+
return protoTy->getDecl()->getGenericSignature()->getCanonicalSignature();
4565+
}
4566+
45594567
auto found = getImpl().ExistentialSignatures.find(existential);
45604568
if (found != getImpl().ExistentialSignatures.end())
45614569
return found->second;
45624570

4563-
assert(existential.isExistentialType());
4564-
45654571
auto genericParam = GenericTypeParamType::get(0, 0, *this);
45664572
Requirement requirement(RequirementKind::Conformance, genericParam,
45674573
existential);

0 commit comments

Comments
 (0)