@@ -271,12 +271,8 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
271
271
272
272
// If the protocol is invertible, fall back to a global lookup instead of
273
273
// 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);
280
276
281
277
auto path = genericSig->getConformancePath (type, proto);
282
278
@@ -300,18 +296,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
300
296
if (conformance.isAbstract ()) {
301
297
// FIXME: Rip this out once we can get a concrete conformance from
302
298
// 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);
315
300
}
316
301
317
302
// For the second step, we're looking into the requirement signature for
@@ -511,9 +496,6 @@ LookUpConformanceInOverrideSubs::operator()(CanType type,
511
496
if (auto conformance = info.BaseSubMap .lookupConformance (type, proto))
512
497
return conformance;
513
498
514
- if (substType->isTypeParameter ())
515
- return ProtocolConformanceRef (proto);
516
-
517
499
return lookupConformance (substType, proto);
518
500
}
519
501
0 commit comments