Skip to content

Commit bddee5c

Browse files
committed
[Constraint system] Move shrinking back into typeCheckExpression()
We only want this at the top level, not during the middle of constraint generation.
1 parent 17e1c91 commit bddee5c

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lib/Sema/CSGen.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3897,12 +3897,6 @@ bool ConstraintSystem::generateConstraints(
38973897
SolutionApplicationTarget &target,
38983898
FreeTypeVariableBinding allowFreeTypeVariables) {
38993899
if (Expr *expr = target.getAsExpr()) {
3900-
// Try to shrink the system by reducing disjunction domains. This
3901-
// goes through every sub-expression and generate its own sub-system, to
3902-
// try to reduce the domains of those subexpressions.
3903-
shrink(expr);
3904-
target.setExpr(expr);
3905-
39063900
// If the target requires an optional of some type, form a new appropriate
39073901
// type variable and update the target's type with an optional of that
39083902
// type variable.

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2079,6 +2079,12 @@ TypeChecker::typeCheckExpression(
20792079
target.getExprContextualTypeLoc(),
20802080
target.getExprContextualTypePurpose());
20812081

2082+
// Try to shrink the system by reducing disjunction domains. This
2083+
// goes through every sub-expression and generate its own sub-system, to
2084+
// try to reduce the domains of those subexpressions.
2085+
cs.shrink(expr);
2086+
target.setExpr(expr);
2087+
20822088
// If the client can handle unresolved type variables, leave them in the
20832089
// system.
20842090
auto allowFreeTypeVariables = FreeTypeVariableBinding::Disallow;

0 commit comments

Comments
 (0)