@@ -220,10 +220,6 @@ operator()(CanType dependentType, Type conformingReplacementType,
220
220
ProtocolConformanceRef LookUpConformanceInSubstitutionMap::
221
221
operator ()(CanType dependentType, Type conformingReplacementType,
222
222
ProtocolDecl *conformedProtocol) const {
223
- auto result = Subs.lookupConformance (dependentType, conformedProtocol);
224
- if (!result.isInvalid ())
225
- return result;
226
-
227
223
// Lookup conformances for archetypes that conform concretely
228
224
// via a superclass.
229
225
if (auto archetypeType = conformingReplacementType->getAs <ArchetypeType>()) {
@@ -232,10 +228,15 @@ operator()(CanType dependentType, Type conformingReplacementType,
232
228
/* allowMissing=*/ true );
233
229
}
234
230
231
+ auto result = Subs.lookupConformance (dependentType, conformedProtocol);
232
+ if (!result.isInvalid ())
233
+ return result;
234
+
235
235
// Otherwise, the original type might be fixed to a concrete type in
236
236
// the substitution map's input generic signature.
237
237
if (auto genericSig = Subs.getGenericSignature ()) {
238
- if (genericSig->isConcreteType (dependentType)) {
238
+ if (genericSig->isValidTypeParameter (dependentType) &&
239
+ genericSig->isConcreteType (dependentType)) {
239
240
return conformedProtocol->getModuleContext ()->lookupConformance (
240
241
conformingReplacementType, conformedProtocol,
241
242
/* allowMissing=*/ true );
0 commit comments