[CSSolver] Add skeleton of iterative solve

The idea so to split solving into non-recursive steps,
represented by `SolverStep`, each of the steps is resposible
for a unit of work e.g. attempting type variable or
disjunction bindings/choices.

Each step could produce more work via "follow-up" steps,
complete "partial" solution when it's done, or error which
terminates solver loop.
This commit is contained in:
Pavel Yaskevich
2018-09-03 00:12:32 -07:00
parent 9bff72aa8d
commit daf4c2f3b5
5 changed files with 278 additions and 0 deletions

View File

@@ -57,6 +57,7 @@ class DisjunctionChoiceProducer;
class TypeBinding;
class TypeVariableBinding;
class TypeVarBindingProducer;
class SolverStep;
} // end namespace constraints
@@ -930,6 +931,7 @@ public:
friend class FailureDiagnostic;
friend class TypeVarBindingProducer;
friend class TypeVariableBinding;
friend class SolverStep;
class SolverScope;
@@ -3088,6 +3090,9 @@ public:
/// \returns true if there are no solutions
bool solveRec(SmallVectorImpl<Solution> &solutions);
bool solveIteratively(Expr *expr, SmallVectorImpl<Solution> &solutions,
FreeTypeVariableBinding allowFreeTypeVariables);
/// \brief Solve the system of constraints.
///
/// \param allowFreeTypeVariables How to bind free type variables in