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(
882
882
if (sourceFile)
883
883
sourceFile->setImportUsedPreconcurrency (*import );
884
884
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 ()
886
888
? DiagnosticBehavior::Warning
887
889
: DiagnosticBehavior::Ignore;
888
890
}
Original file line number Diff line number Diff line change 12
12
func acceptSendable< T: Sendable > ( _: T ) { }
13
13
14
14
func 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)
17
17
}
Original file line number Diff line number Diff line change 1
1
// 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
3
3
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/NonStrictModule.swiftmodule -module-name NonStrictModule %S/Inputs/NonStrictModule.swift
4
4
5
5
// 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) { }
15
15
@available ( SwiftStdlib 5 . 1 , * )
16
16
func test( ss: StrictStruct , ns: NonStrictClass ) {
17
17
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)
19
19
}
You can’t perform that action at this time.
0 commit comments