Skip to content

Commit 37009b0

Browse files
committed
[ConstraintSystem] Remove constraint propagation.
The current implementation isn't really useful in the face of generic overloads. It has never been enabled by default, and isn't useful to keep around if it is disabled. If we ever want to bring it back, we know where to look!
1 parent bd83509 commit 37009b0

File tree

12 files changed

+19
-366
lines changed

12 files changed

+19
-366
lines changed

include/swift/Basic/LangOptions.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,6 @@ namespace swift {
157157
/// solver should be debugged.
158158
unsigned DebugConstraintSolverAttempt = 0;
159159

160-
/// \brief Enable the experimental constraint propagation in the
161-
/// type checker.
162-
bool EnableConstraintPropagation = false;
163-
164160
/// \brief Enable the iterative type checker.
165161
bool IterativeTypeChecker = false;
166162

include/swift/Option/FrontendOptions.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ def debug_constraints : Flag<["-"], "debug-constraints">,
151151
def debug_constraints_attempt : Separate<["-"], "debug-constraints-attempt">,
152152
HelpText<"Debug the constraint solver at a given attempt">;
153153

154-
def propagate_constraints : Flag<["-"], "propagate-constraints">,
155-
HelpText<"Enable constraint propagation in the type checker">;
156-
157154
def iterative_type_checker : Flag<["-"], "iterative-type-checker">,
158155
HelpText<"Enable the iterative type checker">;
159156

lib/Frontend/CompilerInvocation.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@ static bool ParseLangArgs(LangOptions &Opts, ArgList &Args,
208208

209209
Opts.EnableASTScopeLookup |= Args.hasArg(OPT_enable_astscope_lookup);
210210
Opts.DebugConstraintSolver |= Args.hasArg(OPT_debug_constraints);
211-
Opts.EnableConstraintPropagation |= Args.hasArg(OPT_propagate_constraints);
212211
Opts.IterativeTypeChecker |= Args.hasArg(OPT_iterative_type_checker);
213212
Opts.NamedLazyMemberLoading &= !Args.hasArg(OPT_disable_named_lazy_member_loading);
214213
Opts.DebugGenericSignatures |= Args.hasArg(OPT_debug_generic_signatures);

lib/Sema/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ add_swift_library(swiftSema STATIC
88
CSBindings.cpp
99
CSDiag.cpp
1010
CSGen.cpp
11-
CSPropagate.cpp
1211
CSRanking.cpp
1312
CSSimplify.cpp
1413
CSSolver.cpp

lib/Sema/CSPropagate.cpp

Lines changed: 0 additions & 323 deletions
This file was deleted.

lib/Sema/CSSolver.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -984,12 +984,6 @@ void ConstraintSystem::Candidate::applySolutions(
984984
}
985985

986986
void ConstraintSystem::shrink(Expr *expr) {
987-
// Disable the shrink pass when constraint propagation is
988-
// enabled. They achieve similar effects, and the shrink pass is
989-
// known to have bad behavior in some cases.
990-
if (TC.Context.LangOpts.EnableConstraintPropagation)
991-
return;
992-
993987
typedef llvm::SmallDenseMap<Expr *, ArrayRef<ValueDecl *>> DomainMap;
994988

995989
// A collection of original domains of all of the expressions,
@@ -1421,11 +1415,6 @@ bool ConstraintSystem::solve(Expr *const expr,
14211415
if (failedConstraint || simplify())
14221416
return true;
14231417

1424-
// If the experimental constraint propagation pass is enabled, run it.
1425-
if (TC.Context.LangOpts.EnableConstraintPropagation)
1426-
if (propagateConstraints())
1427-
return true;
1428-
14291418
// Solve the system.
14301419
solveRec(solutions, allowFreeTypeVariables);
14311420

test/Misc/expression_too_complex.swift

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)