AST: Fix warning about missing return in SubstitutionMap::getProtocolSubstitutions()

The branch without the return is actually unreachable, so let's
add an assert.
This commit is contained in:
Slava Pestov
2017-02-06 21:32:33 -08:00
parent f9c52b1205
commit e98ac967d4

View File

@@ -229,15 +229,14 @@ SubstitutionMap::getProtocolSubstitutions(ProtocolDecl *protocol,
auto protocolSelfType = protocol->getSelfInterfaceType();
return protocol->getGenericSignature()->getSubstitutionMap(
[&](SubstitutableType *type) -> Type {
if (type->isEqual(protocolSelfType))
return selfType;
assert(type->isEqual(protocolSelfType));
return selfType;
},
[&](CanType origType, Type replacementType, ProtocolType *protoType)
-> ProtocolConformanceRef {
if (origType->isEqual(protocolSelfType) &&
protoType->getDecl() == protocol)
return conformance;
llvm_unreachable("Should not get any other conformance queries here");
assert(origType->isEqual(protocolSelfType) &&
protoType->getDecl() == protocol);
return conformance;
});
}