Skip to content

Commit aaacd29

Browse files
committed
[ConstraintSystem] Adds the new overload to FailureDiagnostic as well and remove other instances of 0 summary flags
1 parent 3f2b95b commit aaacd29

File tree

4 files changed

+13
-7
lines changed

4 files changed

+13
-7
lines changed

lib/Sema/CSDiagnostics.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ ProtocolConformance *RequirementFailure::getConformanceForConditionalReq(
151151
return nullptr;
152152
}
153153

154-
auto *typeReqLoc = cs.getConstraintLocator(getRawAnchor(), path.drop_back());
154+
auto *typeReqLoc = getConstraintLocator(getRawAnchor(), path.drop_back());
155155

156156
auto result = llvm::find_if(
157157
cs.CheckedConformances,
@@ -1837,8 +1837,7 @@ bool MissingCallFailure::diagnoseAsError() {
18371837

18381838
case ConstraintLocator::AutoclosureResult: {
18391839
auto &cs = getConstraintSystem();
1840-
auto loc = cs.getConstraintLocator(getRawAnchor(), path.drop_back(),
1841-
/*summaryFlags=*/0);
1840+
auto loc = cs.getConstraintLocator(getRawAnchor(), path.drop_back());
18421841
AutoClosureForwardingFailure failure(cs, loc);
18431842
return failure.diagnoseAsError();
18441843
}

lib/Sema/CSDiagnostics.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ class FailureDiagnostic {
147147
return nullptr;
148148
}
149149

150+
/// Retrive the constraint locator for the given anchor and
151+
/// path, uniqued and automatically calculate the summary flags
152+
ConstraintLocator *
153+
getConstraintLocator(Expr *anchor,
154+
ArrayRef<ConstraintLocator::PathElement> path) {
155+
return CS.getConstraintLocator(anchor, path);
156+
}
157+
150158
/// \returns true is locator hasn't been simplified down to expression.
151159
bool hasComplexLocator() const { return HasComplexLocator; }
152160

lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2245,8 +2245,7 @@ bool ConstraintSystem::repairFailures(
22452245
getASTContext().TheEmptyTupleType);
22462246
conversionsOrFixes.push_back(AddMissingArguments::create(
22472247
*this, fnType, {FunctionType::Param(*arg)},
2248-
getConstraintLocator(anchor, path,
2249-
/*summaryFlags=*/0)));
2248+
getConstraintLocator(anchor, path)));
22502249
}
22512250
break;
22522251
}

lib/Sema/CSStep.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ StepResult ComponentStep::take(bool prevFailed) {
313313
// Let's drop `generic parameter '...'` part of the locator to
314314
// group all of the missing generic parameters related to the
315315
// same path together.
316-
defaultableGenericParams[CS.getConstraintLocator(anchor, path.drop_back(),
317-
/*summaryFlags=*/0)]
316+
defaultableGenericParams[CS.getConstraintLocator(anchor,
317+
path.drop_back())]
318318
.push_back(locator->getGenericParameter());
319319
}
320320

0 commit comments

Comments
 (0)