mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Revert "[CSSolver] Use correct locator when matching function result types re…"
This commit is contained in:
@@ -1007,32 +1007,14 @@ SolutionCompareResult ConstraintSystem::compareSolutions(
|
||||
// Compare the type variable bindings.
|
||||
auto &tc = cs.getTypeChecker();
|
||||
for (auto &binding : diff.typeBindings) {
|
||||
auto type1 = binding.bindings[idx1];
|
||||
auto type2 = binding.bindings[idx2];
|
||||
|
||||
auto &impl = binding.typeVar->getImpl();
|
||||
|
||||
if (auto *locator = impl.getLocator()) {
|
||||
auto path = locator->getPath();
|
||||
if (!path.empty() &&
|
||||
path.back().getKind() == ConstraintLocator::ClosureResult) {
|
||||
// Since we support `() -> T` to `() -> Void` and
|
||||
// `() -> Never` to `() -> T` conversions, it's always
|
||||
// preferable to pick `T` rather than `Never` with
|
||||
// all else being equal.
|
||||
if (type2->isUninhabited())
|
||||
++score1;
|
||||
|
||||
if (type1->isUninhabited())
|
||||
++score2;
|
||||
}
|
||||
}
|
||||
|
||||
// If the type variable isn't one for which we should be looking at the
|
||||
// bindings, don't.
|
||||
if (!impl.prefersSubtypeBinding())
|
||||
if (!binding.typeVar->getImpl().prefersSubtypeBinding())
|
||||
continue;
|
||||
|
||||
auto type1 = binding.bindings[idx1];
|
||||
auto type2 = binding.bindings[idx2];
|
||||
|
||||
// If the types are equivalent, there's nothing more to do.
|
||||
if (type1->isEqual(type2))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user