@@ -454,19 +454,29 @@ static Constraint *determineBestChoicesInContext(
454454 scoreCandidateMatch = [&](GenericSignature genericSig,
455455 Type candidateType, Type paramType,
456456 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+
458466 return a->getDesugaredType ()->isEqual (b->getDesugaredType ());
459467 };
460468
461469 if (options.contains (MatchFlag::ExactOnly))
462470 return areEqual (candidateType, paramType) ? 1 : 0 ;
463471
464472 // Exact match between candidate and parameter types.
465- if (areEqual (candidateType, paramType))
473+ if (areEqual (candidateType, paramType)) {
466474 return options.contains (MatchFlag::Literal) ? 0.3 : 1 ;
475+ }
467476
468- if (options.contains (MatchFlag::Literal))
477+ if (options.contains (MatchFlag::Literal)) {
469478 return 0 ;
479+ }
470480
471481 // Check whether match would require optional injection.
472482 {
0 commit comments