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:
@@ -34,10 +34,12 @@
|
||||
|
||||
namespace swift {
|
||||
|
||||
class SubstitutableType;
|
||||
|
||||
class SubstitutionMap {
|
||||
using ParentType = std::pair<CanType, AssociatedTypeDecl *>;
|
||||
|
||||
llvm::DenseMap<TypeBase *, Type> subMap;
|
||||
llvm::DenseMap<SubstitutableType *, Type> subMap;
|
||||
llvm::DenseMap<TypeBase *, ArrayRef<ProtocolConformanceRef>> conformanceMap;
|
||||
llvm::DenseMap<TypeBase *, SmallVector<ParentType, 1>> parentMap;
|
||||
|
||||
@@ -52,7 +54,7 @@ public:
|
||||
Optional<ProtocolConformanceRef>
|
||||
lookupConformance(CanType type, ProtocolDecl *proto) const;
|
||||
|
||||
const llvm::DenseMap<TypeBase *, Type> &getMap() const {
|
||||
const llvm::DenseMap<SubstitutableType *, Type> &getMap() const {
|
||||
return subMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user