Skip to content

Commit a4eb43e

Browse files
authored
Merge pull request #74850 from gottesmm/pr-34859085fc34b650049006f026ab33726f79b600
[concurrency] Standardize sending of non-isolated -> nonisolated to match the keyword 'nonisolated'.
2 parents 2c3aa5d + 474aa47 commit a4eb43e

32 files changed

+236
-236
lines changed

include/swift/AST/DiagnosticsSIL.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -691,14 +691,14 @@ WARNING(warning_int_to_fp_inexact, none,
691691

692692
// Flow-isolation diagnostics
693693
ERROR(isolated_after_nonisolated, none,
694-
"cannot access %1 %2 here in %select{non-isolated initializer|deinitializer}0",
694+
"cannot access %1 %2 here in %select{nonisolated initializer|deinitializer}0",
695695
(bool, DescriptiveDeclKind, DeclName))
696696
NOTE(nonisolated_blame, none, "after %1%2 %3, "
697-
"only non-isolated properties of 'self' can be accessed from "
697+
"only nonisolated properties of 'self' can be accessed from "
698698
"%select{this init|a deinit}0", (bool, StringRef, StringRef, DeclName))
699699
ERROR(isolated_property_mutation_in_nonisolated_context,none,
700700
"actor-isolated %kind0 can not be %select{referenced|mutated}1 "
701-
"from a non-isolated context",
701+
"from a nonisolated context",
702702
(const ValueDecl *, bool))
703703

704704
// Yield usage errors

include/swift/AST/DiagnosticsSema.def

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5472,16 +5472,16 @@ ERROR(actor_isolated_non_self_reference,none,
54725472
"%4 %kind0 can not be "
54735473
"%select{referenced|mutated|used 'inout'}1 "
54745474
"%select{from outside the actor|on a different actor instance|"
5475-
"on a non-isolated actor instance|"
5475+
"on a nonisolated actor instance|"
54765476
"from a Sendable function|from a Sendable closure|"
54775477
"from an 'async let' initializer|from global actor %3|"
5478-
"from the main actor|from a non-isolated context|"
5479-
"from a non-isolated autoclosure}2",
5478+
"from the main actor|from a nonisolated context|"
5479+
"from a nonisolated autoclosure}2",
54805480
(const ValueDecl *, unsigned, unsigned, Type,
54815481
ActorIsolation))
54825482
ERROR(distributed_actor_isolated_non_self_reference,none,
54835483
"distributed actor-isolated %kind0 can not be accessed from a "
5484-
"non-isolated context",
5484+
"nonisolated context",
54855485
(const ValueDecl *))
54865486
ERROR(conflicting_stored_property_isolation,none,
54875487
"%select{default|memberwise}0 initializer for %1 cannot be both %2 and %3",
@@ -5622,7 +5622,7 @@ ERROR(shared_mutable_state_access,none,
56225622
"reference to %kind0 is not concurrency-safe because it involves shared "
56235623
"mutable state", (const ValueDecl *))
56245624
ERROR(shared_mutable_state_decl,none,
5625-
"%kind0 is not concurrency-safe because it is non-isolated global shared "
5625+
"%kind0 is not concurrency-safe because it is nonisolated global shared "
56265626
"mutable state", (const ValueDecl *))
56275627
ERROR(shared_immutable_state_decl,none,
56285628
"%kind1 is not concurrency-safe because non-'Sendable' type %0 may have "
@@ -5682,7 +5682,7 @@ NOTE(in_derived_witness, none,
56825682
(DescriptiveDeclKind, DeclName, Type))
56835683
ERROR(non_sendable_param_type,none,
56845684
"non-sendable type %0 %select{passed in call to %3 %kind2|"
5685-
"exiting %3 context in call to non-isolated %kind2|"
5685+
"exiting %3 context in call to nonisolated %kind2|"
56865686
"passed in implicitly asynchronous call to %3 %kind2|"
56875687
"in parameter of the protocol requirement satisfied by %3 %kind2|"
56885688
"in parameter of superclass method overridden by %3 %kind2|"
@@ -5694,7 +5694,7 @@ ERROR(non_sendable_call_argument,none,
56945694
(Type, bool, ActorIsolation))
56955695
ERROR(non_sendable_result_type,none,
56965696
"non-sendable type %0 returned by %select{call to %3 %kind2|"
5697-
"call from %4 context to non-isolated %kind2|"
5697+
"call from %4 context to nonisolated %kind2|"
56985698
"implicitly asynchronous call to %3 %kind2|"
56995699
"%3 %kind2 satisfying protocol requirement|"
57005700
"%3 overriding %kind2|"
@@ -5707,7 +5707,7 @@ ERROR(non_sendable_call_result_type,none,
57075707
ERROR(non_sendable_property_type,none,
57085708
"non-sendable type %0 in %select{"
57095709
"%select{asynchronous access to %4 %kind1|"
5710-
"asynchronous access from %4 context to non-isolated %kind1|"
5710+
"asynchronous access from %4 context to nonisolated %kind1|"
57115711
"implicitly asynchronous access to %4 %kind1|"
57125712
"conformance of %4 %kind1 to protocol requirement|"
57135713
"%4 overriding %kind1|"
@@ -5810,7 +5810,7 @@ ERROR(nonisolated_wrapped_property,none,
58105810
())
58115811

58125812
ERROR(non_sendable_from_deinit,none,
5813-
"cannot access %1 %2 with a non-sendable type %0 from non-isolated deinit",
5813+
"cannot access %1 %2 with a non-sendable type %0 from nonisolated deinit",
58145814
(Type, DescriptiveDeclKind, DeclName))
58155815

58165816
ERROR(actor_instance_property_wrapper,none,

test/ClangImporter/objc_isolation_complete.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func unsatisfiedPreconcurrencyIsolation(view: MyView) {
1212
// expected-warning@+1 {{call to main actor-isolated instance method 'display()' in a synchronous nonisolated context}}
1313
view.display()
1414

15-
// expected-warning@+1 {{main actor-isolated property 'isVisible' can not be referenced from a non-isolated context}}
15+
// expected-warning@+1 {{main actor-isolated property 'isVisible' can not be referenced from a nonisolated context}}
1616
_ = view.isVisible
1717
}
1818

@@ -21,7 +21,7 @@ class IsolatedSub: NXSender {
2121
var mainActorState = 0 // expected-note {{property declared here}}
2222
override func sendAny(_: any Sendable) -> any Sendable {
2323
return mainActorState
24-
// expected-warning@-1 {{main actor-isolated property 'mainActorState' can not be referenced from a non-isolated context}}
24+
// expected-warning@-1 {{main actor-isolated property 'mainActorState' can not be referenced from a nonisolated context}}
2525
}
2626

2727
@MainActor

test/Concurrency/actor_call_implicitly_async.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ func anotherAsyncFunc() async {
232232

233233
_ = b.balance // expected-error {{actor-isolated instance method 'balance()' can not be partially applied}}
234234

235-
a.owner = "cat" // expected-error{{actor-isolated property 'owner' can not be mutated from a non-isolated context}}
235+
a.owner = "cat" // expected-error{{actor-isolated property 'owner' can not be mutated from a nonisolated context}}
236236
// expected-error@+1{{expression is 'async' but is not marked with 'await'}} {{7-7=await }} expected-note@+1{{property access is 'async'}}
237237
_ = b.owner
238238
_ = await b.owner == "cat"
@@ -454,7 +454,7 @@ func tryEffPropsFromSync() {
454454
_ = effPropA // expected-error{{'async' property access in a function that does not support concurrency}}
455455

456456
// expected-error@+1 {{property access can throw, but it is not marked with 'try' and the error is not handled}}
457-
_ = effPropT // expected-error{{global actor 'BananaActor'-isolated var 'effPropT' can not be referenced from a non-isolated context}}
457+
_ = effPropT // expected-error{{global actor 'BananaActor'-isolated var 'effPropT' can not be referenced from a nonisolated context}}
458458
// NOTE: that we don't complain about async access on `effPropT` because it's not declared async, and we're not in an async context!
459459

460460
// expected-error@+1 {{property access can throw, but it is not marked with 'try' and the error is not handled}}

test/Concurrency/actor_defer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,15 +91,15 @@ actor Actor {
9191
#if NEGATIVES
9292
nonisolated func testActor_negative() {
9393
defer {
94-
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
94+
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a nonisolated context}}
9595
actorProperty += 1
9696
}
9797
doSomething()
9898
}
9999

100100
nonisolated func testActor_task_negative() {
101101
Task {
102-
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
102+
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a nonisolated context}}
103103
defer { actorProperty += 1 }
104104
doSomething()
105105
}
@@ -168,7 +168,7 @@ func testIsolatedActor_positive(actor: isolated Actor) {
168168
@available(SwiftStdlib 5.1, *)
169169
func testIsolatedActor_negative(actor: Actor) {
170170
defer {
171-
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
171+
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a nonisolated context}}
172172
actor.actorProperty += 1
173173
}
174174
doSomething()
@@ -213,7 +213,7 @@ func testIsolatedActor_closure_positive() {
213213
@available(SwiftStdlib 5.1, *)
214214
func testIsolatedActor_closure_negative() {
215215
takeClosureWithNotIsolatedParam { actor in
216-
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a non-isolated context}}
216+
// expected-error @+1 {{actor-isolated property 'actorProperty' can not be mutated from a nonisolated context}}
217217
defer { actor.actorProperty += 1 }
218218
doSomething()
219219
}

test/Concurrency/actor_existentials.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,13 @@ func from_isolated_existential2(_ x: isolated any P) async {
3030

3131
func from_nonisolated(_ x: any P) async {
3232
await x.f()
33-
x.prop += 1 // expected-error {{actor-isolated property 'prop' can not be mutated from a non-isolated context}}
34-
x.prop = 100 // expected-error {{actor-isolated property 'prop' can not be mutated from a non-isolated context}}
33+
x.prop += 1 // expected-error {{actor-isolated property 'prop' can not be mutated from a nonisolated context}}
34+
x.prop = 100 // expected-error {{actor-isolated property 'prop' can not be mutated from a nonisolated context}}
3535
}
3636

3737
func from_concrete(_ x: A) async {
38-
x.prop += 1 // expected-error {{actor-isolated property 'prop' can not be mutated from a non-isolated context}}
39-
x.prop = 100 // expected-error {{actor-isolated property 'prop' can not be mutated from a non-isolated context}}
38+
x.prop += 1 // expected-error {{actor-isolated property 'prop' can not be mutated from a nonisolated context}}
39+
x.prop = 100 // expected-error {{actor-isolated property 'prop' can not be mutated from a nonisolated context}}
4040
}
4141

4242
func from_isolated_concrete(_ x: isolated A) async {
@@ -53,7 +53,7 @@ nonisolated let act = Act()
5353

5454
func bad() async {
5555
// expected-warning@+2 {{no 'async' operations occur within 'await' expression}}
56-
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a non-isolated context}}
56+
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a nonisolated context}}
5757
await act.i = 666
5858
}
5959

@@ -64,11 +64,11 @@ extension Act: Proto {}
6464

6565
func good() async {
6666
// expected-warning@+2 {{no 'async' operations occur within 'await' expression}}
67-
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a non-isolated context}}
67+
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a nonisolated context}}
6868
await (act as any Proto).i = 42
6969
let aIndirect: any Proto = act
7070

7171
// expected-warning@+2 {{no 'async' operations occur within 'await' expression}}
72-
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a non-isolated context}}
72+
// expected-error@+1 {{actor-isolated property 'i' can not be mutated from a nonisolated context}}
7373
await aIndirect.i = 777
7474
}

test/Concurrency/actor_inout_isolation.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ extension TestActor {
119119
func passStateIntoDifferentClassMethod() async {
120120
let other = NonAsyncClass()
121121
let otherCurry = other.modifyOtherAsync
122-
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' exiting actor-isolated context in call to non-isolated instance method 'modifyOtherAsync' cannot cross actor boundary}}
122+
// expected-targeted-complete-tns-warning @-1 {{non-sendable type 'NonAsyncClass' exiting actor-isolated context in call to nonisolated instance method 'modifyOtherAsync' cannot cross actor boundary}}
123123
await other.modifyOtherAsync(&value2)
124124
// expected-error @-1 {{actor-isolated property 'value2' cannot be passed 'inout' to 'async' function call}}
125125

@@ -194,7 +194,7 @@ actor MyActor {
194194

195195
// expected-error@+1{{cannot pass immutable value of type 'Int' as inout argument}}
196196
await modifyAsynchronously(&(maybePoint?.z)!)
197-
// expected-error@+2{{actor-isolated property 'position' can not be used 'inout' on a non-isolated actor instance}}
197+
// expected-error@+2{{actor-isolated property 'position' can not be used 'inout' on a nonisolated actor instance}}
198198
// expected-error@+1{{actor-isolated property 'myActor' cannot be passed 'inout' to 'async' function call}}
199199
await modifyAsynchronously(&myActor.position.x)
200200
}
@@ -219,8 +219,8 @@ struct MyGlobalActor {
219219
if #available(SwiftStdlib 5.1, *) {
220220
let _ = Task.detached { await { (_ foo: inout Int) async in foo += 1 }(&number) }
221221
// expected-error @-1 {{actor-isolated var 'number' cannot be passed 'inout' to 'async' function call}}
222-
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a non-isolated context}}
223-
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a non-isolated context}}
222+
// expected-minimal-error @-2 {{global actor 'MyGlobalActor'-isolated var 'number' can not be used 'inout' from a nonisolated context}}
223+
// expected-complete-tns-error @-3 {{main actor-isolated var 'number' can not be used 'inout' from a nonisolated context}}
224224
}
225225

226226
// attempt to pass global state owned by the global actor to another async function
@@ -288,11 +288,11 @@ actor ProtectArray {
288288
func test() async {
289289
// FIXME: this is invalid too!
290290
_ = await array.mutateAsynchronously
291-
// expected-targeted-complete-tns-warning@-1 {{non-sendable type '@lvalue [Int]' exiting actor-isolated context in call to non-isolated property 'mutateAsynchronously' cannot cross actor boundary}}
291+
// expected-targeted-complete-tns-warning@-1 {{non-sendable type '@lvalue [Int]' exiting actor-isolated context in call to nonisolated property 'mutateAsynchronously' cannot cross actor boundary}}
292292

293293
_ = await array[mutateAsynchronously: 0]
294294
// expected-error@-1 {{actor-isolated property 'array' cannot be passed 'inout' to 'async' function call}}
295-
// expected-targeted-complete-tns-warning@-2 {{non-sendable type 'inout Array<Int>' exiting actor-isolated context in call to non-isolated subscript 'subscript(mutateAsynchronously:)' cannot cross actor boundary}}
295+
// expected-targeted-complete-tns-warning@-2 {{non-sendable type 'inout Array<Int>' exiting actor-isolated context in call to nonisolated subscript 'subscript(mutateAsynchronously:)' cannot cross actor boundary}}
296296

297297
await passToAsync(array[0])
298298

0 commit comments

Comments
 (0)