@@ -818,7 +818,7 @@ const void *RequirementSource::getOpaqueStorage1() const {
818
818
return storage.type ;
819
819
820
820
case StorageKind::AssociatedTypeDecl:
821
- return storage.dependentMember ;
821
+ return storage.assocType ;
822
822
}
823
823
824
824
llvm_unreachable (" Unhandled StorageKind in switch." );
@@ -918,16 +918,11 @@ bool RequirementSource::isSelfDerivedSource(GenericSignatureBuilder &builder,
918
918
// / the nested type. This limited operation makes sure that it does not
919
919
// / create any new potential archetypes along the way, so it should only be
920
920
// / 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) {
923
922
if (auto depMemTy = depTy->getAs <DependentMemberType>()) {
924
- Type baseType = replaceSelfWithType (cache, selfType, depMemTy->getBase ());
923
+ Type baseType = replaceSelfWithType (selfType, depMemTy->getBase ());
925
924
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 ());
931
926
}
932
927
933
928
assert (depTy->is <GenericTypeParamType>() && " missing Self?" );
@@ -1371,8 +1366,8 @@ RequirementSource::visitPotentialArchetypesAlongPath(
1371
1366
1372
1367
if (visitor (parentType, this )) return nullptr ;
1373
1368
1374
- return replaceSelfWithType (ReplacedSelfCache ,
1375
- parentType, getDependentMember ());
1369
+ return replaceSelfWithType (parentType ,
1370
+ getAssociatedType ()-> getDeclaredInterfaceType ());
1376
1371
}
1377
1372
1378
1373
case RequirementSource::NestedTypeNameMatch:
@@ -1407,8 +1402,7 @@ RequirementSource::visitPotentialArchetypesAlongPath(
1407
1402
1408
1403
if (visitor (parentType, this )) return nullptr ;
1409
1404
1410
- return replaceSelfWithType (ReplacedSelfCache,
1411
- parentType, getStoredType ());
1405
+ return replaceSelfWithType (parentType, getStoredType ());
1412
1406
}
1413
1407
}
1414
1408
llvm_unreachable (" unhandled kind" );
@@ -1442,7 +1436,7 @@ ProtocolDecl *RequirementSource::getProtocolDecl() const {
1442
1436
return getProtocolConformance ().getRequirement ();
1443
1437
1444
1438
case StorageKind::AssociatedTypeDecl:
1445
- return storage.dependentMember -> getAssocType () ->getProtocol ();
1439
+ return storage.assocType ->getProtocol ();
1446
1440
}
1447
1441
1448
1442
llvm_unreachable (" Unhandled StorageKind in switch." );
@@ -1613,9 +1607,8 @@ void RequirementSource::print(llvm::raw_ostream &out,
1613
1607
}
1614
1608
1615
1609
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 () << " )" ;
1619
1612
break ;
1620
1613
}
1621
1614
@@ -2940,7 +2933,7 @@ Type GenericSignatureBuilder::PotentialArchetype::getDependentType(
2940
2933
if (parentType->hasError ())
2941
2934
return parentType;
2942
2935
2943
- return getResolvedDependentMemberType (parentType);
2936
+ return DependentMemberType::get (parentType, getResolvedType () );
2944
2937
}
2945
2938
2946
2939
assert (isGenericParam () && " Not a generic parameter?" );
0 commit comments