Skip to content

Commit 2dd7470

Browse files
authored
Merge pull request #30411 from xedin/diags-to-use-solution-instead-of-cs
[Diagnostics] Switch `FailureDiagnostic` to use a solution
2 parents 8e800e4 + 7800a04 commit 2dd7470

File tree

8 files changed

+681
-648
lines changed

8 files changed

+681
-648
lines changed

lib/Sema/CSApply.cpp

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,13 @@ ConstraintLocator *Solution::getCalleeLocator(ConstraintLocator *locator,
165165
});
166166
}
167167

168+
ConstraintLocator *
169+
Solution::getConstraintLocator(Expr *anchor,
170+
ArrayRef<LocatorPathElt> path) const {
171+
auto &cs = getConstraintSystem();
172+
return cs.getConstraintLocator(anchor, path);
173+
}
174+
168175
/// Return the implicit access kind for a MemberRefExpr with the
169176
/// specified base and member in the specified DeclContext.
170177
static AccessSemantics
@@ -7325,7 +7332,8 @@ bool ConstraintSystem::applySolutionFixes(const Solution &solution) {
73257332
auto *primaryFix = fixes[0];
73267333
ArrayRef<ConstraintFix *> secondaryFixes{fixes.begin() + 1, fixes.end()};
73277334

7328-
auto diagnosed = primaryFix->coalesceAndDiagnose(secondaryFixes);
7335+
auto diagnosed =
7336+
primaryFix->coalesceAndDiagnose(solution, secondaryFixes);
73297337
if (primaryFix->isWarning()) {
73307338
assert(diagnosed && "warnings should always be diagnosed");
73317339
(void)diagnosed;
@@ -7700,13 +7708,13 @@ ProtocolConformanceRef Solution::resolveConformance(
77007708
return ProtocolConformanceRef::forInvalid();
77017709
}
77027710

7703-
Type Solution::getType(const Expr *expr) const {
7704-
auto result = nodeTypes.find(expr);
7711+
Type Solution::getType(TypedNode node) const {
7712+
auto result = nodeTypes.find(node);
77057713
if (result != nodeTypes.end())
77067714
return result->second;
77077715

77087716
auto &cs = getConstraintSystem();
7709-
return cs.getType(expr);
7717+
return cs.getType(node);
77107718
}
77117719

77127720
void Solution::setExprTypes(Expr *expr) const {

0 commit comments

Comments
 (0)