[ConstraintSystem] De-prioritize solutions with Swift -> C pointer conversions

Just like other implicit conversions - always prefer solutions with
the lowest possible number of them.
This commit is contained in:
Pavel Yaskevich
2021-08-12 13:38:57 -07:00
parent f368e5a7b6
commit 5cb8604b60
3 changed files with 49 additions and 2 deletions

View File

@@ -11385,6 +11385,10 @@ ConstraintSystem::SolutionKind
ConstraintSystem::simplifyPointerToCPointerRestriction(
Type type1, Type type2, TypeMatchOptions flags,
ConstraintLocatorBuilder locator) {
// Make sure that solutions with implicit pointer conversions
// are always worse than the ones without them.
increaseScore(SK_ImplicitValueConversion);
auto &ctx = getASTContext();
PointerTypeKind swiftPtrKind, cPtrKind;