File tree Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Expand file tree Collapse file tree 3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -882,7 +882,9 @@ DiagnosticBehavior SendableCheckContext::diagnosticBehavior(
882882 if (sourceFile)
883883 sourceFile->setImportUsedPreconcurrency (*import );
884884
885- return nominal->getASTContext ().LangOpts .isSwiftVersionAtLeast (6 )
885+ // `@preconcurrency` suppresses diagnostics until the imported
886+ // module enables Swift 6.
887+ return import ->module .importedModule ->isConcurrencyChecked ()
886888 ? DiagnosticBehavior::Warning
887889 : DiagnosticBehavior::Ignore;
888890 }
Original file line number Diff line number Diff line change 1212func acceptSendable< T: Sendable > ( _: T ) { }
1313
1414func useSendable( ns: NSString ) {
15- // Note: warning below is downgraded due to @preconcurrency
16- acceptSendable ( ns) // expected-warning{{type 'NSString' does not conform to the 'Sendable' protocol}}
15+ // Note: warning below is suppressed due to @preconcurrency
16+ acceptSendable ( ns)
1717}
Original file line number Diff line number Diff line change 11// RUN: %empty-directory(%t)
2- // RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -strict-concurrency=complete %S/Inputs/StrictModule.swift
2+ // RUN: %target-swift-frontend -emit-module -emit-module-path %t/StrictModule.swiftmodule -module-name StrictModule -swift-version 6 %S/Inputs/StrictModule.swift
33// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
44
55// RUN: %target-swift-frontend -swift-version 6 -I %t %s %s -emit-sil -o /dev/null -verify
@@ -15,5 +15,5 @@ func acceptSendable<T: Sendable>(_: T) { }
1515@available ( SwiftStdlib 5 . 1 , * )
1616func test( ss: StrictStruct , ns: NonStrictClass ) {
1717 acceptSendable ( ss) // expected-warning{{type 'StrictStruct' does not conform to the 'Sendable' protocol}}
18- acceptSendable ( ns) // expected-warning{{type 'NonStrictClass' does not conform to the 'Sendable' protocol}}
18+ acceptSendable ( ns)
1919}
You can’t perform that action at this time.
0 commit comments