@@ -200,10 +200,6 @@ operator()(CanType dependentType, Type conformingReplacementType,
200
200
ProtocolConformanceRef LookUpConformanceInSubstitutionMap::
201
201
operator ()(CanType dependentType, Type conformingReplacementType,
202
202
ProtocolDecl *conformedProtocol) const {
203
- auto result = Subs.lookupConformance (dependentType, conformedProtocol);
204
- if (!result.isInvalid ())
205
- return result;
206
-
207
203
// Lookup conformances for archetypes that conform concretely
208
204
// via a superclass.
209
205
if (auto archetypeType = conformingReplacementType->getAs <ArchetypeType>()) {
@@ -212,10 +208,15 @@ operator()(CanType dependentType, Type conformingReplacementType,
212
208
/* allowMissing=*/ true );
213
209
}
214
210
211
+ auto result = Subs.lookupConformance (dependentType, conformedProtocol);
212
+ if (!result.isInvalid ())
213
+ return result;
214
+
215
215
// Otherwise, the original type might be fixed to a concrete type in
216
216
// the substitution map's input generic signature.
217
217
if (auto genericSig = Subs.getGenericSignature ()) {
218
- if (genericSig->isConcreteType (dependentType)) {
218
+ if (genericSig->isValidTypeParameter (dependentType) &&
219
+ genericSig->isConcreteType (dependentType)) {
219
220
return conformedProtocol->getModuleContext ()->lookupConformance (
220
221
conformingReplacementType, conformedProtocol,
221
222
/* allowMissing=*/ true );
0 commit comments