mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +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:
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user