Skip to content

Commit cf19b8a

Browse files
committed
[Constraint solver] Eliminate addConstraint(Constraint*).
We no longer build constraints just to immediately simplify them.
1 parent d4f5c72 commit cf19b8a

File tree

2 files changed

+0
-37
lines changed

2 files changed

+0
-37
lines changed

lib/Sema/ConstraintSystem.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -333,37 +333,6 @@ ConstraintLocator *ConstraintSystem::getConstraintLocator(
333333
return getConstraintLocator(anchor, path, builder.getSummaryFlags());
334334
}
335335

336-
bool ConstraintSystem::addConstraint(Constraint *constraint) {
337-
switch (simplifyConstraint(*constraint)) {
338-
case SolutionKind::Error:
339-
if (!failedConstraint) {
340-
failedConstraint = constraint;
341-
}
342-
343-
if (solverState) {
344-
solverState->retiredConstraints.push_front(constraint);
345-
solverState->generatedConstraints.push_back(constraint);
346-
}
347-
348-
return false;
349-
350-
case SolutionKind::Solved:
351-
// This constraint has already been solved; there is nothing more
352-
// to do.
353-
// Record solved constraint.
354-
if (solverState) {
355-
solverState->retiredConstraints.push_front(constraint);
356-
solverState->generatedConstraints.push_back(constraint);
357-
}
358-
359-
return true;
360-
361-
case SolutionKind::Unsolved:
362-
addUnsolvedConstraint(constraint);
363-
return false;
364-
}
365-
}
366-
367336
TypeVariableType *
368337
ConstraintSystem::getMemberType(TypeVariableType *baseTypeVar,
369338
AssociatedTypeDecl *assocType,

lib/Sema/ConstraintSystem.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1373,12 +1373,6 @@ class ConstraintSystem {
13731373
/// emits an error message.
13741374
void diagnoseFailureForExpr(Expr *expr);
13751375

1376-
/// \brief Add a newly-allocated constraint after attempting to simplify
1377-
/// it.
1378-
///
1379-
/// \returns true if this constraint was solved.
1380-
bool addConstraint(Constraint *constraint);
1381-
13821376
/// \brief Add a constraint to the constraint system.
13831377
void addConstraint(ConstraintKind kind, Type first, Type second,
13841378
ConstraintLocatorBuilder locator,

0 commit comments

Comments
 (0)