@@ -818,7 +818,7 @@ const void *RequirementSource::getOpaqueStorage1() const {
818818 return storage.type ;
819819
820820 case StorageKind::AssociatedTypeDecl:
821- return storage.dependentMember ;
821+ return storage.assocType ;
822822 }
823823
824824 llvm_unreachable (" Unhandled StorageKind in switch." );
@@ -918,16 +918,11 @@ bool RequirementSource::isSelfDerivedSource(GenericSignatureBuilder &builder,
918918// / the nested type. This limited operation makes sure that it does not
919919// / create any new potential archetypes along the way, so it should only be
920920// / used in cases where we're reconstructing something that we know exists.
921- static Type replaceSelfWithType (llvm::DenseMap<Type, Type> &cache,
922- Type selfType, Type depTy) {
921+ static Type replaceSelfWithType (Type selfType, Type depTy) {
923922 if (auto depMemTy = depTy->getAs <DependentMemberType>()) {
924- Type baseType = replaceSelfWithType (cache, selfType, depMemTy->getBase ());
923+ Type baseType = replaceSelfWithType (selfType, depMemTy->getBase ());
925924 assert (depMemTy->getAssocType () && " Missing associated type" );
926- auto &known = cache[baseType];
927- if (!known) {
928- known = DependentMemberType::get (baseType, depMemTy->getAssocType ());
929- }
930- return known;
925+ return DependentMemberType::get (baseType, depMemTy->getAssocType ());
931926 }
932927
933928 assert (depTy->is <GenericTypeParamType>() && " missing Self?" );
@@ -1371,8 +1366,8 @@ RequirementSource::visitPotentialArchetypesAlongPath(
13711366
13721367 if (visitor (parentType, this )) return nullptr ;
13731368
1374- return replaceSelfWithType (ReplacedSelfCache ,
1375- parentType, getDependentMember ());
1369+ return replaceSelfWithType (parentType ,
1370+ getAssociatedType ()-> getDeclaredInterfaceType ());
13761371 }
13771372
13781373 case RequirementSource::NestedTypeNameMatch:
@@ -1407,8 +1402,7 @@ RequirementSource::visitPotentialArchetypesAlongPath(
14071402
14081403 if (visitor (parentType, this )) return nullptr ;
14091404
1410- return replaceSelfWithType (ReplacedSelfCache,
1411- parentType, getStoredType ());
1405+ return replaceSelfWithType (parentType, getStoredType ());
14121406 }
14131407 }
14141408 llvm_unreachable (" unhandled kind" );
@@ -1442,7 +1436,7 @@ ProtocolDecl *RequirementSource::getProtocolDecl() const {
14421436 return getProtocolConformance ().getRequirement ();
14431437
14441438 case StorageKind::AssociatedTypeDecl:
1445- return storage.dependentMember -> getAssocType () ->getProtocol ();
1439+ return storage.assocType ->getProtocol ();
14461440 }
14471441
14481442 llvm_unreachable (" Unhandled StorageKind in switch." );
@@ -1613,9 +1607,8 @@ void RequirementSource::print(llvm::raw_ostream &out,
16131607 }
16141608
16151609 case StorageKind::AssociatedTypeDecl:
1616- auto assocType = storage.dependentMember ->getAssocType ();
1617- out << " (" << assocType->getProtocol ()->getName ()
1618- << " ::" << assocType->getName () << " )" ;
1610+ out << " (" << storage.assocType ->getProtocol ()->getName ()
1611+ << " ::" << storage.assocType ->getName () << " )" ;
16191612 break ;
16201613 }
16211614
@@ -2940,7 +2933,7 @@ Type GenericSignatureBuilder::PotentialArchetype::getDependentType(
29402933 if (parentType->hasError ())
29412934 return parentType;
29422935
2943- return getResolvedDependentMemberType (parentType);
2936+ return DependentMemberType::get (parentType, getResolvedType () );
29442937 }
29452938
29462939 assert (isGenericParam () && " Not a generic parameter?" );
0 commit comments