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
// effectful properties from outside the actor instance
178
178
179
-
// expected-warning@+2 {{non-sendable type 'Box' in asynchronous access to actor-isolated property 'effPropA' cannot cross actor boundary}}
179
+
// expected-warning@+2 {{non-sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
180
180
// expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
181
181
_ = a.effPropA
182
182
183
-
// expected-warning@+3 {{non-sendable type 'Box' in implicitly asynchronous access to actor-isolated property 'effPropT' cannot cross actor boundary}}
183
+
// expected-warning@+3 {{non-sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
184
184
// expected-error@+2{{property access can throw, but it is not marked with 'try' and the error is not handled}}
185
185
// expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
186
186
_ = a.effPropT
@@ -190,8 +190,8 @@ func someAsyncFunc() async {
190
190
_ = a.effPropAT
191
191
192
192
// (mostly) corrected ones
193
-
_ =await a.effPropA // expected-warning {{non-sendable type 'Box' in asynchronous access to actor-isolated property 'effPropA' cannot cross actor boundary}}
194
-
_ =try!await a.effPropT // expected-warning {{non-sendable type 'Box' in implicitly asynchronous access to actor-isolated property 'effPropT' cannot cross actor boundary}}
193
+
_ =await a.effPropA // expected-warning {{non-sendable type 'Box' of property 'effPropA' cannot exit actor-isolated context}}
194
+
_ =try!await a.effPropT // expected-warning {{non-sendable type 'Box' of property 'effPropT' cannot exit actor-isolated context}}
act.text[0]+="hello" // expected-error{{actor-isolated property 'text' can not be mutated from a nonisolated context}}
113
113
114
-
_ = act.point // expected-warning{{non-sendable type 'Point' in implicitly asynchronous access to actor-isolated property 'point' cannot cross actor boundary}}
114
+
_ = act.point // expected-warning{{non-sendable type 'Point' of property 'point' cannot exit actor-isolated context}}
115
115
// expected-warning@-1 {{expression is 'async' but is not marked with 'await'}}
116
116
// expected-note@-2 {{property access is 'async'}}
_ =await ext.point // expected-warning {{non-sendable type 'Point' in implicitly asynchronous access to main actor-isolated property 'point' cannot cross actor boundary}}
155
-
_ =await anno.point // expected-warning {{non-sendable type 'Point' in implicitly asynchronous access to global actor 'SomeGlobalActor'-isolated property 'point' cannot cross actor boundary}}
154
+
_ =await ext.point // expected-warning {{non-sendable type 'Point' of property 'point' cannot exit main actor-isolated context}}
155
+
_ =await anno.point // expected-warning {{non-sendable type 'Point' of property 'point' cannot exit global actor 'SomeGlobalActor'-isolated context}}
156
156
// expected-warning@-1 {{non-sendable type 'NoGlobalActorValueType' cannot be sent into global actor 'SomeGlobalActor'-isolated context in call to property 'point'}}
_ =await(formance asMainCounter).counter // expected-warning {{non-sendable type 'any MainCounter' cannot be sent into main actor-isolated context in call to property 'counter'}}
163
163
_ =awaitext[1]
164
164
_ =await formance.ticker
165
-
_ =await ext.polygon // expected-warning {{non-sendable type '[Point]' in implicitly asynchronous access to main actor-isolated property 'polygon' cannot cross actor boundary}}
165
+
_ =await ext.polygon // expected-warning {{non-sendable type '[Point]' of property 'polygon' cannot exit main actor-isolated context}}
166
166
_ =awaitInferredFromContext.stuff
167
-
_ =awaitNoGlobalActorValueType.polygon // expected-warning {{non-sendable type '[Point]' in implicitly asynchronous access to main actor-isolated static property 'polygon' cannot cross actor boundary}}
167
+
_ =awaitNoGlobalActorValueType.polygon // expected-warning {{non-sendable type '[Point]' of static property 'polygon' cannot exit main actor-isolated context}}
168
168
}
169
169
170
170
// expected-warning@+2 {{memberwise initializer for 'NoGlobalActorValueType' cannot be both nonisolated and global actor 'SomeGlobalActor'-isolated; this is an error in the Swift 6 language mode}}
_ =actor.c // expected-error{{expression is 'async' but is not marked with 'await'}}
1051
1051
// expected-note@-1{{property access is 'async'}}
1052
-
// expected-warning@-2{{non-sendable type 'SomeClass' in implicitly asynchronous access to actor-isolated property 'c' cannot cross actor boundary}}
1053
-
_ =awaitactor.c // expected-warning{{non-sendable type 'SomeClass' in implicitly asynchronous access to actor-isolated property 'c' cannot cross actor boundary}}
1052
+
// expected-warning@-2{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
1053
+
_ =awaitactor.c // expected-warning{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
1054
1054
_ =awaitactor.d // okay
1055
1055
}
1056
1056
@@ -1085,8 +1085,8 @@ actor CrossModuleFromInitsActor {
1085
1085
_ =actor.b // okay
1086
1086
_ =actor.c // expected-error{{expression is 'async' but is not marked with 'await'}}
1087
1087
// expected-note@-1{{property access is 'async'}}
1088
-
// expected-warning@-2{{non-sendable type 'SomeClass' in implicitly asynchronous access to actor-isolated property 'c' cannot cross actor boundary}}
1089
-
_ =awaitactor.c // expected-warning{{non-sendable type 'SomeClass' in implicitly asynchronous access to actor-isolated property 'c' cannot cross actor boundary}}
1088
+
// expected-warning@-2{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
1089
+
_ =awaitactor.c // expected-warning{{non-sendable type 'SomeClass' of property 'c' cannot exit actor-isolated context}}
1090
1090
_ =awaitactor.d // okay
1091
1091
}
1092
1092
}
@@ -1613,7 +1613,7 @@ class ReferenceActor {
1613
1613
init()async{
1614
1614
self.a =ProtectNonSendable()
1615
1615
1616
-
// expected-warning@+3 {{non-sendable type 'NonSendable' in implicitly asynchronous access to actor-isolated property 'ns' cannot cross actor boundary}}
1616
+
// expected-warning@+3 {{non-sendable type 'NonSendable' of property 'ns' cannot exit actor-isolated context}}
1617
1617
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
1618
1618
// expected-note@+1 {{property access is 'async'}}
Copy file name to clipboardExpand all lines: test/Concurrency/concurrent_value_checking.swift
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -99,7 +99,7 @@ extension A1 {
99
99
_ =awaitself.asynchronous(nil)
100
100
101
101
// Across to a different actor, so Sendable restriction is enforced.
102
-
_ = other.localLet // expected-warning{{non-sendable type 'NotConcurrent' in implicitly asynchronous access to actor-isolated property 'localLet' cannot cross actor boundary}}
102
+
_ = other.localLet // expected-warning{{non-sendable type 'NotConcurrent' of property 'localLet' cannot exit actor-isolated context}}
103
103
// expected-warning@-1 {{expression is 'async' but is not marked with 'await'}}
104
104
// expected-note@-2 {{property access is 'async'}}
105
105
_ =await other.synchronous() // expected-warning{{non-sendable result type 'NotConcurrent?' cannot be sent from actor-isolated context in call to instance method 'synchronous()'}}
@@ -140,22 +140,22 @@ enum E {
140
140
func globalTest()async{
141
141
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
142
142
// expected-note@+1 {{property access is 'async'}}
143
-
leta= globalValue // expected-warning{{non-sendable type 'NotConcurrent?' in implicitly asynchronous access to global actor 'SomeGlobalActor'-isolated let 'globalValue' cannot cross actor boundary}}
143
+
leta= globalValue // expected-warning{{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
144
144
awaitglobalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
145
145
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local nonisolated uses}}
146
146
awaitglobalSync(a) // expected-tns-note {{access can happen concurrently}}
147
147
148
148
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
149
149
// expected-note@+1 {{property access is 'async'}}
150
-
let _ =E.notSafe // expected-warning{{non-sendable type 'NotConcurrent?' in implicitly asynchronous access to global actor 'SomeGlobalActor'-isolated static property 'notSafe' cannot cross actor boundary}}
150
+
let _ =E.notSafe // expected-warning{{non-sendable type 'NotConcurrent?' of static property 'notSafe' cannot exit global actor 'SomeGlobalActor'-isolated context}}
151
151
152
152
#if ALLOW_TYPECHECKER_ERRORS
153
153
// expected-typechecker-error@+3 {{expression is 'async' but is not marked with 'await'}}
154
154
// expected-typechecker-note@+2 {{call is 'async'}}
155
155
// expected-typechecker-note@+1 {{property access is 'async'}}
156
156
globalAsync(E.notSafe)
157
157
158
-
// expected-typechecker-warning@-2 {{non-sendable type 'NotConcurrent?' in implicitly asynchronous access to global actor 'SomeGlobalActor'-isolated static property 'notSafe' cannot cross actor boundary}}
158
+
// expected-typechecker-warning@-2 {{non-sendable type 'NotConcurrent?' of static property 'notSafe' cannot exit global actor 'SomeGlobalActor'-isolated context}}
// expected-warning@+2 {{expression is 'async' but is not marked with 'await'}}
179
179
// expected-note@+1 {{property access is 'async'}}
180
-
leta= globalValue // expected-warning {{non-sendable type 'NotConcurrent?' in implicitly asynchronous access to global actor 'SomeGlobalActor'-isolated let 'globalValue' cannot cross actor boundary}}
180
+
leta= globalValue // expected-warning {{non-sendable type 'NotConcurrent?' of let 'globalValue' cannot exit global actor 'SomeGlobalActor'-isolated context}}
181
181
awaitglobalAsync(a) // expected-tns-warning {{sending 'a' risks causing data races}}
182
182
// expected-tns-note @-1 {{sending global actor 'SomeGlobalActor'-isolated 'a' to global actor 'SomeGlobalActor'-isolated global function 'globalAsync' risks causing data races between global actor 'SomeGlobalActor'-isolated and local main actor-isolated uses}}
183
183
awaitglobalSync(a) // expected-tns-note {{access can happen concurrently}}
@@ -259,7 +259,7 @@ actor ANI {
259
259
}
260
260
261
261
func testANI(ani:ANI)async{
262
-
_ = ani.nc // expected-warning{{non-sendable type 'NC' in asynchronous access to nonisolated property 'nc' cannot cross actor boundary}}
262
+
_ = ani.nc // expected-warning{{non-sendable type 'NC' of property 'nc' cannot exit nonisolated context}}
// expected-warning@-1 {{expression is 'async' but is not marked with 'await'; this is an error in the Swift 6 language mode}}
445
445
// expected-note@-2 {{property access is 'async'}}
446
-
// expected-warning@-3 {{non-sendable type 'NonSendable' in implicitly asynchronous access to main actor-isolated property 'x' cannot cross actor boundary; this is an error in the Swift 6 language mode}}
446
+
// expected-warning@-3 {{non-sendable type 'NonSendable' of property 'x' cannot exit main actor-isolated context; this is an error in the Swift 6 language mode}}
func f()async->NotSendable{NotSendable()} // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'f()'}}
55
55
56
-
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' in conformance of actor-isolated property 'prop' to protocol requirement cannot cross actor boundary}}
56
+
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'prop'}}
57
57
get async{
58
58
NotSendable()
59
59
}
@@ -66,7 +66,7 @@ actor A3: AsyncProtocolWithNotSendable {
66
66
actorA4:AsyncProtocolWithNotSendable{
67
67
func f()->NotSendable{NotSendable()} // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'f()'}}
68
68
69
-
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' in conformance of actor-isolated property 'prop' to protocol requirement cannot cross actor boundary}}
69
+
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'prop'}}
func f()async->NotSendable{NotSendable()} // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'f()'}}
113
113
114
-
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' in conformance of actor-isolated property 'prop' to protocol requirement cannot cross actor boundary}}
114
+
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'prop'}}
115
115
get async{
116
116
NotSendable()
117
117
}
@@ -124,7 +124,7 @@ actor A7: AsyncThrowingProtocolWithNotSendable {
124
124
actorA8:AsyncThrowingProtocolWithNotSendable{
125
125
func f()->NotSendable{NotSendable()} // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'f()'}}
126
126
127
-
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' in conformance of actor-isolated property 'prop' to protocol requirement cannot cross actor boundary}}
127
+
varprop:NotSendable{ // expected-warning{{non-sendable type 'NotSendable' cannot be returned from actor-isolated implementation to caller of protocol requirement 'prop'}}
0 commit comments