Skip to content

Commit 3fccf14

Browse files
committed
wip: more fixes
1 parent b4bd037 commit 3fccf14

File tree

3 files changed

+4
-16
lines changed

3 files changed

+4
-16
lines changed

include/swift/Sema/SyntacticElementTarget.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,6 @@ struct SequenceIterationInfo {
4141

4242
/// The type of the pattern that matches the elements.
4343
Type initType;
44-
45-
/// Implicit `$iterator = <sequence>.makeIterator()`
46-
PatternBindingDecl *makeIteratorVar;
47-
48-
/// Implicit `$iterator.next()` call.
49-
Expr *nextCall;
5044
};
5145

5246
/// Describes information about a for-in loop over a pack that needs to be

lib/Sema/CSGen.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4664,14 +4664,6 @@ generateForEachStmtConstraints(ConstraintSystem &cs, DeclContext *dc,
46644664
bool isAsync = stmt->getAwaitLoc().isValid();
46654665
auto *sequenceExpr = stmt->getParsedSequence();
46664666

4667-
// If we have an unsafe expression for the sequence, lift it out of the
4668-
// sequence expression. We'll put it back after we've introduced the
4669-
// various calls.
4670-
UnsafeExpr *unsafeExpr = dyn_cast<UnsafeExpr>(sequenceExpr);
4671-
if (unsafeExpr) {
4672-
sequenceExpr = unsafeExpr->getSubExpr();
4673-
}
4674-
46754667
auto contextualLocator = cs.getConstraintLocator(
46764668
sequenceExpr, LocatorPathElt::ContextualType(CTP_ForEachSequence));
46774669
auto elementLocator = cs.getConstraintLocator(

lib/Sema/TypeCheckStmt.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3465,7 +3465,7 @@ static BraceStmt *desugarForEachStmt(ForEachStmt* stmt){
34653465

34663466
auto *makeIteratorVar = new (ctx)
34673467
VarDecl(/*isStatic=*/false, VarDecl::Introducer::Var,
3468-
parsedSequence->getStartLoc(),
3468+
opaqueSeqExpr->getStartLoc(),
34693469
ctx.getIdentifier(name), dc);
34703470
makeIteratorVar->setImplicit();
34713471

@@ -3493,7 +3493,9 @@ static BraceStmt *desugarForEachStmt(ForEachStmt* stmt){
34933493
Expr *makeIteratorCall =
34943494
CallExpr::createImplicitEmpty(ctx, makeIteratorRef);
34953495

3496-
// Swap in the 'unsafe' expression.
3496+
// FIXME: commenting this out "fixes" a redundant visit of the sequence's init
3497+
// expr. We need to investigate this.
3498+
// Swap in the 'unsafe' expression.
34973499
if (unsafeExpr) {
34983500
unsafeExpr->setSubExpr(makeIteratorCall);
34993501
makeIteratorCall = unsafeExpr;

0 commit comments

Comments
 (0)