AST: Hack around edge case due to broken abstract conformance representation

A substitution map might store an abstract conformance even if the
replacement type is an archetype that conforms concretely via a
superclass requirement.

This is because when we build the substitution map, if the archetype
is represented by a type parameter, we don't have enough information
to know if it will conform abstractly or concretely.
This commit is contained in:
Slava Pestov
2022-07-28 22:43:38 -04:00
parent 69bb2a797f
commit 2686ce37bb
3 changed files with 25 additions and 3 deletions

View File

@@ -638,6 +638,9 @@ SubstitutionMap::combineSubstitutionMaps(SubstitutionMap firstSubMap,
// Some combination of storing substitution maps in BoundGenericTypes
// as well as for method overrides would solve this, but for now, just
// punt to module lookup.
if (substType->isTypeParameter())
return ProtocolConformanceRef(proto);
return proto->getParentModule()->lookupConformance(substType, proto);
});
}