You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Concurrency] Allow witnesses to adopt concurrency before requirements
Allow witnesses to introduce `any Sendable` types into their interface
before requirements (predicated on presence of `@preconcurrency` and
Swift 5 language mode) as a pathway for concurrency adoption.
Resolves: rdar://134503878
Copy file name to clipboardExpand all lines: test/Concurrency/witness_matching_with_sendable.swift
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -53,3 +53,18 @@ struct S4 : Q { // expected-error {{type 'S4' does not conform to protocol 'Q'}}
53
53
func test(_:[()->Any?]){}
54
54
// expected-note@-1 {{candidate has non-matching type '([() -> Any?]) -> ()'}}
55
55
}
56
+
57
+
// Test that client is allowed to adopt concurrency first.
58
+
protocolPreConcurrency{
59
+
varprop:[String:Any]{get} // expected-swift6-note {{protocol requires property 'prop' with type '[String : Any]'}}
60
+
func req(_:[String:Any], _:((Any)?)->Void) // expected-swift6-note {{protocol requires function 'req' with type '([String : Any], (Any?) -> Void) -> ()'}}
61
+
}
62
+
63
+
classAdopter{
64
+
@preconcurrencyvarprop:[String:anySendable]=[:] // expected-swift6-note {{candidate has non-matching type '[String : any Sendable]'}}
65
+
}
66
+
67
+
extensionAdopter:PreConcurrency{ // expected-swift6-error {{type 'Adopter' does not conform to protocol 'PreConcurrency'}} expected-swift6-note {{add stubs for conformance}}
0 commit comments