@@ -4451,8 +4451,8 @@ static bool generateInitPatternConstraints(ConstraintSystem &cs,
44514451 return false ;
44524452}
44534453
4454- // / Generate constraints for a for-in statement preamble, expecting a
4455- // / `PackExpansionExpr`.
4454+ // / Generate constraints for a for-in statement preamble where the expression
4455+ // / is a `PackExpansionExpr`.
44564456static llvm::Optional<PackIterationInfo>
44574457generateForEachStmtConstraints (ConstraintSystem &cs, DeclContext *dc,
44584458 PackExpansionExpr *expansion, Type patternType) {
@@ -4528,6 +4528,7 @@ generateForEachStmtConstraints(ConstraintSystem &cs, DeclContext *dc,
45284528
45294529 auto *makeIteratorCall =
45304530 CallExpr::createImplicitEmpty (ctx, makeIteratorRef);
4531+
45314532 Pattern *pattern = NamedPattern::createImplicit (ctx, makeIteratorVar);
45324533 auto *PB = PatternBindingDecl::createImplicit (
45334534 ctx, StaticSpellingKind::None, pattern, makeIteratorCall, dc);
@@ -4544,6 +4545,7 @@ generateForEachStmtConstraints(ConstraintSystem &cs, DeclContext *dc,
45444545 return llvm::None;
45454546
45464547 sequenceIterationInfo.makeIteratorVar = PB;
4548+
45474549 // Type of sequence expression has to conform to Sequence protocol.
45484550 //
45494551 // Note that the following emulates having `$generator` separately
@@ -4610,7 +4612,7 @@ generateForEachStmtConstraints(ConstraintSystem &cs, DeclContext *dc,
46104612 cs.setTargetFor (sequenceIterationInfo.nextCall , nextTarget);
46114613 }
46124614
4613- // Generate constraints for the pattern
4615+ // Generate constraints for the pattern.
46144616 Type initType =
46154617 cs.generateConstraints (typeCheckedPattern, elementLocator,
46164618 shouldBindPatternVarsOneWay, nullptr , 0 );
@@ -4681,7 +4683,7 @@ generateForEachStmtConstraints(ConstraintSystem &cs,
46814683 if (isa<PackExpansionExpr>(forEachExpr)) {
46824684 auto *expansion = cast<PackExpansionExpr>(forEachExpr);
46834685
4684- // Generate constraints for the pattern
4686+ // Generate constraints for the pattern.
46854687 Type patternType = cs.generateConstraints (
46864688 pattern, elementLocator, target.shouldBindPatternVarsOneWay (), nullptr ,
46874689 0 );
0 commit comments