Simplify the interface to Module::lookupConformance.

Rather than returning a weird PointerIntPair, return an
Optional<ProtocolConformanceRef>. NFC
This commit is contained in:
Doug Gregor
2016-03-15 22:07:14 -07:00
parent b051c5a70f
commit a31edf53d0
15 changed files with 122 additions and 175 deletions

View File

@@ -358,12 +358,13 @@ SpecializedProtocolConformance::getTypeWitnessSubstAndDecl(
for (auto proto : assocType->getConformingProtocols(resolver)) {
auto conforms = conformingModule->lookupConformance(specializedType, proto,
resolver);
assert((conforms.getInt() == ConformanceKind::Conforms ||
assert((conforms ||
specializedType->is<TypeVariableType>() ||
specializedType->isTypeParameter() ||
specializedType->is<ErrorType>()) &&
"Improperly checked substitution");
conformances.push_back(ProtocolConformanceRef(proto, conforms.getPointer()));
conformances.push_back(conforms ? *conforms
: ProtocolConformanceRef(proto));
}
// Form the substitution.