@@ -3421,8 +3421,8 @@ static bool canSubstituteTypeInto(Type ty, const DeclContext *dc,
3421
3421
// The referenced type might be a different opaque result type.
3422
3422
3423
3423
// First, unwrap any nested associated types to get the root archetype.
3424
- while (auto nestedTy = ty->getAs <NestedArchetypeType>())
3425
- ty = nestedTy->getParent ();
3424
+ if (auto nestedTy = ty->getAs <NestedArchetypeType>())
3425
+ ty = nestedTy->getRoot ();
3426
3426
3427
3427
// If the root archetype is an opaque result type, check that its
3428
3428
// descriptor is accessible.
@@ -3786,31 +3786,19 @@ void ArchetypeType::registerNestedType(Identifier name, Type nested) {
3786
3786
found->second = nested;
3787
3787
}
3788
3788
3789
- static void collectFullName (const ArchetypeType *Archetype,
3790
- SmallVectorImpl<char > &Result) {
3791
- if (auto nested = dyn_cast<NestedArchetypeType>(Archetype)) {
3792
- collectFullName (nested->getParent (), Result);
3793
- Result.push_back (' .' );
3794
- }
3795
- Result.append (Archetype->getName ().str ().begin (),
3796
- Archetype->getName ().str ().end ());
3797
- }
3798
-
3799
3789
AssociatedTypeDecl *NestedArchetypeType::getAssocType () const {
3800
3790
return InterfaceType->castTo <DependentMemberType>()->getAssocType ();
3801
3791
}
3802
3792
3803
3793
Identifier ArchetypeType::getName () const {
3804
- if (auto nested = dyn_cast<NestedArchetypeType>(this ))
3805
- return nested->getAssocType ()->getName ();
3806
3794
assert (InterfaceType);
3795
+ if (auto depMemTy = InterfaceType->getAs <DependentMemberType>())
3796
+ return depMemTy->getName ();
3807
3797
return InterfaceType->castTo <GenericTypeParamType>()->getName ();
3808
3798
}
3809
3799
3810
3800
std::string ArchetypeType::getFullName () const {
3811
- llvm::SmallString<64 > Result;
3812
- collectFullName (this , Result);
3813
- return Result.str ().str ();
3801
+ return InterfaceType.getString ();
3814
3802
}
3815
3803
3816
3804
void ProtocolCompositionType::Profile (llvm::FoldingSetNodeID &ID,
0 commit comments