File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -257,6 +257,7 @@ getConcurrencyFixBehavior(
257257 switch (constraintKind) {
258258 case ConstraintKind::Conversion:
259259 case ConstraintKind::ArgumentConversion:
260+ case ConstraintKind::Subtype:
260261 break ;
261262
262263 default :
Original file line number Diff line number Diff line change @@ -46,3 +46,17 @@ func testAsync() async {
4646 }
4747 mutableVariable += 1
4848}
49+
50+ // rdar://99518344 - @Sendable in nested positions
51+ @preconcurrency typealias OtherHandler = @Sendable ( ) -> Void
52+ @preconcurrency typealias Handler = ( @Sendable ( ) -> OtherHandler ? ) ?
53+ @preconcurrency func f( arg: Int , withFn: Handler ? ) { }
54+
55+ class C {
56+ func test( ) {
57+ f ( arg: 5 , withFn: { [ weak self] ( ) -> OtherHandler ? in
58+ _ = self
59+ return nil
60+ } )
61+ }
62+ }
Original file line number Diff line number Diff line change 22// REQUIRES: concurrency
33
44// Concurrent attribute on a function type.
5+ // expected-note@+1{{found this candidate}}
56func f( _ fn: @Sendable ( Int ) -> Int ) { }
67
78// Okay to overload @Sendable vs. not concurrent
9+ // expected-note@+1{{found this candidate}}
810func f( _ fn: ( Int ) -> Int ) { }
911
1012// Concurrent attribute with other function attributes.
@@ -24,8 +26,10 @@ func passingConcurrentOrNot(
2426 _ cfn: @Sendable ( Int ) -> Int ,
2527 ncfn: ( Int ) -> Int // expected-note{{parameter 'ncfn' is implicitly non-sendable}}{{9-9=@Sendable }}
2628) {
29+ // Ambiguous because preconcurrency code doesn't consider `@Sendable`.
30+ f ( cfn) // expected-error{{ambiguous use of 'f'}}
31+
2732 // Okay due to overloading
28- f ( cfn)
2933 f ( ncfn)
3034
3135 acceptsConcurrent ( cfn) // okay
You can’t perform that action at this time.
0 commit comments