mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
AST: Cache protocol generic signature in GenericContext::getGenericSignature()
The generic signature of a protocol is simple enough that we can build it directly when asked. However, be sure to cache it for future use.
This commit is contained in:
@@ -583,7 +583,11 @@ Type ConstraintSystem::openType(Type type, OpenedTypeMap &replacements) {
|
||||
if (auto genericParam = type->getAs<GenericTypeParamType>()) {
|
||||
auto known = replacements.find(
|
||||
cast<GenericTypeParamType>(genericParam->getCanonicalType()));
|
||||
assert(known != replacements.end());
|
||||
// FIXME: This should be an assert, however protocol generic signatures
|
||||
// drop outer generic parameters.
|
||||
// assert(known != replacements.end());
|
||||
if (known == replacements.end())
|
||||
return ErrorType::get(TC.Context);
|
||||
return known->second;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user