Skip to content

Commit af07642

Browse files
committed
Sema: Remove TypeCheckExprFlags::SkipMultiStmtClosures
Fold this into TypeCheckExprFlags::SubExpressionDiagnostics, which is itself going away soon, hopefully!
1 parent bdbe062 commit af07642

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

lib/Sema/CSApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7208,7 +7208,7 @@ bool ConstraintSystem::applySolutionFixes(const Solution &solution) {
72087208
Expr *ConstraintSystem::applySolution(Solution &solution, Expr *expr,
72097209
Type convertType,
72107210
bool discardedExpr,
7211-
bool skipClosures) {
7211+
bool performingDiagnostics) {
72127212
// If any fixes needed to be applied to arrive at this solution, resolve
72137213
// them to specific expressions.
72147214
if (!solution.Fixes.empty()) {
@@ -7242,7 +7242,7 @@ Expr *ConstraintSystem::applySolution(Solution &solution, Expr *expr,
72427242

72437243
// If we're re-typechecking an expression for diagnostics, don't
72447244
// visit closures that have non-single expression bodies.
7245-
if (!skipClosures) {
7245+
if (!performingDiagnostics) {
72467246
bool hadError = false;
72477247
for (auto *closure : walker.getClosuresToTypeCheck())
72487248
hadError |= TypeChecker::typeCheckClosureBody(closure);

lib/Sema/CSDiag.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -595,10 +595,6 @@ Expr *FailureDiagnosis::typeCheckChildIndependently(
595595
// to diagnose a problem.
596596
TCEOptions |= TypeCheckExprFlags::SubExpressionDiagnostics;
597597

598-
// Don't walk into non-single expression closure bodies, because
599-
// ExprTypeSaver and TypeNullifier skip them too.
600-
TCEOptions |= TypeCheckExprFlags::SkipMultiStmtClosures;
601-
602598
// Claim that the result is discarded to preserve the lvalue type of
603599
// the expression.
604600
if (options.contains(TCC_AllowLValue))

lib/Sema/ConstraintSystem.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3898,11 +3898,12 @@ class ConstraintSystem {
38983898
/// expression should be converted, if any.
38993899
/// \param discardedExpr if true, the result of the expression
39003900
/// is contextually ignored.
3901-
/// \param skipClosures if true, don't descend into bodies of
3902-
/// non-single expression closures.
3901+
/// \param performingDiagnostics if true, don't descend into bodies of
3902+
/// non-single expression closures, or build curry thunks.
39033903
Expr *applySolution(Solution &solution, Expr *expr,
3904-
Type convertType, bool discardedExpr,
3905-
bool skipClosures);
3904+
Type convertType,
3905+
bool discardedExpr,
3906+
bool performingDiagnostics);
39063907

39073908
/// Reorder the disjunctive clauses for a given expression to
39083909
/// increase the likelihood that a favored constraint will be successfully

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2259,7 +2259,7 @@ Type TypeChecker::typeCheckExpressionImpl(Expr *&expr, DeclContext *dc,
22592259
result = cs.applySolution(
22602260
solution, result, convertType.getType(),
22612261
options.contains(TypeCheckExprFlags::IsDiscarded),
2262-
options.contains(TypeCheckExprFlags::SkipMultiStmtClosures));
2262+
options.contains(TypeCheckExprFlags::SubExpressionDiagnostics));
22632263

22642264
if (!result) {
22652265
listener.applySolutionFailed(solution, expr);

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,6 @@ enum class TypeCheckExprFlags {
182182
/// not affect type checking itself.
183183
IsExprStmt = 0x20,
184184

185-
/// If set, this expression is being re-type checked as part of diagnostics,
186-
/// and so we should not visit bodies of non-single expression closures.
187-
SkipMultiStmtClosures = 0x40,
188-
189185
/// This is an inout yield.
190186
IsInOutYield = 0x100,
191187

0 commit comments

Comments
 (0)