File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 1
1
// RUN: %target-typecheck-verify-swift -disable-availability-checking -warn-concurrency
2
2
// REQUIRES: concurrency
3
3
4
- class NotConcurrent { } // expected-note 17 {{class 'NotConcurrent' does not conform to the `Sendable` protocol}}
4
+ class NotConcurrent { } // expected-note 18 {{class 'NotConcurrent' does not conform to the `Sendable` protocol}}
5
5
6
6
// ----------------------------------------------------------------------
7
7
// Sendable restriction on actor operations
@@ -304,3 +304,14 @@ enum E12<T>: UnsafeSendable { // expected-warning{{'UnsafeSendable' is deprecate
304
304
case payload( NotConcurrent ) // okay
305
305
case other( T ) // okay
306
306
}
307
+
308
+ // ----------------------------------------------------------------------
309
+ // @Sendable inference through optionals
310
+ // ----------------------------------------------------------------------
311
+ func testSendableOptionalInference( nc: NotConcurrent ) {
312
+ var fn : ( @Sendable ( ) -> Void ) ? = nil
313
+ fn = {
314
+ print ( nc) // expected-warning{{cannot use parameter 'nc' with a non-sendable type 'NotConcurrent' from concurrently-executed code}}
315
+ }
316
+ _ = fn
317
+ }
You can’t perform that action at this time.
0 commit comments