File tree Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Expand file tree Collapse file tree 1 file changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -3703,14 +3703,11 @@ Type ArchetypeType::getNestedType(AssociatedTypeDecl *assocType) {
3703
3703
}
3704
3704
3705
3705
Type ArchetypeType::getNestedTypeByName (Identifier name) {
3706
- AssociatedTypeDecl *assocType = nullptr ;
3707
- ProtocolType::visitAllProtocols (getConformsTo (), [&](ProtocolDecl *proto) {
3708
- assocType = proto->getAssociatedType (name);
3709
- return assocType != nullptr ;
3710
- });
3711
-
3712
- if (assocType)
3706
+ auto memberDecl = getGenericEnvironment ()->getGenericSignature ()
3707
+ ->lookupNestedType (getInterfaceType (), name);
3708
+ if (auto assocType = dyn_cast_or_null<AssociatedTypeDecl>(memberDecl)) {
3713
3709
return getNestedType (assocType);
3710
+ }
3714
3711
3715
3712
return Type ();
3716
3713
}
@@ -3920,10 +3917,6 @@ static Type getMemberForBaseType(LookupConformanceFn lookupConformances,
3920
3917
// If the parent is an archetype, extract the child archetype with the
3921
3918
// given name.
3922
3919
if (auto archetypeParent = substBase->getAs <ArchetypeType>()) {
3923
- // if (assocType && !archetypeParent->getSuperclass())
3924
- // return archetypeParent->getNestedType(assocType);
3925
-
3926
- // FIXME: This is really slow for the case where we have an associated type.
3927
3920
if (Type memberArchetypeByName = archetypeParent->getNestedTypeByName (name))
3928
3921
return memberArchetypeByName;
3929
3922
You can’t perform that action at this time.
0 commit comments