Skip to content

Commit 13e1714

Browse files
committed
Remove PartialGenericTypeToArchetypeResolver.
1 parent 39eeb13 commit 13e1714

File tree

2 files changed

+0
-95
lines changed

2 files changed

+0
-95
lines changed

lib/Sema/GenericTypeResolver.h

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -159,35 +159,6 @@ class GenericTypeToArchetypeResolver : public GenericTypeResolver {
159159
virtual void recordParamType(ParamDecl *decl, Type ty);
160160
};
161161

162-
/// Generic type resolver that maps any generic type parameter type that
163-
/// has an underlying archetype to its corresponding archetype.
164-
///
165-
/// This generic type resolver replaces generic type parameter types that
166-
/// have archetypes with their archetypes, and leaves all other generic
167-
/// type parameter types unchanged. It is used for the initial type-checks of
168-
/// generic functions (and other generic declarations).
169-
///
170-
/// FIXME: This is not a long-term solution.
171-
class PartialGenericTypeToArchetypeResolver : public GenericTypeResolver {
172-
public:
173-
virtual Type resolveGenericTypeParamType(GenericTypeParamType *gp);
174-
175-
virtual Type resolveDependentMemberType(Type baseTy,
176-
DeclContext *DC,
177-
SourceRange baseRange,
178-
ComponentIdentTypeRepr *ref);
179-
180-
virtual Type resolveSelfAssociatedType(Type selfTy,
181-
DeclContext *DC,
182-
AssociatedTypeDecl *assocType);
183-
184-
virtual Type resolveTypeOfContext(DeclContext *dc, bool wantSelf=false);
185-
186-
virtual Type resolveTypeOfDecl(TypeDecl *decl);
187-
188-
virtual void recordParamType(ParamDecl *decl, Type ty);
189-
};
190-
191162
/// Generic type resolver that performs complete resolution of dependent
192163
/// types based on a given archetype builder.
193164
///

lib/Sema/TypeCheckGeneric.cpp

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -149,72 +149,6 @@ void GenericTypeToArchetypeResolver::recordParamType(ParamDecl *decl, Type type)
149149
type));
150150
}
151151

152-
Type PartialGenericTypeToArchetypeResolver::resolveGenericTypeParamType(
153-
GenericTypeParamType *gp) {
154-
auto gpDecl = gp->getDecl();
155-
if (!gpDecl)
156-
return Type(gp);
157-
158-
// Hack: See parseGenericParameters(). When the issue there is fixed,
159-
// we won't need the isInvalid() check anymore.
160-
if (gpDecl->isInvalid())
161-
return ErrorType::get(gpDecl->getASTContext());
162-
163-
if (!gpDecl->getDeclContext()->isValidGenericContext())
164-
return Type(gp);
165-
166-
auto *genericEnv = gpDecl->getDeclContext()->getGenericEnvironmentOfContext();
167-
return genericEnv->mapTypeIntoContext(gp);
168-
}
169-
170-
Type PartialGenericTypeToArchetypeResolver::resolveDependentMemberType(
171-
Type baseTy,
172-
DeclContext *DC,
173-
SourceRange baseRange,
174-
ComponentIdentTypeRepr *ref) {
175-
// We don't have enough information to find the associated type.
176-
// FIXME: Nonsense, but we shouldn't need this code anyway.
177-
return DependentMemberType::get(baseTy, ref->getIdentifier());
178-
}
179-
180-
Type PartialGenericTypeToArchetypeResolver::resolveSelfAssociatedType(
181-
Type selfTy,
182-
DeclContext *DC,
183-
AssociatedTypeDecl *assocType) {
184-
// We don't have enough information to find the associated type.
185-
// FIXME: Nonsense, but we shouldn't need this code anyway.
186-
return DependentMemberType::get(selfTy, assocType);
187-
}
188-
189-
Type
190-
PartialGenericTypeToArchetypeResolver::resolveTypeOfContext(DeclContext *dc,
191-
bool wantSelf) {
192-
if (dc->isGenericContext() && dc->isValidGenericContext())
193-
return dc->mapTypeIntoContext(getTypeOfContext(dc, wantSelf));
194-
return getTypeOfContext(dc, wantSelf);
195-
}
196-
197-
Type
198-
PartialGenericTypeToArchetypeResolver::resolveTypeOfDecl(TypeDecl *decl) {
199-
// Hack for 'out of context' GenericTypeParamDecls when resolving
200-
// a generic typealias
201-
if (auto *paramDecl = dyn_cast<GenericTypeParamDecl>(decl)) {
202-
return decl->getDeclContext()->getGenericEnvironmentOfContext()
203-
->mapTypeIntoContext(paramDecl->getDeclaredInterfaceType()
204-
->castTo<GenericTypeParamType>());
205-
}
206-
207-
auto *aliasDecl = cast<TypeAliasDecl>(decl);
208-
if (aliasDecl->isInvalid())
209-
return ErrorType::get(aliasDecl->getASTContext());
210-
return aliasDecl->getAliasType();
211-
}
212-
213-
void
214-
PartialGenericTypeToArchetypeResolver::recordParamType(ParamDecl *decl, Type type) {
215-
// Do nothing
216-
}
217-
218152
Type CompleteGenericTypeResolver::resolveGenericTypeParamType(
219153
GenericTypeParamType *gp) {
220154
auto gpDecl = gp->getDecl();

0 commit comments

Comments
 (0)