Skip to content

Commit 9e44aee

Browse files
committed
Sema: Remove TypeResolver::resolveSelfAssociatedType()
1 parent 75ab840 commit 9e44aee

File tree

2 files changed

+1
-51
lines changed

2 files changed

+1
-51
lines changed

lib/Sema/TypeCheckType.cpp

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -220,50 +220,6 @@ Type TypeResolution::resolveDependentMemberType(
220220
baseTy);
221221
}
222222

223-
Type TypeResolution::resolveSelfAssociatedType(Type baseTy,
224-
DeclContext *DC,
225-
Identifier name) const {
226-
switch (stage) {
227-
case TypeResolutionStage::Structural:
228-
return DependentMemberType::get(baseTy, name);
229-
230-
case TypeResolutionStage::Interface:
231-
// Handled below.
232-
break;
233-
}
234-
235-
assert(stage == TypeResolutionStage::Interface);
236-
auto genericSig = getGenericSignature();
237-
if (!genericSig)
238-
return ErrorType::get(baseTy);
239-
240-
// Look for a nested type with the given name.
241-
auto nestedType = genericSig->lookupNestedType(baseTy, name);
242-
assert(nestedType);
243-
244-
// If the nested type has been resolved to an associated type, use it.
245-
if (auto assocType = dyn_cast<AssociatedTypeDecl>(nestedType)) {
246-
return DependentMemberType::get(baseTy, assocType);
247-
}
248-
249-
if (nestedType->getDeclContext()->getSelfClassDecl()) {
250-
// We found a member of a class from a protocol or protocol
251-
// extension.
252-
//
253-
// Get the superclass of the 'Self' type parameter.
254-
if (auto concreteTy = genericSig->getConcreteType(baseTy))
255-
baseTy = concreteTy;
256-
else {
257-
baseTy = genericSig->getSuperclassBound(baseTy);
258-
assert(baseTy);
259-
}
260-
assert(baseTy);
261-
}
262-
263-
return TypeChecker::substMemberTypeWithBase(DC->getParentModule(), nestedType,
264-
baseTy);
265-
}
266-
267223
bool TypeResolution::areSameType(Type type1, Type type2) const {
268224
if (type1->isEqual(type2))
269225
return true;
@@ -462,8 +418,7 @@ Type TypeResolution::resolveTypeInContext(TypeDecl *typeDecl,
462418
// the Collection.SubSequence default, even when the conforming
463419
// type wants to conform to Collection.
464420
if (getStage() == TypeResolutionStage::Structural) {
465-
return resolveSelfAssociatedType(selfType, foundDC,
466-
typeDecl->getName());
421+
return DependentMemberType::get(selfType, typeDecl->getName());
467422
} else if (auto assocType = dyn_cast<AssociatedTypeDecl>(typeDecl)) {
468423
typeDecl = assocType->getAssociatedTypeAnchor();
469424
}

lib/Sema/TypeCheckType.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,6 @@ class TypeResolution {
452452
SourceRange baseRange,
453453
ComponentIdentTypeRepr *ref) const;
454454

455-
/// Resolve an unqualified reference to an associated type or type alias
456-
/// in a protocol.
457-
Type resolveSelfAssociatedType(Type baseTy, DeclContext *DC,
458-
Identifier name) const;
459-
460455
/// Determine whether the given two types are equivalent within this
461456
/// type resolution context.
462457
bool areSameType(Type type1, Type type2) const;

0 commit comments

Comments
 (0)