Skip to content

Commit 7ff18df

Browse files
authored
Merge pull request swiftlang#28358 from CodaFi/witness-protection-program
Ensure that we have a valid witness to IteratorProtocol.next()
2 parents 0c785c0 + 7e14e34 commit 7ff18df

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
@@ -865,6 +865,8 @@ class StmtChecker : public StmtVisitor<StmtChecker, Stmt*> {
865865

866866
auto witness =
867867
genConformance.getWitnessByName(iteratorTy, getASTContext().Id_next);
868+
if (!witness)
869+
return nullptr;
868870
S->setIteratorNext(witness);
869871

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

0 commit comments

Comments
 (0)