File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change @@ -259,19 +259,13 @@ void CompletionLookup::foundFunction(const AnyFunctionType *AFT) {
259259
260260bool CompletionLookup::canBeUsedAsRequirementFirstType (Type selfTy,
261261 TypeAliasDecl *TAD) {
262- auto T = TAD->getDeclaredInterfaceType ();
263- auto subMap = selfTy->getMemberSubstitutionMap (TAD);
264- T = T.subst (subMap)->getCanonicalType ();
265-
266- ArchetypeType *archeTy = T->getAs <ArchetypeType>();
267- if (!archeTy)
262+ if (TAD->isGeneric ())
268263 return false ;
269- archeTy = archeTy->getRoot ();
270264
271- // For protocol, the 'archeTy' should match with the 'baseTy' which is the
272- // dynamic 'Self' type of the protocol. For nominal decls, 'archTy' should
273- // be one of the generic params in 'selfTy'. Search 'archeTy' in 'baseTy'.
274- return selfTy. findIf ([&](Type T) { return archeTy-> isEqual (T); } );
265+ auto T = TAD-> getDeclaredInterfaceType ();
266+ auto subMap = selfTy-> getContextSubstitutionMap (TAD-> getDeclContext ());
267+
268+ return T. subst (subMap)-> is <ArchetypeType>( );
275269}
276270
277271CompletionLookup::CompletionLookup (CodeCompletionResultSink &Sink,
You can’t perform that action at this time.
0 commit comments