Skip to content

Commit b9149e9

Browse files
authored
Merge pull request #75009 from hamishknight/remove-disable-avail
[Sema] NFC: Remove `DisableExprAvailabilityChecking`
2 parents d5b4a17 + ee5df00 commit b9149e9

File tree

5 files changed

+12
-22
lines changed

5 files changed

+12
-22
lines changed

include/swift/Sema/ConstraintSystem.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6519,9 +6519,8 @@ bool hasResultExpr(ClosureExpr *closure);
65196519

65206520
/// Emit diagnostics for syntactic restrictions within a given solution
65216521
/// application target.
6522-
void performSyntacticDiagnosticsForTarget(
6523-
const SyntacticElementTarget &target, bool isExprStmt,
6524-
bool disableExprAvailabilityChecking = false);
6522+
void performSyntacticDiagnosticsForTarget(const SyntacticElementTarget &target,
6523+
bool isExprStmt);
65256524

65266525
/// Given a member of a protocol, check whether `Self` type of that
65276526
/// protocol is contextually bound to some concrete type via same-type

lib/Sema/MiscDiagnostics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6373,7 +6373,7 @@ diagnoseDictionaryLiteralDuplicateKeyEntries(const Expr *E,
63736373
void swift::performSyntacticExprDiagnostics(
63746374
const Expr *E, const DeclContext *DC,
63756375
std::optional<ContextualTypePurpose> contextualPurpose, bool isExprStmt,
6376-
bool disableExprAvailabilityChecking, bool disableOutOfPlaceExprChecking) {
6376+
bool disableOutOfPlaceExprChecking) {
63776377
auto &ctx = DC->getASTContext();
63786378
TypeChecker::diagnoseSelfAssignment(E);
63796379
diagSyntacticUseRestrictions(E, DC, isExprStmt);
@@ -6385,7 +6385,7 @@ void swift::performSyntacticExprDiagnostics(
63856385
diagnoseComparisonWithNaN(E, DC);
63866386
if (!ctx.isSwiftVersionAtLeast(5))
63876387
diagnoseDeprecatedWritableKeyPath(E, DC);
6388-
if (!ctx.LangOpts.DisableAvailabilityChecking && !disableExprAvailabilityChecking)
6388+
if (!ctx.LangOpts.DisableAvailabilityChecking)
63896389
diagnoseExprAvailability(E, const_cast<DeclContext*>(DC));
63906390
if (ctx.LangOpts.EnableObjCInterop)
63916391
diagDeprecatedObjCSelectors(DC, E);

lib/Sema/MiscDiagnostics.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ namespace swift {
5252
void performSyntacticExprDiagnostics(
5353
const Expr *E, const DeclContext *DC,
5454
std::optional<ContextualTypePurpose> contextualPurpose, bool isExprStmt,
55-
bool disableExprAvailabilityChecking = false,
5655
bool disableOutOfPlaceExprChecking = false);
5756

5857
/// Emit diagnostics for a given statement.

lib/Sema/TypeCheckConstraints.cpp

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,6 @@ class FunctionSyntacticDiagnosticWalker : public ASTWalker {
341341
// We skip out-of-place expr checking here since we've already performed it.
342342
performSyntacticExprDiagnostics(expr, dcStack.back(), /*ctp*/ std::nullopt,
343343
/*isExprStmt=*/false,
344-
/*disableAvailabilityChecking*/ false,
345344
/*disableOutOfPlaceExprChecking*/ true);
346345

347346
if (auto closure = dyn_cast<ClosureExpr>(expr)) {
@@ -383,15 +382,14 @@ class FunctionSyntacticDiagnosticWalker : public ASTWalker {
383382
} // end anonymous namespace
384383

385384
void constraints::performSyntacticDiagnosticsForTarget(
386-
const SyntacticElementTarget &target, bool isExprStmt,
387-
bool disableExprAvailabilityChecking) {
385+
const SyntacticElementTarget &target, bool isExprStmt) {
388386
auto *dc = target.getDeclContext();
389387
switch (target.kind) {
390388
case SyntacticElementTarget::Kind::expression: {
391389
// First emit diagnostics for the main expression.
392-
performSyntacticExprDiagnostics(
393-
target.getAsExpr(), dc, target.getExprContextualTypePurpose(),
394-
isExprStmt, disableExprAvailabilityChecking);
390+
performSyntacticExprDiagnostics(target.getAsExpr(), dc,
391+
target.getExprContextualTypePurpose(),
392+
isExprStmt);
395393
return;
396394
}
397395

@@ -400,8 +398,7 @@ void constraints::performSyntacticDiagnosticsForTarget(
400398

401399
// First emit diagnostics for the main expression.
402400
performSyntacticExprDiagnostics(stmt->getTypeCheckedSequence(), dc,
403-
CTP_ForEachSequence, isExprStmt,
404-
disableExprAvailabilityChecking);
401+
CTP_ForEachSequence, isExprStmt);
405402

406403
if (auto *whereExpr = stmt->getWhere())
407404
performSyntacticExprDiagnostics(whereExpr, dc, CTP_Condition,
@@ -544,9 +541,7 @@ TypeChecker::typeCheckTarget(SyntacticElementTarget &target,
544541
// expression now.
545542
if (!cs.shouldSuppressDiagnostics()) {
546543
bool isExprStmt = options.contains(TypeCheckExprFlags::IsExprStmt);
547-
performSyntacticDiagnosticsForTarget(
548-
*resultTarget, isExprStmt,
549-
options.contains(TypeCheckExprFlags::DisableExprAvailabilityChecking));
544+
performSyntacticDiagnosticsForTarget(*resultTarget, isExprStmt);
550545
}
551546

552547
return *resultTarget;

lib/Sema/TypeChecker.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,12 @@ enum class TypeCheckExprFlags {
131131
/// not affect type checking itself.
132132
IsExprStmt = 0x02,
133133

134-
/// Don't type check expressions for correct availability.
135-
DisableExprAvailabilityChecking = 0x04,
136-
137134
/// Don't expand macros.
138-
DisableMacroExpansions = 0x08,
135+
DisableMacroExpansions = 0x04,
139136

140137
/// If set, typeCheckExpression will avoid invalidating the AST if
141138
/// type-checking fails. Do not add new uses of this.
142-
AvoidInvalidatingAST = 0x10,
139+
AvoidInvalidatingAST = 0x08,
143140
};
144141

145142
using TypeCheckExprOptions = OptionSet<TypeCheckExprFlags>;

0 commit comments

Comments
 (0)