Skip to content

Commit f0f9c56

Browse files
committed
Sema: Better -debug-constraints output when we failed because of free type variables
1 parent 81e9c6b commit f0f9c56

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

lib/Sema/CSStep.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,20 @@ StepResult ComponentStep::take(bool prevFailed) {
438438
// If there are no disjunctions or type variables to bind
439439
// we can't solve this system unless we have free type variables
440440
// allowed in the solution.
441+
if (CS.isDebugMode()) {
442+
PrintOptions PO;
443+
PO.PrintTypesForDebugging = true;
444+
445+
auto &log = getDebugLogger();
446+
log << "(failed due to free variables:";
447+
for (auto *typeVar : CS.getTypeVariables()) {
448+
if (!typeVar->getImpl().hasRepresentativeOrFixed()) {
449+
log << " " << typeVar->getString(PO);
450+
}
451+
}
452+
log << ")\n";
453+
}
454+
441455
return finalize(/*isSuccess=*/false);
442456
}
443457

0 commit comments

Comments
 (0)