Skip to content

Commit 7e14e34

Browse files
committed
Ensure that we have a valid witness to IteratorProtocol.next()
Resolves rdar://57003406
1 parent 7b33254 commit 7e14e34

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

lib/Sema/TypeCheckStmt.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,8 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
863863

864864
auto witness =
865865
genConformance.getWitnessByName(iteratorTy, getASTContext().Id_next);
866+
if (!witness)
867+
return nullptr;
866868
S->setIteratorNext(witness);
867869

868870
auto nextResultType = cast<FuncDecl>(S->getIteratorNext().getDecl())

0 commit comments

Comments
 (0)