|
3 | 3 | // RUN: %target-typecheck-verify-swift -swift-version 6 -verify-additional-prefix swift6-
|
4 | 4 |
|
5 | 5 | protocol P {
|
6 |
| - var prop: [String: any Sendable] { get set } |
| 6 | + @preconcurrency var prop: [String: any Sendable] { get set } |
7 | 7 | // expected-swift5-note@-1 3 {{expected sendability to match requirement here}}
|
8 | 8 | // expected-swift6-note@-2 3 {{protocol requires property 'prop' with type '[String : any Sendable]'}}
|
9 |
| - func reqFn(_: [String: any Sendable], _: @Sendable ((any Sendable)?) -> Void) |
| 9 | + @preconcurrency func reqFn(_: [String: any Sendable], _: @Sendable ((any Sendable)?) -> Void) |
10 | 10 | // expected-swift5-note@-1 2 {{expected sendability to match requirement here}}
|
11 | 11 | // expected-swift6-note@-2 2 {{protocol requires function 'reqFn' with type '([String : any Sendable], @Sendable ((any Sendable)?) -> Void) -> ()'}}
|
12 | 12 | }
|
@@ -37,3 +37,19 @@ struct S3 : P { // expected-swift6-error {{type 'S3' does not conform to protoco
|
37 | 37 |
|
38 | 38 | func reqFn(_: [String: any Sendable], _: ((any Sendable)?) -> Void) {} // Ok
|
39 | 39 | }
|
| 40 | + |
| 41 | +protocol Q { |
| 42 | + var prop: [String: [String: any Sendable]] { get set } |
| 43 | + // expected-note@-1 {{protocol requires property 'prop' with type '[String : [String : any Sendable]]'}} |
| 44 | + |
| 45 | + func test(_: [() -> (any Sendable)?]) |
| 46 | + // expected-note@-1 {{protocol requires function 'test' with type '([() -> (any Sendable)?]) -> ()'}} |
| 47 | +} |
| 48 | + |
| 49 | +struct S4 : Q { // expected-error {{type 'S4' does not conform to protocol 'Q'}} expected-note {{add stubs for conformance}} |
| 50 | + var prop: [String: [String: Any]] = [:] |
| 51 | + // expected-note@-1 {{candidate has non-matching type '[String : [String : Any]]'}} |
| 52 | + |
| 53 | + func test(_: [() -> Any?]) {} |
| 54 | + // expected-note@-1 {{candidate has non-matching type '([() -> Any?]) -> ()'}} |
| 55 | +} |
0 commit comments