@@ -271,12 +271,8 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
271271
272272 // If the protocol is invertible, fall back to a global lookup instead of
273273 // evaluating a conformance path, to avoid an infinite substitution issue.
274- if (proto->getInvertibleProtocolKind ()) {
275- auto substType = type.subst (*this );
276- if (!substType->isTypeParameter ())
277- return swift::lookupConformance (substType, proto);
278- return ProtocolConformanceRef (proto);
279- }
274+ if (proto->getInvertibleProtocolKind ())
275+ return swift::lookupConformance (type.subst (*this ), proto);
280276
281277 auto path = genericSig->getConformancePath (type, proto);
282278
@@ -300,18 +296,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
300296 if (conformance.isAbstract ()) {
301297 // FIXME: Rip this out once we can get a concrete conformance from
302298 // an archetype.
303- auto substType = type.subst (*this );
304- if (substType->hasError ())
305- return ProtocolConformanceRef (proto);
306-
307- if ((!substType->is <ArchetypeType>() ||
308- substType->castTo <ArchetypeType>()->getSuperclass ()) &&
309- !substType->isTypeParameter () &&
310- !substType->isExistentialType ()) {
311- return swift::lookupConformance (substType, proto);
312- }
313-
314- return ProtocolConformanceRef (proto);
299+ return swift::lookupConformance (type.subst (*this ), proto);
315300 }
316301
317302 // For the second step, we're looking into the requirement signature for
@@ -511,9 +496,6 @@ LookUpConformanceInOverrideSubs::operator()(CanType type,
511496 if (auto conformance = info.BaseSubMap .lookupConformance (type, proto))
512497 return conformance;
513498
514- if (substType->isTypeParameter ())
515- return ProtocolConformanceRef (proto);
516-
517499 return lookupConformance (substType, proto);
518500}
519501
0 commit comments