@@ -454,19 +454,29 @@ static Constraint *determineBestChoicesInContext(
454
454
scoreCandidateMatch = [&](GenericSignature genericSig,
455
455
Type candidateType, Type paramType,
456
456
MatchOptions options) -> double {
457
- auto areEqual = [](Type a, Type b) {
457
+ auto areEqual = [&options](Type a, Type b) {
458
+ // Double<->CGFloat implicit conversion support for literals
459
+ // only since in this case the conversion might not result in
460
+ // score penalty.
461
+ if (options.contains (MatchFlag::Literal) &&
462
+ ((a->isDouble () && b->isCGFloat ()) ||
463
+ (a->isCGFloat () && b->isDouble ())))
464
+ return true ;
465
+
458
466
return a->getDesugaredType ()->isEqual (b->getDesugaredType ());
459
467
};
460
468
461
469
if (options.contains (MatchFlag::ExactOnly))
462
470
return areEqual (candidateType, paramType) ? 1 : 0 ;
463
471
464
472
// Exact match between candidate and parameter types.
465
- if (areEqual (candidateType, paramType))
473
+ if (areEqual (candidateType, paramType)) {
466
474
return options.contains (MatchFlag::Literal) ? 0.3 : 1 ;
475
+ }
467
476
468
- if (options.contains (MatchFlag::Literal))
477
+ if (options.contains (MatchFlag::Literal)) {
469
478
return 0 ;
479
+ }
470
480
471
481
// Check whether match would require optional injection.
472
482
{
0 commit comments