Skip to content

Commit bda36cf

Browse files
committed
[ConstraintSystem] Always log disjunction choices that are skipped and
the reason for skipping while solving in debug mode.
1 parent 4a4a6b2 commit bda36cf

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

lib/Sema/CSStep.cpp

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -530,22 +530,27 @@ StepResult DisjunctionStep::resume(bool prevFailed) {
530530
bool DisjunctionStep::shouldSkip(const DisjunctionChoice &choice) const {
531531
auto &ctx = CS.getASTContext();
532532

533-
bool attemptFixes = CS.shouldAttemptFixes();
534-
// Enable all disabled choices in "diagnostic" mode.
535-
if (!attemptFixes && choice.isDisabled()) {
533+
// Never skip disjunction choices in diagnostic mode.
534+
if (CS.shouldAttemptFixes())
535+
return false;
536+
537+
auto skip = [&](std::string reason) -> bool {
536538
if (CS.isDebugMode()) {
537539
auto &log = getDebugLogger();
538-
log << "(skipping ";
540+
log << "(skipping " + reason + " ";
539541
choice.print(log, &ctx.SourceMgr);
540542
log << '\n';
541543
}
542544

543545
return true;
544-
}
546+
};
545547

546-
// Skip unavailable overloads unless solver is in the "diagnostic" mode.
547-
if (!attemptFixes && choice.isUnavailable())
548-
return true;
548+
if (choice.isDisabled())
549+
return skip("disabled");
550+
551+
// Skip unavailable overloads.
552+
if (choice.isUnavailable())
553+
return skip("unavailable");
549554

550555
if (ctx.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks)
551556
return false;
@@ -567,7 +572,7 @@ bool DisjunctionStep::shouldSkip(const DisjunctionChoice &choice) const {
567572
// and there are no non-trivial function conversions.
568573
if (score[SK_ForceUnchecked] == 0 && score[SK_Unavailable] == 0 &&
569574
score[SK_Fix] == 0 && score[SK_FunctionConversion] == 0)
570-
return true;
575+
return skip("generic");
571576
}
572577

573578
return false;

0 commit comments

Comments
 (0)