@@ -8965,13 +8965,14 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
8965
8965
break ;
8966
8966
}
8967
8967
} else if (auto stmtCondition = target.getAsStmtCondition ()) {
8968
+ auto &cs = solution.getConstraintSystem ();
8969
+
8968
8970
for (auto &condElement : *stmtCondition) {
8969
8971
switch (condElement.getKind ()) {
8970
8972
case StmtConditionElement::CK_Availability:
8971
8973
continue ;
8972
8974
8973
8975
case StmtConditionElement::CK_HasSymbol: {
8974
- ConstraintSystem &cs = solution.getConstraintSystem ();
8975
8976
auto info = condElement.getHasSymbolInfo ();
8976
8977
auto target = *cs.getSolutionApplicationTarget (&condElement);
8977
8978
auto resolvedTarget = rewriteTarget (target);
@@ -8988,30 +8989,21 @@ ExprWalker::rewriteTarget(SolutionApplicationTarget target) {
8988
8989
}
8989
8990
8990
8991
case StmtConditionElement::CK_Boolean: {
8991
- auto condExpr = condElement. getBoolean ( );
8992
- auto finalCondExpr = condExpr-> walk (* this );
8993
- if (!finalCondExpr )
8992
+ auto target = *cs. getSolutionApplicationTarget (&condElement );
8993
+ auto resolvedTarget = rewriteTarget (target );
8994
+ if (!resolvedTarget )
8994
8995
return None;
8995
8996
8996
- // Load the condition if needed.
8997
- solution.setExprTypes (finalCondExpr);
8998
- if (finalCondExpr->getType ()->hasLValueType ()) {
8999
- ASTContext &ctx = solution.getConstraintSystem ().getASTContext ();
9000
- finalCondExpr = TypeChecker::addImplicitLoadExpr (ctx, finalCondExpr);
9001
- }
9002
-
9003
- condElement.setBoolean (finalCondExpr);
8997
+ condElement.setBoolean (resolvedTarget->getAsExpr ());
9004
8998
continue ;
9005
8999
}
9006
9000
9007
9001
case StmtConditionElement::CK_PatternBinding: {
9008
- ConstraintSystem &cs = solution.getConstraintSystem ();
9009
9002
auto target = *cs.getSolutionApplicationTarget (&condElement);
9010
9003
auto resolvedTarget = rewriteTarget (target);
9011
9004
if (!resolvedTarget)
9012
9005
return None;
9013
9006
9014
- solution.setExprTypes (resolvedTarget->getAsExpr ());
9015
9007
condElement.setInitializer (resolvedTarget->getAsExpr ());
9016
9008
condElement.setPattern (resolvedTarget->getInitializationPattern ());
9017
9009
continue ;
0 commit comments