Skip to content

Commit 39d988d

Browse files
committed
[CS] Remove ReturnAllDiscoveredSolutions flag
This is now no longer used.
1 parent 6e616cd commit 39d988d

File tree

4 files changed

+9
-27
lines changed

4 files changed

+9
-27
lines changed

lib/Sema/CSRanking.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ bool ConstraintSystem::worseThanBestSolution() const {
9494
if (getASTContext().TypeCheckerOpts.DisableConstraintSolverPerformanceHacks)
9595
return false;
9696

97-
if (retainAllSolutions())
98-
return false;
99-
10097
if (!solverState || !solverState->BestScore ||
10198
CurrentScore <= *solverState->BestScore)
10299
return false;

lib/Sema/CSSolver.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@ Solution ConstraintSystem::finalize() {
7070

7171
// Update the best score we've seen so far.
7272
auto &ctx = getASTContext();
73-
if (!retainAllSolutions()) {
74-
assert(ctx.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks ||
75-
!solverState->BestScore || CurrentScore <= *solverState->BestScore);
73+
assert(ctx.TypeCheckerOpts.DisableConstraintSolverPerformanceHacks ||
74+
!solverState->BestScore || CurrentScore <= *solverState->BestScore);
7675

77-
if (!solverState->BestScore || CurrentScore <= *solverState->BestScore) {
78-
solverState->BestScore = CurrentScore;
79-
}
76+
if (!solverState->BestScore || CurrentScore <= *solverState->BestScore) {
77+
solverState->BestScore = CurrentScore;
8078
}
8179

8280
for (auto tv : getTypeVariables()) {
@@ -1311,8 +1309,7 @@ bool ConstraintSystem::solve(SmallVectorImpl<Solution> &solutions,
13111309
// Filter deduced solutions, try to figure out if there is
13121310
// a single best solution to use, if not explicitly disabled
13131311
// by constraint system options.
1314-
if (!retainAllSolutions())
1315-
filterSolutions(solutions);
1312+
filterSolutions(solutions);
13161313

13171314
// We fail if there is no solution or the expression was too complex.
13181315
return solutions.empty() || getExpressionTooComplex(solutions);

lib/Sema/CSStep.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ class SolverStep {
228228
Optional<Score> getBestScore() const { return CS.solverState->BestScore; }
229229

230230
void filterSolutions(SmallVectorImpl<Solution> &solutions, bool minimize) {
231-
if (!CS.retainAllSolutions())
232-
CS.filterSolutions(solutions, minimize);
231+
CS.filterSolutions(solutions, minimize);
233232
}
234233

235234
/// Check whether constraint solver is running in "debug" mode,

lib/Sema/ConstraintSystem.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,24 +1004,20 @@ using ConstraintList = llvm::ilist<Constraint>;
10041004
enum class ConstraintSystemFlags {
10051005
/// Whether we allow the solver to attempt fixes to the system.
10061006
AllowFixes = 0x01,
1007-
1008-
/// If set, this is going to prevent constraint system from erasing all
1009-
/// discovered solutions except the best one.
1010-
ReturnAllDiscoveredSolutions = 0x04,
10111007

10121008
/// Set if the client wants diagnostics suppressed.
1013-
SuppressDiagnostics = 0x08,
1009+
SuppressDiagnostics = 0x02,
10141010

10151011
/// If set, the client wants a best-effort solution to the constraint system,
10161012
/// but can tolerate a solution where all of the constraints are solved, but
10171013
/// not all type variables have been determined. In this case, the constraint
10181014
/// system is not applied to the expression AST, but the ConstraintSystem is
10191015
/// left in-tact.
1020-
AllowUnresolvedTypeVariables = 0x10,
1016+
AllowUnresolvedTypeVariables = 0x04,
10211017

10221018
/// If set, constraint system always reuses type of pre-typechecked
10231019
/// expression, and doesn't dig into its subexpressions.
1024-
ReusePrecheckedType = 0x20,
1020+
ReusePrecheckedType = 0x08,
10251021
};
10261022

10271023
/// Options that affect the constraint system as a whole.
@@ -2168,13 +2164,6 @@ class ConstraintSystem {
21682164
bool hasFreeTypeVariables();
21692165

21702166
private:
2171-
/// Indicates if the constraint system should retain all of the
2172-
/// solutions it has deduced regardless of their score.
2173-
bool retainAllSolutions() const {
2174-
return Options.contains(
2175-
ConstraintSystemFlags::ReturnAllDiscoveredSolutions);
2176-
}
2177-
21782167
/// Finalize this constraint system; we're done attempting to solve
21792168
/// it.
21802169
///

0 commit comments

Comments
 (0)