Skip to content

Commit 1dd6d34

Browse files
committed
[ConstraintSystem] NFC: Pass down matcher flags to repairFailures
1 parent f1ff695 commit 1dd6d34

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5257,6 +5257,7 @@ class ConstraintSystem {
52575257
/// \return true if at least some of the failures has been repaired
52585258
/// successfully, which allows type matcher to continue.
52595259
bool repairFailures(Type lhs, Type rhs, ConstraintKind matchKind,
5260+
TypeMatchOptions flags,
52605261
SmallVectorImpl<RestrictionOrFix> &conversionsOrFixes,
52615262
ConstraintLocatorBuilder locator);
52625263

lib/Sema/CSSimplify.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4843,7 +4843,7 @@ static bool repairOutOfOrderArgumentsInBinaryFunction(
48434843
/// \return true if at least some of the failures has been repaired
48444844
/// successfully, which allows type matcher to continue.
48454845
bool ConstraintSystem::repairFailures(
4846-
Type lhs, Type rhs, ConstraintKind matchKind,
4846+
Type lhs, Type rhs, ConstraintKind matchKind, TypeMatchOptions flags,
48474847
SmallVectorImpl<RestrictionOrFix> &conversionsOrFixes,
48484848
ConstraintLocatorBuilder locator) {
48494849
SmallVector<LocatorPathElt, 4> path;
@@ -5344,7 +5344,7 @@ bool ConstraintSystem::repairFailures(
53445344
// let's re-attempt to repair without l-value conversion in the
53455345
// locator to fix underlying type mismatch.
53465346
if (path.back().is<LocatorPathElt::FunctionResult>()) {
5347-
return repairFailures(lhs, rhs, matchKind, conversionsOrFixes,
5347+
return repairFailures(lhs, rhs, matchKind, flags, conversionsOrFixes,
53485348
getConstraintLocator(anchor, path));
53495349
}
53505350

@@ -6133,7 +6133,7 @@ bool ConstraintSystem::repairFailures(
61336133
if (!path.empty() && path.back().is<LocatorPathElt::PackType>())
61346134
path.pop_back();
61356135

6136-
return repairFailures(lhs, rhs, matchKind, conversionsOrFixes,
6136+
return repairFailures(lhs, rhs, matchKind, flags, conversionsOrFixes,
61376137
getConstraintLocator(anchor, path));
61386138
}
61396139

@@ -6377,7 +6377,7 @@ bool ConstraintSystem::repairFailures(
63776377
path.pop_back();
63786378

63796379
if (!path.empty() && path.back().is<LocatorPathElt::AnyRequirement>()) {
6380-
return repairFailures(lhs, rhs, matchKind, conversionsOrFixes,
6380+
return repairFailures(lhs, rhs, matchKind, flags, conversionsOrFixes,
63816381
getConstraintLocator(anchor, path));
63826382
}
63836383

@@ -7479,7 +7479,8 @@ ConstraintSystem::matchTypes(Type type1, Type type2, ConstraintKind kind,
74797479
// Attempt fixes iff it's allowed, both types are concrete and
74807480
// we are not in the middle of attempting one already.
74817481
if (shouldAttemptFixes() && !flags.contains(TMF_ApplyingFix)) {
7482-
if (repairFailures(type1, type2, kind, conversionsOrFixes, locator)) {
7482+
if (repairFailures(type1, type2, kind, flags, conversionsOrFixes,
7483+
locator)) {
74837484
if (conversionsOrFixes.empty())
74847485
return getTypeMatchSuccess();
74857486
}

0 commit comments

Comments
 (0)