Skip to content

Commit 25c2e02

Browse files
committed
[Type checker] Eliminate TypeCheckExprFlags::DisableStructuralChecks.
This is always set along with SubExpressionDiagnostics, so use that for both purposes. That flag will go away when `CSDiag.cpp` goes away.
1 parent 9fa03cd commit 25c2e02

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

lib/Sema/CSDiag.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,10 @@ Expr *FailureDiagnosis::typeCheckChildIndependently(
394394
// type check operation.
395395
Expr *preCheckedExpr = subExpr;
396396

397-
// Disable structural checks, because we know that the overall expression
398-
// has type constraint problems, and we don't want to know about any
399-
// syntactic issues in a well-typed subexpression (which might be because
400-
// the context is missing).
401-
TypeCheckExprOptions TCEOptions = TypeCheckExprFlags::DisableStructuralChecks;
402-
403397
// Make sure that typechecker knows that this is an attempt
404398
// to diagnose a problem.
405-
TCEOptions |= TypeCheckExprFlags::SubExpressionDiagnostics;
399+
TypeCheckExprOptions TCEOptions =
400+
TypeCheckExprFlags::SubExpressionDiagnostics;
406401

407402
// Claim that the result is discarded to preserve the lvalue type of
408403
// the expression.

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2240,7 +2240,7 @@ Type TypeChecker::typeCheckExpression(Expr *&expr, DeclContext *dc,
22402240
// Unless the client has disabled them, perform syntactic checks on the
22412241
// expression now.
22422242
if (!cs.shouldSuppressDiagnostics() &&
2243-
!options.contains(TypeCheckExprFlags::DisableStructuralChecks)) {
2243+
!options.contains(TypeCheckExprFlags::SubExpressionDiagnostics)) {
22442244
bool isExprStmt = options.contains(TypeCheckExprFlags::IsExprStmt);
22452245
performSyntacticExprDiagnostics(result, dc, isExprStmt);
22462246
}

lib/Sema/TypeChecker.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,6 @@ enum class TypeCheckExprFlags {
163163
/// disables constraints forcing an lvalue result to be loadable.
164164
IsDiscarded = 0x01,
165165

166-
/// Whether the client wants to disable the structural syntactic restrictions
167-
/// that we force for style or other reasons.
168-
DisableStructuralChecks = 0x02,
169-
170166
/// If set, the client wants a best-effort solution to the constraint system,
171167
/// but can tolerate a solution where all of the constraints are solved, but
172168
/// not all type variables have been determined. In this case, the constraint

0 commit comments

Comments
 (0)