Skip to content

Commit 2a82dda

Browse files
committed
AST: Remove QueryTypeSubstitutionMapOrIdentity
1 parent 388a2d7 commit 2a82dda

File tree

2 files changed

+0
-30
lines changed

2 files changed

+0
-30
lines changed

include/swift/AST/Type.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,6 @@ struct QueryTypeSubstitutionMap {
8787
Type operator()(SubstitutableType *type) const;
8888
};
8989

90-
/// A function object suitable for use as a \c TypeSubstitutionFn that
91-
/// queries an underlying \c TypeSubstitutionMap, or returns the original type
92-
/// if no match was found.
93-
struct QueryTypeSubstitutionMapOrIdentity {
94-
const TypeSubstitutionMap &substitutions;
95-
96-
Type operator()(SubstitutableType *type) const;
97-
};
98-
9990
/// Function used to resolve conformances.
10091
using GenericFunction = auto(CanType dependentType,
10192
Type conformingReplacementType,

lib/AST/TypeSubstitution.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,27 +50,6 @@ Type QueryTypeSubstitutionMap::operator()(SubstitutableType *type) const {
5050
return Type();
5151
}
5252

53-
Type
54-
QueryTypeSubstitutionMapOrIdentity::operator()(SubstitutableType *type) const {
55-
// FIXME: Type::subst should not be pass in non-root archetypes.
56-
// Consider only root archetypes.
57-
if (auto *archetype = dyn_cast<ArchetypeType>(type)) {
58-
if (!archetype->isRoot())
59-
return Type();
60-
}
61-
62-
auto key = type->getCanonicalType()->castTo<SubstitutableType>();
63-
auto known = substitutions.find(key);
64-
if (known != substitutions.end() && known->second)
65-
return known->second;
66-
67-
if (isa<PackArchetypeType>(type) || type->isRootParameterPack()) {
68-
return PackType::getSingletonPackExpansion(type);
69-
}
70-
71-
return type;
72-
}
73-
7453
Type QuerySubstitutionMap::operator()(SubstitutableType *type) const {
7554
auto key = cast<SubstitutableType>(type->getCanonicalType());
7655
return subMap.lookupSubstitution(key);

0 commit comments

Comments
 (0)