@@ -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-
267223bool 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 }
0 commit comments