File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -174,8 +174,19 @@ void ConformingMethodListCallbacks::getMatchingMethods(
174174 if (FD->isStatic () || FD->isOperator ())
175175 return false ;
176176
177- auto resultTy = T->getTypeOfMember (CurModule, FD,
178- FD->getResultInterfaceType ());
177+ assert (!T->hasTypeParameter ());
178+
179+ // T may contain primary archetypes from some fixed generic signature G.
180+ // This might be unrelated to the generic signature of FD. However if
181+ // FD has a generic parameter of its own and it returns a type containing
182+ // that parameter, we want to map it to the corresponding archetype
183+ // from the generic environment of FD, because all we do with the
184+ // resulting type is check conformance. If the conformance is conditional,
185+ // we might run into trouble with really complicated cases but the fake
186+ // archetype setup will mostly work.
187+ auto substitutions = T->getMemberSubstitutionMap (
188+ CurModule, FD, FD->getGenericEnvironment ());
189+ auto resultTy = FD->getResultInterfaceType ().subst (substitutions);
179190 if (resultTy->is <ErrorType>())
180191 return false ;
181192
You can’t perform that action at this time.
0 commit comments