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
// We do not emit a warning in this case since we are calling transferring
37
-
// the result of a getter of an actor. The result of this getter could not
38
-
// have been returned from the actor without us emitting a warning as shown
39
-
// by the test klassGetter below.
37
+
// We should emit an error here since self is an actor which is non
38
+
// sendable, so we could be accessing isolated information from a part of
39
+
// the actor.
40
40
awaitself.klass.asyncCall()
41
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass' outside of actor-isolated context may introduce data races}}
41
42
}
42
43
43
44
func warningIfCallingAsyncOnFinalField()async{
44
45
// Since we are calling finalKlass directly, we emit a warning here.
await a.useKlass(ns0) // expected-warning {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
86
-
await a.useKlass(ns1) // expected-note {{access here could race}}
85
+
await a.useKlass(ns0)
86
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
87
+
// expected-sns-warning @-2 {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
88
+
await a.useKlass(ns1) // expected-sns-note {{access here could race}}
89
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
87
90
88
-
closure() // expected-note {{access here could race}}
91
+
closure() // expected-sns-note {{access here could race}}
await a.useKlass(ns0) // expected-warning {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
104
+
await a.useKlass(ns0) // expected-sns-warning {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
105
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
102
106
103
-
closure ={useInOut(&contents)} // expected-note {{access here could race}}
107
+
closure ={useInOut(&contents)} // expected-sns-note {{access here could race}}
104
108
105
-
await a.useKlass(ns1) // expected-note {{access here could race}}
109
+
await a.useKlass(ns1) // expected-sns-note {{access here could race}}
110
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
121
127
122
128
closure ={useValue(contents)}
123
129
124
-
await a.useKlass(ns1) // expected-warning {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
130
+
await a.useKlass(ns1) // expected-sns-warning {{passing argument of non-sendable type 'NonSendableKlass' from nonisolated context to actor-isolated context at this call site could yield a race with accesses later in this function}}
131
+
// expected-complete-warning @-1 {{passing argument of non-sendable type 'NonSendableKlass'}}
125
132
126
-
closure() // expected-note {{access here could race}}
133
+
closure() // expected-sns-note {{access here could race}}
0 commit comments