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
[send-non-sendable] Convert a few tests of sendable behavior to check for both strict and strict + sns behavior using the new diagnostic verifier multiple prefix option.
// expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
43
+
// expected-note@-1{{parameter 'fn' is implicitly non-sendable}}
39
44
){
40
-
acceptCV(ns1) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
41
-
acceptCV(ns1array) // expected-warning{{conformance of 'NS1' to 'Sendable' is unavailable}}
42
-
acceptCV(ns2)
43
-
acceptCV(ns3) // expected-warning{{conformance of 'NS3' to 'Sendable' is only available in macOS 11.0 or newer}}
44
-
// expected-note@-1{{add 'if #available' version check}}
45
-
acceptCV(ns4)
46
-
acceptCV(fn)
45
+
acceptCV(ns1) // expected-warning {{conformance of 'NS1' to 'Sendable' is unavailable}}
46
+
47
+
acceptCV(ns1array) // expected-warning {{conformance of 'NS1' to 'Sendable' is unavailable}}
48
+
49
+
acceptCV(ns2) // expected-complete-and-sns-warning {{type 'NS2' does not conform to the 'Sendable' protocol}}
50
+
51
+
acceptCV(ns3) // expected-warning {{conformance of 'NS3' to 'Sendable' is only available in macOS 11.0 or newer}}
52
+
// expected-note @-1 {{add 'if #available' version check}}
53
+
54
+
acceptCV(ns4) // expected-complete-and-sns-warning {{type 'NS4' does not conform to the 'Sendable' protocol}}
55
+
56
+
acceptCV(fn) // expected-complete-and-sns-warning {{type '() -> Void' does not conform to the 'Sendable' protocol}}
57
+
// expected-complete-and-sns-note @-1 {{a function type must be marked '@Sendable' to conform to 'Sendable'}}
58
+
47
59
acceptSendableFn(fn) // expected-warning{{passing non-sendable parameter 'fn' to function expecting a @Sendable closure}}
48
60
}
49
61
@@ -82,7 +94,7 @@ public actor MyActor: MyProto {
82
94
publicfunc bar<B>(aBar:B)asyncwhere B:Sendable{}
83
95
84
96
func g(ns1:NS1)async{
85
-
awaitnonisolatedAsyncFunc1(ns1) // expected-warning{{passing argument of non-sendable type 'NS1' outside of actor-isolated context may introduce data races}}
97
+
awaitnonisolatedAsyncFunc1(ns1) // expected-targeted-and-complete-warning{{passing argument of non-sendable type 'NS1' outside of actor-isolated context may introduce data races}}
86
98
_ =awaitnonisolatedAsyncFunc2() // expected-warning{{non-sendable type 'NS1' returned by implicitly asynchronous call to nonisolated function cannot cross actor boundary}}
// expected-note@-1 6 {{class 'NonSendable' does not conform to the 'Sendable' protocol}}
249
+
// expected-note @-1 3 {{class 'NonSendable' does not conform to the 'Sendable' protocol}}
250
+
// SendNonSendable emits 3 fewer errors here.
251
+
// expected-targeted-and-complete-note @-3 3 {{class 'NonSendable' does not conform to the 'Sendable' protocol}}
238
252
varvalue=""
239
253
240
254
@MainActor
@@ -244,10 +258,10 @@ final class NonSendable {
244
258
245
259
func call()async{
246
260
awaitupdate()
247
-
// expected-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
261
+
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
248
262
249
263
awaitself.update()
250
-
// expected-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
264
+
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
251
265
252
266
_ =await x
253
267
// expected-warning@-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
@@ -264,8 +278,8 @@ final class NonSendable {
264
278
func testNonSendableBaseArg()async{
265
279
lett=NonSendable()
266
280
await t.update()
267
-
// expected-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
281
+
// expected-targeted-and-complete-warning@-1 {{passing argument of non-sendable type 'NonSendable' into main actor-isolated context may introduce data races}}
268
282
269
283
_ =await t.x
270
-
// expected-warning@-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
284
+
// expected-warning@-1 {{non-sendable type 'NonSendable' passed in implicitly asynchronous call to main actor-isolated property 'x' cannot cross actor boundary}}
0 commit comments