Skip to content

Commit e5c5fc9

Browse files
author
Amritpan Kaur
committed
[ConstraintSystem] Nest simplification result inside new block.
Nest failed, added, and removed constraints inside block called `simplification result`.
1 parent 3aeecd1 commit e5c5fc9

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4400,7 +4400,7 @@ class ConstraintSystem {
44004400

44014401
if (isDebugMode()) {
44024402
auto &log = llvm::errs();
4403-
log.indent(solverState ? solverState->getCurrentIndent() : 0)
4403+
log.indent(solverState ? solverState->getCurrentIndent() + 4 : 0)
44044404
<< "(failed constraint ";
44054405
constraint->print(log, &getASTContext().SourceMgr);
44064406
log << ")\n";
@@ -4425,7 +4425,7 @@ class ConstraintSystem {
44254425

44264426
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
44274427
auto &log = llvm::errs();
4428-
log.indent(solverState->getCurrentIndent() + 2) << "(added constraint: ";
4428+
log.indent(solverState->getCurrentIndent() + 4) << "(added constraint: ";
44294429
constraint->print(log, &getASTContext().SourceMgr,
44304430
solverState->getCurrentIndent() + 4);
44314431
log << ")\n";
@@ -4443,7 +4443,7 @@ class ConstraintSystem {
44434443

44444444
if (isDebugMode() && getPhase() == ConstraintSystemPhase::Solving) {
44454445
auto &log = llvm::errs();
4446-
log.indent(solverState->getCurrentIndent() + 2)
4446+
log.indent(solverState->getCurrentIndent() + 4)
44474447
<< "(removed constraint: ";
44484448
constraint->print(log, &getASTContext().SourceMgr);
44494449
log << ")\n";

lib/Sema/CSSolver.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,12 @@ bool ConstraintSystem::simplify() {
351351
log << "(considering -> ";
352352
constraint->print(log, &getASTContext().SourceMgr);
353353
log << "\n";
354+
355+
if (constraint->getKind() != ConstraintKind::Disjunction &&
356+
constraint->getKind() != ConstraintKind::Conjunction) {
357+
log.indent(solverState->getCurrentIndent() + 2)
358+
<< "(simplification result:\n";
359+
}
354360
}
355361

356362
// Simplify this constraint.
@@ -359,6 +365,7 @@ bool ConstraintSystem::simplify() {
359365
retireFailedConstraint(constraint);
360366
if (isDebugMode()) {
361367
auto &log = llvm::errs();
368+
log.indent(solverState->getCurrentIndent() + 2) << ")\n";
362369
log.indent(solverState->getCurrentIndent() + 2) << "(outcome: error)\n";
363370
}
364371
break;
@@ -369,6 +376,7 @@ bool ConstraintSystem::simplify() {
369376
retireConstraint(constraint);
370377
if (isDebugMode()) {
371378
auto &log = llvm::errs();
379+
log.indent(solverState->getCurrentIndent() + 2) << ")\n";
372380
log.indent(solverState->getCurrentIndent() + 2)
373381
<< "(outcome: simplified)\n";
374382
}
@@ -379,6 +387,7 @@ bool ConstraintSystem::simplify() {
379387
++solverState->NumUnsimplifiedConstraints;
380388
if (isDebugMode()) {
381389
auto &log = llvm::errs();
390+
log.indent(solverState->getCurrentIndent() + 2) << ")\n";
382391
log.indent(solverState->getCurrentIndent() + 2)
383392
<< "(outcome: unsolved)\n";
384393
}

0 commit comments

Comments
 (0)