mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AST] Narrow TypeSubstitutionMap to SubstitutableType keys.
Type substitution works on a fairly narrow set of types: generic type parameters (to, e.g., use a generic) and archetypes (to map out of a generic context). Historically, it was also used with DependentMemberTypes, but recent refactoring to eliminate witness markers eliminate that code path. Therefore, narrow TypeSubstitutionMap's keys to SubstitutableType, which covers archetypes and generic type parameters. NFC
This commit is contained in:
@@ -79,7 +79,8 @@ Type GenericEnvironment::mapTypeIntoContext(ModuleDecl *M, Type type) const {
|
||||
|
||||
Type GenericEnvironment::mapTypeIntoContext(GenericTypeParamType *type) const {
|
||||
auto canTy = type->getCanonicalType();
|
||||
auto found = InterfaceToArchetypeMap.find(canTy.getPointer());
|
||||
auto found =
|
||||
InterfaceToArchetypeMap.find(canTy->castTo<GenericTypeParamType>());
|
||||
assert(found != InterfaceToArchetypeMap.end() &&
|
||||
"missing generic parameter");
|
||||
return found->second;
|
||||
|
||||
Reference in New Issue
Block a user