[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:
Doug Gregor
2016-11-15 11:34:09 -08:00
parent 6bfd219e14
commit 85ba4fe40f
14 changed files with 32 additions and 29 deletions

View File

@@ -644,7 +644,8 @@ bool CSE::processOpenExistentialRef(SILInstruction *Inst, ValueBase *V,
auto OldOpenedArchetype = getOpenedArchetypeOf(Inst);
auto NewOpenedArchetype = getOpenedArchetypeOf(dyn_cast<SILInstruction>(V));
TypeSubstitutionMap TypeSubstMap;
TypeSubstMap[OldOpenedArchetype.getPointer()] = NewOpenedArchetype;
TypeSubstMap[OldOpenedArchetype->castTo<ArchetypeType>()] =
NewOpenedArchetype;
// Collect all candidates that may contain opened archetypes
// that need to be replaced.
for (auto Use : Inst->getUses()) {