Skip to content

Commit

Permalink
Merge pull request swiftlang#78494 from DougGregor/disable-preconcurr…
Browse files Browse the repository at this point in the history
…ency-import-no-effect-warning

[6.1] Disable warning about `@preconcurrency` having no effect on an import
  • Loading branch information
DougGregor authored Jan 9, 2025
2 parents 398943a + 6e81565 commit 89bd00d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 19 deletions.
20 changes: 2 additions & 18 deletions lib/Sema/TypeCheckConcurrency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -942,24 +942,8 @@ bool swift::diagnoseSendabilityErrorBasedOn(
}

void swift::diagnoseUnnecessaryPreconcurrencyImports(SourceFile &sf) {
if (!shouldDiagnosePreconcurrencyImports(sf))
return;

ASTContext &ctx = sf.getASTContext();

if (ctx.TypeCheckerOpts.SkipFunctionBodies != FunctionBodySkipping::None)
return;

for (const auto &import : sf.getImports()) {
if (import.options.contains(ImportFlags::Preconcurrency) &&
import.importLoc.isValid() &&
!sf.hasImportUsedPreconcurrency(import)) {
ctx.Diags.diagnose(
import.importLoc, diag::remove_predates_concurrency_import,
import.module.importedModule->getName())
.fixItRemove(import.preconcurrencyRange);
}
}
// NOTE: Disabled in Swift 6.0.
return;
}

/// Produce a diagnostic for a single instance of a non-Sendable type where
Expand Down
1 change: 0 additions & 1 deletion test/Concurrency/predates_concurrency_import.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@preconcurrency import NonStrictModule
@_predatesConcurrency import StrictModule // expected-warning{{'@_predatesConcurrency' has been renamed to '@preconcurrency'}}
@preconcurrency import OtherActors
// expected-warning@-1{{'@preconcurrency' attribute on module 'OtherActors' has no effect}}{{1-17=}}

@preconcurrency
class MyPredatesConcurrencyClass { }
Expand Down

0 comments on commit 89bd00d

Please sign in to comment.