Skip to content

Commit 308fb5e

Browse files
authored
Merge pull request swiftlang#36348 from DougGregor/more-non-isolated
2 parents f6c0305 + 30bfe4d commit 308fb5e

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4287,8 +4287,8 @@ ERROR(actor_isolated_non_self_reference,none,
42874287
"%select{from inside the actor|on 'self'}2",
42884288
(DescriptiveDeclKind, DeclName, bool, unsigned))
42894289
ERROR(actor_isolated_self_independent_context,none,
4290-
"actor-isolated %0 %1 can not be %select{referenced|mutated|used 'inout'}2 from an "
4291-
"'@actorIndependent' context",
4290+
"actor-isolated %0 %1 can not be %select{referenced|mutated|used 'inout'}2 from a "
4291+
"non-isolated context",
42924292
(DescriptiveDeclKind, DeclName, unsigned))
42934293
ERROR(actor_isolated_inout_state,none,
42944294
"actor-isolated %0 %1 cannot be passed 'inout' to"
@@ -4311,7 +4311,7 @@ ERROR(global_actor_from_other_global_actor_context,none,
43114311
(DescriptiveDeclKind, DeclName, Type, Type, unsigned, bool))
43124312
ERROR(global_actor_from_nonactor_context,none,
43134313
"%0 %1 isolated to global actor %2 can not be %select{referenced|mutated|used 'inout'}4"
4314-
" from %select{this|an '@actorIndependent'}3%select{| synchronous}5 context",
4314+
" from %select{this|a non-isolated}3%select{| synchronous}5 context",
43154315
(DescriptiveDeclKind, DeclName, Type, bool, unsigned, bool))
43164316
ERROR(actor_isolated_partial_apply,none,
43174317
"actor-isolated %0 %1 can not be partially applied",

test/ClangImporter/objc_async.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ actor MySubclassCheckingSwiftAttributes : ProtocolWithSwiftAttributes {
8080
func syncMethod() { } // expected-note {{calls to instance method 'syncMethod()' from outside of its actor context are implicitly asynchronous}}
8181

8282
func independentMethod() {
83-
syncMethod() // expected-error{{ctor-isolated instance method 'syncMethod()' can not be referenced from an '@actorIndependent' context}}
83+
syncMethod() // expected-error{{ctor-isolated instance method 'syncMethod()' can not be referenced from a non-isolated context}}
8484
}
8585

8686
func asyncHandlerMethod() {

test/Concurrency/actor_isolation.swift

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@ extension MyActor {
101101

102102
nonisolated func actorIndependentFunc(otherActor: MyActor) -> Int {
103103
_ = immutable
104-
_ = mutable // expected-error{{actor-isolated property 'mutable' can not be referenced from an '@actorIndependent'}}
105-
_ = text[0] // expected-error{{actor-isolated property 'text' can not be referenced from an '@actorIndependent' context}}
106-
_ = synchronous() // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
104+
_ = mutable // expected-error{{actor-isolated property 'mutable' can not be referenced from a non-isolated}}
105+
_ = text[0] // expected-error{{actor-isolated property 'text' can not be referenced from a non-isolated context}}
106+
_ = synchronous() // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
107107

108108
// @actorIndependent
109109
_ = actorIndependentFunc(otherActor: self)
@@ -120,24 +120,24 @@ extension MyActor {
120120
otherActor.actorIndependentVar = 17
121121

122122
// async promotion
123-
_ = synchronous() // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
123+
_ = synchronous() // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
124124

125125
// Global actors
126-
syncGlobalActorFunc() /// expected-error{{global function 'syncGlobalActorFunc()' isolated to global actor 'SomeGlobalActor' can not be referenced from an '@actorIndependent' synchronous context}}
127-
_ = syncGlobalActorFunc // expected-error{{global function 'syncGlobalActorFunc()' isolated to global actor 'SomeGlobalActor' can not be referenced from an '@actorIndependent' context}}
126+
syncGlobalActorFunc() /// expected-error{{global function 'syncGlobalActorFunc()' isolated to global actor 'SomeGlobalActor' can not be referenced from a non-isolated synchronous context}}
127+
_ = syncGlobalActorFunc // expected-error{{global function 'syncGlobalActorFunc()' isolated to global actor 'SomeGlobalActor' can not be referenced from a non-isolated context}}
128128

129129
// Global data is okay if it is immutable.
130130
_ = immutableGlobal
131131
_ = mutableGlobal // expected-warning{{reference to var 'mutableGlobal' is not concurrency-safe because it involves shared mutable state}}
132132

133133
// Partial application
134-
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
135-
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be referenced from an '@actorIndependent' context}}
136-
acceptClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
137-
acceptClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}
134+
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
135+
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be referenced from a non-isolated context}}
136+
acceptClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
137+
acceptClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}
138138
acceptClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
139-
acceptEscapingClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent' context}}}}
140-
acceptEscapingClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from an '@actorIndependent'}}
139+
acceptEscapingClosure(synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated context}}}}
140+
acceptEscapingClosure(self.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can not be referenced from a non-isolated}}
141141
acceptEscapingClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
142142

143143
return 5
@@ -281,7 +281,7 @@ extension MyActor {
281281

282282
// Partial application
283283
_ = synchronous // expected-error{{actor-isolated instance method 'synchronous()' can not be partially applied}}
284-
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be referenced from an '@actorIndependent' context}}
284+
_ = super.superMethod // expected-error{{actor-isolated instance method 'superMethod()' can not be referenced from a non-isolated context}}
285285
acceptClosure(synchronous)
286286
acceptClosure(self.synchronous)
287287
acceptClosure(otherActor.synchronous) // expected-error{{actor-isolated instance method 'synchronous()' can only be referenced on 'self'}}
@@ -585,7 +585,7 @@ actor LazyActor {
585585
lazy var l12: Int = v
586586
lazy var l13: Int = { self.v }()
587587
lazy var l14: Int = self.v
588-
lazy var l15: Int = { [unowned self] in self.v }() // expected-error{{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
588+
lazy var l15: Int = { [unowned self] in self.v }() // expected-error{{actor-isolated property 'v' can not be referenced from a non-isolated context}}
589589

590590
lazy var l21: Int = { l }()
591591
lazy var l22: Int = l
@@ -594,15 +594,15 @@ actor LazyActor {
594594
lazy var l25: Int = { [unowned self] in self.l }()
595595

596596
nonisolated lazy var l31: Int = { v }()
597-
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
597+
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from a non-isolated context}}
598598
nonisolated lazy var l32: Int = v
599-
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
599+
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from a non-isolated context}}
600600
nonisolated lazy var l33: Int = { self.v }()
601-
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
601+
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from a non-isolated context}}
602602
nonisolated lazy var l34: Int = self.v
603-
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
603+
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from a non-isolated context}}
604604
nonisolated lazy var l35: Int = { [unowned self] in self.v }()
605-
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from an '@actorIndependent' context}}
605+
// expected-error@-1 {{actor-isolated property 'v' can not be referenced from a non-isolated context}}
606606

607607
nonisolated lazy var l41: Int = { l }()
608608
nonisolated lazy var l42: Int = l

test/Concurrency/actor_isolation_unsafe.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class C2: C1 {
4747

4848
class C3: C1 {
4949
@actorIndependent override func method() {
50-
globalSome() // expected-error{{global function 'globalSome()' isolated to global actor 'SomeGlobalActor' can not be referenced from an '@actorIndependent' synchronous context}}
50+
globalSome() // expected-error{{global function 'globalSome()' isolated to global actor 'SomeGlobalActor' can not be referenced from a non-isolated synchronous context}}
5151
}
5252
}
5353

test/attr/actorindependent.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,15 +85,15 @@ actor FromProperty {
8585
// expected-note@+1 2{{property declared here}}
8686
var counter : Int = 0
8787

88-
// expected-error@+2{{actor-isolated property 'counter' can not be referenced from an '@actorIndependent' context}}
88+
// expected-error@+2{{actor-isolated property 'counter' can not be referenced from a non-isolated context}}
8989
@actorIndependent
9090
var halfCounter : Int { counter / 2 }
9191

9292
@actorIndependent
9393
var ticks : Int {
94-
// expected-error@+1{{actor-isolated property 'counter' can not be referenced from an '@actorIndependent' context}}
94+
// expected-error@+1{{actor-isolated property 'counter' can not be referenced from a non-isolated context}}
9595
get { counter }
96-
// expected-error@+1{{actor-isolated property 'counter' can not be mutated from an '@actorIndependent' context}}
96+
// expected-error@+1{{actor-isolated property 'counter' can not be mutated from a non-isolated context}}
9797
set { counter = newValue }
9898
}
9999
}

0 commit comments

Comments
 (0)