@@ -252,12 +252,6 @@ static void determineBestChoicesInContext(
252
252
scoreCandidateMatch = [&](GenericSignature genericSig,
253
253
Type candidateType, Type paramType,
254
254
MatchOptions options) -> double {
255
- // Dependent members cannot be handled here because
256
- // they require substitution of the base type which
257
- // could come from a different argument.
258
- if (paramType->getAs <DependentMemberType>())
259
- return 0 ;
260
-
261
255
// Exact match between candidate and parameter types.
262
256
if (candidateType->isEqual (paramType))
263
257
return options.contains (MatchFlag::Literal) ? 0.3 : 1 ;
@@ -309,25 +303,22 @@ static void determineBestChoicesInContext(
309
303
310
304
// Check protocol requirement(s) if this parameter is a
311
305
// generic parameter type.
312
- GenericSignature::RequiredProtocols protocolRequirements;
313
- if (genericSig) {
314
- if (auto *GP = paramType->getAs <GenericTypeParamType>()) {
315
- protocolRequirements = genericSig->getRequiredProtocols (GP);
316
- // It's a generic parameter which might be connected via
317
- // same-type constraints to other generic parameters but
318
- // we cannot check that here, so let's add a tiny score
319
- // just to acknowledge that it could possibly match.
320
- if (protocolRequirements.empty ()) {
321
- return 0.01 ;
322
- }
323
-
324
- if (llvm::all_of (protocolRequirements, [&](ProtocolDecl *protocol) {
325
- return TypeChecker::conformsToProtocol (candidateType, protocol,
326
- cs.DC ->getParentModule (),
327
- /* allowMissing=*/ false );
328
- }))
329
- return 0.7 ;
330
- }
306
+ if (genericSig && paramType->isTypeParameter ()) {
307
+ auto protocolRequirements = genericSig->getRequiredProtocols (paramType);
308
+ // It's a generic parameter or dependent member which might
309
+ // be connected via ame-type constraints to other generic
310
+ // parameters or dependent member but we cannot check that here,
311
+ // so let's add a tiny score just to acknowledge that it could
312
+ // possibly match.
313
+ if (protocolRequirements.empty ())
314
+ return 0.01 ;
315
+
316
+ if (llvm::all_of (protocolRequirements, [&](ProtocolDecl *protocol) {
317
+ return TypeChecker::conformsToProtocol (candidateType, protocol,
318
+ cs.DC ->getParentModule (),
319
+ /* allowMissing=*/ false );
320
+ }))
321
+ return 0.7 ;
331
322
}
332
323
333
324
// Parameter is generic, let's check whether top-level
0 commit comments