Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions lib/AST/SubstitutionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,19 +353,17 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
return None;
};

// Check whether the superclass conforms.
if (auto superclass = genericSig->getSuperclassBound(type)) {
LookUpConformanceInSignature lookup(*getGenericSignature());
if (auto conformance = lookup(type->getCanonicalType(), superclass, proto))
return conformance;
}

// If the type doesn't conform to this protocol, the result isn't formed
// from these requirements.
if (!genericSig->conformsToProtocol(type, proto)) {
// Check whether the superclass conforms.
if (auto superclass = genericSig->getSuperclassBound(type)) {
return LookUpConformanceInSignature(*getGenericSignature())(
type->getCanonicalType(),
superclass,
proto);
}

if (!genericSig->conformsToProtocol(type, proto))
return None;
}

auto accessPath =
genericSig->getConformanceAccessPath(type, proto);
Expand Down