@@ -1496,24 +1496,26 @@ bool ConstraintSystem::generateConstraints(SingleValueStmtExpr *E) {
1496
1496
setType (E, resultType);
1497
1497
1498
1498
if (E->getStmtKind () == SingleValueStmtExpr::Kind::For) {
1499
- auto *rrcProtocol = ctx.getProtocol (KnownProtocolKind::RangeReplaceableCollection);
1499
+ auto *rrcProtocol =
1500
+ ctx.getProtocol (KnownProtocolKind::RangeReplaceableCollection);
1500
1501
auto *sequenceProtocol = ctx.getProtocol (KnownProtocolKind::Sequence);
1501
1502
1502
- addConstraint (ConstraintKind::ConformsTo,
1503
- resultType,
1504
- rrcProtocol->getDeclaredInterfaceType (),
1505
- loc);
1503
+ addConstraint (ConstraintKind::ConformsTo, resultType,
1504
+ rrcProtocol->getDeclaredInterfaceType (), loc);
1506
1505
Type elementTypeVar = createTypeVariable (loc, /* options*/ 0 );
1507
- Type elementType = DependentMemberType::get (resultType, sequenceProtocol->getAssociatedType (ctx.Id_Element ));
1506
+ Type elementType = DependentMemberType::get (
1507
+ resultType, sequenceProtocol->getAssociatedType (ctx.Id_Element ));
1508
1508
1509
1509
addConstraint (ConstraintKind::Bind, elementTypeVar, elementType, loc);
1510
- addConstraint (ConstraintKind::Defaultable, resultType, ArraySliceType::get (elementTypeVar), loc);
1510
+ addConstraint (ConstraintKind::Defaultable, resultType,
1511
+ ArraySliceType::get (elementTypeVar), loc);
1511
1512
1512
1513
auto *binding = E->getForExpressionPreamble ()->ForAccumulatorBinding ;
1513
1514
1514
1515
auto *initializer = binding->getInit (0 );
1515
- auto target = SyntacticElementTarget::forInitialization (initializer, Type (), binding, 0 , false );
1516
- setTargetFor ({ binding, 0 }, target);
1516
+ auto target = SyntacticElementTarget::forInitialization (initializer, Type (),
1517
+ binding, 0 , false );
1518
+ setTargetFor ({binding, 0 }, target);
1517
1519
1518
1520
if (generateConstraints (target)) {
1519
1521
return true ;
@@ -1552,15 +1554,15 @@ bool ConstraintSystem::generateConstraints(SingleValueStmtExpr *E) {
1552
1554
1553
1555
if (E->getStmtKind () != SingleValueStmtExpr::Kind::For) {
1554
1556
if (branches.empty ()) {
1555
- // If we only have statement branches, the expression is typed as Void. This
1556
- // should only be the case for 'if' and 'switch' statements that must be
1557
- // expressions that have branches that all end in a throw, and we'll warn
1558
- // that we've inferred Void.
1557
+ // If we only have statement branches, the expression is typed as Void.
1558
+ // This should only be the case for 'if' and 'switch' statements that must
1559
+ // be expressions that have branches that all end in a throw, and we'll
1560
+ // warn that we've inferred Void.
1559
1561
addConstraint (ConstraintKind::Bind, resultType, ctx.getVoidType (), loc);
1560
1562
} else {
1561
1563
// Otherwise, we join the result types for each of the branches.
1562
1564
join = TypeJoinExpr::forBranchesOfSingleValueStmtExpr (
1563
- ctx, resultType, E, AllocationArena::ConstraintSolver);
1565
+ ctx, resultType, E, AllocationArena::ConstraintSolver);
1564
1566
}
1565
1567
}
1566
1568
@@ -1605,8 +1607,8 @@ bool ConstraintSystem::generateConstraints(SingleValueStmtExpr *E) {
1605
1607
*this , ConstraintKind::Bind, resultType, closureResultTy, loc);
1606
1608
bindToClosure->setFavored ();
1607
1609
1608
- auto *bindToVoid = Constraint::create (* this , ConstraintKind::Bind,
1609
- resultType, ctx.getVoidType (), loc);
1610
+ auto *bindToVoid = Constraint::create (
1611
+ * this , ConstraintKind::Bind, resultType, ctx.getVoidType (), loc);
1610
1612
1611
1613
addDisjunctionConstraint ({bindToClosure, bindToVoid}, loc);
1612
1614
}
@@ -2701,7 +2703,7 @@ bool ConstraintSystem::applySolutionToSingleValueStmt(
2701
2703
2702
2704
if (SVE->getStmtKind () == SingleValueStmtExpr::Kind::For) {
2703
2705
auto *binding = SVE->getForExpressionPreamble ()->ForAccumulatorBinding ;
2704
- auto target = getTargetFor ({ binding, 0 }).value ();
2706
+ auto target = getTargetFor ({binding, 0 }).value ();
2705
2707
2706
2708
auto newTarget = rewriter.rewriteTarget (target);
2707
2709
if (!newTarget) {
0 commit comments