Skip to content

Commit a908386

Browse files
committed
Sema: Check worseThanBestSolution() in a better place
1 parent 1312fc7 commit a908386

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

lib/Sema/CSStep.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,7 @@ StepResult ConjunctionStep::resume(bool prevFailed) {
924924

925925
// Rewind back the constraint system information.
926926
ActiveChoice.reset();
927+
restoreBestScore();
927928

928929
if (CS.isDebugMode())
929930
getDebugLogger() << ")\n";

lib/Sema/CSStep.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,9 @@ template <typename P> class BindingStep : public SolverStep {
530530
if (CS.isTooComplex(Solutions))
531531
return done(/*isSuccess=*/false);
532532

533+
if (CS.worseThanBestSolution())
534+
return done(/*isSuccess=*/false);
535+
533536
while (auto choice = Producer()) {
534537
if (shouldSkip(*choice))
535538
continue;

0 commit comments

Comments
 (0)