Skip to content

[AST] Use CanType in SubstitutionMap #14290

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 31, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/swift/AST/SubstitutionMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class SubstitutionMap {

// FIXME: Switch to a more efficient representation that corresponds to
// the conformance requirements in the GenericSignature.
llvm::DenseMap<TypeBase *, SmallVector<ProtocolConformanceRef, 1>>
llvm::DenseMap<CanType, SmallVector<ProtocolConformanceRef, 1>>
conformanceMap;

/// Retrieve the array of replacement types, which line up with the
Expand Down
4 changes: 2 additions & 2 deletions lib/AST/SubstitutionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
// Retrieve the starting conformance from the conformance map.
auto getInitialConformance =
[&](Type type, ProtocolDecl *proto) -> Optional<ProtocolConformanceRef> {
auto known = conformanceMap.find(type->getCanonicalType().getPointer());
auto known = conformanceMap.find(type->getCanonicalType());
if (known == conformanceMap.end())
return None;

Expand Down Expand Up @@ -266,7 +266,7 @@ SubstitutionMap::lookupConformance(CanType type, ProtocolDecl *proto) const {
void SubstitutionMap::
addConformance(CanType type, ProtocolConformanceRef conformance) {
assert(!isa<ArchetypeType>(type));
conformanceMap[type.getPointer()].push_back(conformance);
conformanceMap[type].push_back(conformance);
}

SubstitutionMap SubstitutionMap::subst(const SubstitutionMap &subMap) const {
Expand Down