Skip to content

Commit 57a9d3f

Browse files
committed
[ConstraintSystem] Warning fixes shouldn't affect solution ranking
1 parent 07b1905 commit 57a9d3f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/Sema/CSSimplify.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5390,11 +5390,14 @@ bool ConstraintSystem::recordFix(ConstraintFix *fix) {
53905390

53915391
// Record the fix.
53925392

5393-
// Increase the score. If this would make the current solution worse than
5394-
// the best solution we've seen already, stop now.
5395-
increaseScore(SK_Fix);
5396-
if (worseThanBestSolution())
5397-
return true;
5393+
// If this is just a warning it's shouldn't affect the solver.
5394+
if (!fix->isWarning()) {
5395+
// Otherswise increase the score. If this would make the current
5396+
// solution worse than the best solution we've seen already, stop now.
5397+
increaseScore(SK_Fix);
5398+
if (worseThanBestSolution())
5399+
return true;
5400+
}
53985401

53995402
if (isAugmentingFix(fix)) {
54005403
// Always useful, unless duplicate of exactly the same fix and location.

0 commit comments

Comments
 (0)