@@ -3541,11 +3541,12 @@ void swift::performAbstractFuncDeclDiagnostics(AbstractFunctionDecl *AFD) {
35413541}
35423542
35433543// Perform MiscDiagnostics on Switch Statements.
3544- static void checkSwitch (ASTContext &ctx, const SwitchStmt *stmt) {
3544+ static void checkSwitch (ASTContext &ctx, const SwitchStmt *stmt,
3545+ DeclContext *DC) {
35453546 // We want to warn about "case .Foo, .Bar where 1 != 100:" since the where
35463547 // clause only applies to the second case, and this is surprising.
35473548 for (auto cs : stmt->getCases ()) {
3548- TypeChecker::checkExistentialTypes (ctx, cs);
3549+ TypeChecker::checkExistentialTypes (ctx, cs, DC );
35493550
35503551 // The case statement can have multiple case items, each can have a where.
35513552 // If we find a "where", and there is a preceding item without a where, and
@@ -5038,10 +5039,10 @@ void swift::performSyntacticExprDiagnostics(const Expr *E,
50385039void swift::performStmtDiagnostics (const Stmt *S, DeclContext *DC) {
50395040 auto &ctx = DC->getASTContext ();
50405041
5041- TypeChecker::checkExistentialTypes (ctx, const_cast <Stmt *>(S));
5042-
5042+ TypeChecker::checkExistentialTypes (ctx, const_cast <Stmt *>(S), DC );
5043+
50435044 if (auto switchStmt = dyn_cast<SwitchStmt>(S))
5044- checkSwitch (ctx, switchStmt);
5045+ checkSwitch (ctx, switchStmt, DC );
50455046
50465047 checkStmtConditionTrailingClosure (ctx, S);
50475048
0 commit comments