From 6e81565c101db67b852046f9ba6b85d45a702700 Mon Sep 17 00:00:00 2001 From: Doug Gregor Date: Thu, 18 Jul 2024 22:42:28 -0700 Subject: [PATCH] Disable warning about `@preconcurrency` having no effect on an import We have a couple of persistent issues where the warning about `@preconcurrency` having no effect on import declarations is emitted but is wrong, because removing the `@preconcurrency` will cause warnings or errors to appear. Disable this warning until we can make it reliable. --- lib/Sema/TypeCheckConcurrency.cpp | 20 ++----------------- .../predates_concurrency_import.swift | 1 - 2 files changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/Sema/TypeCheckConcurrency.cpp b/lib/Sema/TypeCheckConcurrency.cpp index a18e64bd852ef..536e226db2fca 100644 --- a/lib/Sema/TypeCheckConcurrency.cpp +++ b/lib/Sema/TypeCheckConcurrency.cpp @@ -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 diff --git a/test/Concurrency/predates_concurrency_import.swift b/test/Concurrency/predates_concurrency_import.swift index 5e9536687d702..b69fd5fdb7c2c 100644 --- a/test/Concurrency/predates_concurrency_import.swift +++ b/test/Concurrency/predates_concurrency_import.swift @@ -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 { }