[CSFix] Allow diagnose to accept a solution to diagnose

Instead of always applying solution back to constraint system
before diagnostics, let's pass solution directly to `ConstaintFix::diagnose`
method to be used by `FailureDiagnostic` which paves a way for
stateless diagnostics.
This commit is contained in:
Pavel Yaskevich
2020-03-12 11:41:32 -07:00
parent 7c1df6ad51
commit 1fc0ea6b0e
3 changed files with 287 additions and 274 deletions

View File

@@ -7326,7 +7326,8 @@ bool ConstraintSystem::applySolutionFixes(const Solution &solution) {
auto *primaryFix = fixes[0];
ArrayRef<ConstraintFix *> secondaryFixes{fixes.begin() + 1, fixes.end()};
auto diagnosed = primaryFix->coalesceAndDiagnose(secondaryFixes);
auto diagnosed =
primaryFix->coalesceAndDiagnose(solution, secondaryFixes);
if (primaryFix->isWarning()) {
assert(diagnosed && "warnings should always be diagnosed");
(void)diagnosed;