File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -978,13 +978,17 @@ ModuleDecl::lookupExistentialConformance(Type type, ProtocolDecl *protocol) {
978
978
// existential to an archetype parameter, so for now we restrict this to
979
979
// @objc protocols and marker protocols.
980
980
if (!layout.isObjC () && !protocol->isMarkerProtocol ()) {
981
+ auto constraint = type;
982
+ if (auto existential = constraint->getAs <ExistentialType>())
983
+ constraint = existential->getConstraintType ();
984
+
981
985
// There's a specific exception for protocols with self-conforming
982
986
// witness tables, but the existential has to be *exactly* that type.
983
987
// TODO: synthesize witness tables on-demand for protocol compositions
984
988
// that can satisfy the requirement.
985
989
if (protocol->requiresSelfConformanceWitnessTable () &&
986
- type ->is <ProtocolType>() &&
987
- type ->castTo <ProtocolType>()->getDecl () == protocol)
990
+ constraint ->is <ProtocolType>() &&
991
+ constraint ->castTo <ProtocolType>()->getDecl () == protocol)
988
992
return ProtocolConformanceRef (ctx.getSelfConformance (protocol));
989
993
990
994
return ProtocolConformanceRef::forInvalid ();
You can’t perform that action at this time.
0 commit comments