Skip to content

Commit 307caf2

Browse files
committed
[CSGen] Don't favor overload choices that could require an implicit conversion
Doing so resulted in performance impact due to the number of partial solutions increase.
1 parent dbf401e commit 307caf2

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

lib/Sema/CSGen.cpp

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -385,11 +385,6 @@ namespace {
385385
if (argTy->isDoubleType() && paramTy->isCGFloatType())
386386
return false;
387387

388-
// CGFloat could be passed to a Double parameter and that's
389-
// is either equivalent of widening conversion.
390-
if (argTy->isCGFloatType() && paramTy->isDoubleType())
391-
return true;
392-
393388
llvm::SmallSetVector<ProtocolDecl *, 2> literalProtos;
394389
if (auto argTypeVar = argTy->getAs<TypeVariableType>()) {
395390
auto constraints = CS.getConstraintGraph().gatherConstraints(
@@ -550,12 +545,7 @@ namespace {
550545

551546
auto resultTy = choice->getResult();
552547
// Result type of the call matches expected contextual type.
553-
if (contextualTy->isEqual(resultTy))
554-
return true;
555-
556-
// Double and CGFloat could be used interchangeably, so let's
557-
// favor widening conversion going from CGFloat to Double.
558-
return resultTy->isCGFloatType() && contextualTy->isDoubleType();
548+
return contextualTy->isEqual(resultTy);
559549
}
560550

561551
/// Favor unary operator constraints where we have exact matches

0 commit comments

Comments
 (0)