@@ -376,11 +376,6 @@ CalleeCandidateInfo::evaluateCloseness(UncurriedCandidate candidate,
376
376
auto argType = getParamResultType (actualArgs[argNo]);
377
377
auto rArgType = argType->getRValueType ();
378
378
379
- // If the argument has an unresolved type, then we're not actually
380
- // matching against it.
381
- if (rArgType->is <UnresolvedType>())
382
- continue ;
383
-
384
379
// FIXME: Right now, a "matching" overload is one with a parameter whose
385
380
// type is identical to the argument type, or substitutable via handling
386
381
// of functions with primary archetypes in one or more parameters.
@@ -391,7 +386,7 @@ CalleeCandidateInfo::evaluateCloseness(UncurriedCandidate candidate,
391
386
bool matched;
392
387
if (paramType->hasUnresolvedType ())
393
388
matched = true ;
394
- else if (rArgType->hasTypeVariable ())
389
+ else if (rArgType->hasTypeVariable () || rArgType-> hasUnresolvedType () )
395
390
matched = false ;
396
391
else {
397
392
auto matchType = paramType;
@@ -476,10 +471,14 @@ CalleeCandidateInfo::evaluateCloseness(UncurriedCandidate candidate,
476
471
if (matched)
477
472
continue ;
478
473
479
- if (archetypesMap.empty ())
480
- mismatchesAreNearMisses &= argumentMismatchIsNearMiss (argType, paramType);
481
-
482
- ++mismatchingArgs;
474
+ // If the real argument is unresolved, the candidate isn't a mismatch because
475
+ // the type could be anything, but it's still useful to save the argument as
476
+ // failureInfo.
477
+ if (!rArgType->hasUnresolvedType ()) {
478
+ if (archetypesMap.empty ())
479
+ mismatchesAreNearMisses &= argumentMismatchIsNearMiss (argType, paramType);
480
+ ++mismatchingArgs;
481
+ }
483
482
484
483
failureInfo.argumentNumber = argNo;
485
484
failureInfo.parameterType = paramType;
@@ -489,7 +488,7 @@ CalleeCandidateInfo::evaluateCloseness(UncurriedCandidate candidate,
489
488
}
490
489
491
490
if (mismatchingArgs == 0 )
492
- return { CC_ExactMatch, {} };
491
+ return { CC_ExactMatch, failureInfo };
493
492
494
493
// Check to see if the first argument expects an inout argument, but is not
495
494
// an lvalue.
0 commit comments