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
Copy file name to clipboardExpand all lines: test/Concurrency/actor_isolation.swift
+2-2
Original file line number
Diff line number
Diff line change
@@ -1514,7 +1514,7 @@ class SGA_MA: MA, SGA_Proto {
1514
1514
// expected-note@-2{{turn data races into runtime errors with '@preconcurrency'}}
1515
1515
1516
1516
// expected-error@+2 {{call to global actor 'SomeGlobalActor'-isolated global function 'onions_sga()' in a synchronous main actor-isolated context}}
1517
-
// expected-note@+1 {{main actor-isolated instance method 'method()' cannot be used to satisfy global actor 'SomeGlobalActor'-isolated requirement from protocol 'SGA_Proto'}}
1517
+
// expected-note@+1 {{main actor-isolated instance method 'method()' cannot satisfy global actor 'SomeGlobalActor'-isolated requirement}}
// expected-note@-1{{turn data races into runtime errors with '@preconcurrency'}}
44
44
45
45
@SomeGlobalActorfunc onMainActor(){}
46
-
// expected-note @-1 {{global actor 'SomeGlobalActor'-isolated instance method 'onMainActor()' cannot be used to satisfy main actor-isolated requirement from protocol 'P1'}}
46
+
// expected-note @-1 {{global actor 'SomeGlobalActor'-isolated instance method 'onMainActor()' cannot satisfy main actor-isolated requirement}}
47
47
}
48
48
49
49
// expected-warning@+2{{conformance of 'S4_P1' to protocol 'P1' involves isolation mismatches and can cause data races}}
50
50
@SomeGlobalActor
51
51
structS4_P1:P1{
52
52
// expected-note@-1{{turn data races into runtime errors with '@preconcurrency'}}
53
53
54
-
@SomeGlobalActorfunc onMainActor(){} // expected-note{{global actor 'SomeGlobalActor'-isolated instance method 'onMainActor()' cannot be used to satisfy main actor-isolated requirement from protocol 'P1'}}
54
+
@SomeGlobalActorfunc onMainActor(){} // expected-note{{global actor 'SomeGlobalActor'-isolated instance method 'onMainActor()' cannot satisfy main actor-isolated requirement}}
55
55
}
56
56
57
57
// expected-warning@+1 {{'(unsafe)' global actors are deprecated; use '@preconcurrency' instead}}
// expected-note@-1{{global actor 'SomeGlobalActor'-isolated instance method 'f()' cannot be used to satisfy main actor-isolated requirement from protocol 'InferMainActorInherited'}}
183
+
// expected-note@-1{{global actor 'SomeGlobalActor'-isolated instance method 'f()' cannot satisfy main actor-isolated requirement}}
184
184
}
185
185
186
186
@MainActor
@@ -211,7 +211,7 @@ class C2: MainActorSuperclass, InferenceConflictWithSuperclass {
211
211
func f(){}
212
212
213
213
func g(){}
214
-
// expected-note@-1 {{main actor-isolated instance method 'g()' cannot be used to satisfy nonisolated requirement from protocol 'InferenceConflictWithSuperclass'}}
@@ -108,8 +108,8 @@ struct PSendableMetaWrapper<T: P & SendableMetatype>: P {
108
108
@MainActor
109
109
func testIsolationConformancesInTypes(){
110
110
typealiasA1=PWrapper<C>
111
-
typealiasA2=PSendableWrapper<C> // expected-error{{isolated conformance of 'C' to 'P' cannot be used to satisfy conformance requirement for a `Sendable` type parameter 'T'}}
112
-
typealiasA3=PSendableMetaWrapper<C> // expected-error{{isolated conformance of 'C' to 'P' cannot be used to satisfy conformance requirement for a `SendableMetatype` type parameter 'T'}}
111
+
typealiasA2=PSendableWrapper<C> // expected-error{{isolated conformance of 'C' to 'P' cannot satisfy conformance requirement for a `Sendable` type parameter 'T'}}
112
+
typealiasA3=PSendableMetaWrapper<C> // expected-error{{isolated conformance of 'C' to 'P' cannot satisfy conformance requirement for a `SendableMetatype` type parameter 'T'}}
acceptSendableP(c) // expected-error{{main actor-isolated conformance of 'C' to 'P' cannot be used to satisfy conformance requirement for a `Sendable` type parameter}}
128
-
acceptSendableMetaP(c) // expected-error{{isolated conformance of 'C' to 'P' cannot be used to satisfy conformance requirement for a `Sendable` type parameter}}
127
+
acceptSendableP(c) // expected-error{{main actor-isolated conformance of 'C' to 'P' cannot satisfy conformance requirement for a `Sendable` type parameter}}
128
+
acceptSendableMetaP(c) // expected-error{{isolated conformance of 'C' to 'P' cannot satisfy conformance requirement for a `Sendable` type parameter}}
acceptSendableMetaP(a) // expected-error{{main actor-isolated conformance of 'SomeActor' to 'P' cannot be used to satisfy conformance requirement for a `Sendable` type parameter}}
134
+
acceptSendableMetaP(a) // expected-error{{main actor-isolated conformance of 'SomeActor' to 'P' cannot satisfy conformance requirement for a `Sendable` type parameter}}
acceptSendableMetaP(c) // expected-error{{global actor 'SomeGlobalActor'-isolated conformance of 'CMismatchedIsolation' to 'P' cannot be used to satisfy conformance requirement for a `Sendable` type parameter}}
140
+
acceptSendableMetaP(c) // expected-error{{global actor 'SomeGlobalActor'-isolated conformance of 'CMismatchedIsolation' to 'P' cannot satisfy conformance requirement for a `Sendable` type parameter}}
// expected-note@-1 {{main actor-isolated property 'b' cannot be used to satisfy global actor 'GlobalActor'-isolated requirement from protocol 'WithIndividuallyIsolatedRequirements'}}
146
+
// expected-note@-1 {{main actor-isolated property 'b' cannot satisfy global actor 'GlobalActor'-isolated requirement}}
147
147
get{0}
148
148
set{}
149
149
}
150
150
151
151
@MainActorfunc test(){
152
-
// expected-note@-1 {{main actor-isolated instance method 'test()' cannot be used to satisfy global actor 'GlobalActor'-isolated requirement from protocol 'WithIndividuallyIsolatedRequirements'}}
152
+
// expected-note@-1 {{main actor-isolated instance method 'test()' cannot satisfy global actor 'GlobalActor'-isolated requirement}}
153
153
}
154
154
}
155
155
}
@@ -166,10 +166,10 @@ do {
166
166
// expected-warning@-1 {{@preconcurrency attribute on conformance to 'WithNonIsolated' has no effect}}{{38-54=}}
167
167
168
168
@GlobalActorvarprop:Int=42
169
-
// expected-note@-1 {{global actor 'GlobalActor'-isolated property 'prop' cannot be used to satisfy main actor-isolated requirement from protocol 'WithNonIsolated'}}
169
+
// expected-note@-1 {{global actor 'GlobalActor'-isolated property 'prop' cannot satisfy main actor-isolated requirement}}
170
170
171
171
@MainActorfunc test(){}
172
-
// expected-note@-1 {{main actor-isolated instance method 'test()' cannot be used to satisfy nonisolated requirement from protocol 'WithNonIsolated'}}
// expected-warning@+1{{conformance of 'S5' to protocol 'P2' crosses into main actor-isolated code and can cause data races; this is an error in the Swift 6 language mode}}
243
243
@MainActorstructS5:P2,@preconcurrencyP3{
244
244
// expected-warning@-1:21 {{@preconcurrency attribute on conformance to 'P3' has no effect}}
245
245
// expected-note@-2:25 {{turn data races into runtime errors with '@preconcurrency'}}
246
246
// expected-note@-3{{mark all declarations used in the conformance 'nonisolated'}}
247
247
func foo(){}
248
-
// expected-note@-1 {{main actor-isolated instance method 'foo()' cannot be used to satisfy nonisolated requirement from protocol 'P2'}}
// expected-complete-tns-note@-2{{turn data races into runtime errors with '@preconcurrency'}}{{36-36=@preconcurrency }}
236
236
// expected-complete-tns-note@-3{{mark all declarations used in the conformance 'nonisolated'}}
237
237
func requirement(){}
238
-
// expected-complete-tns-note@-1 {{main actor-isolated instance method 'requirement()' cannot be used to satisfy nonisolated requirement from protocol 'NotIsolated'}}
// expected-note@-1{{turn data races into runtime errors with '@preconcurrency'}}
121
121
distributedfunc local(){}
122
-
// expected-note@-1{{actor-isolated distributed instance method 'local()' cannot be used to satisfy nonisolated requirement from protocol 'StrictlyLocal'}}
// expected-note@-1{{actor-isolated distributed instance method 'localThrows()' cannot be used to satisfy nonisolated requirement from protocol 'StrictlyLocal'}}
// expected-note@-1{{actor-isolated distributed instance method 'localAsync()' cannot be used to satisfy nonisolated requirement from protocol 'StrictlyLocal'}}
@@ -207,7 +207,7 @@ distributed actor DA_TerminationWatchingA: TerminationWatchingA {
207
207
// expected-note@-2{{mark all declarations used in the conformance 'nonisolated'}}
208
208
209
209
func terminated(a:String){}
210
-
// expected-note@-1{{actor-isolated instance method 'terminated(a:)' cannot be used to satisfy nonisolated requirement from protocol 'TerminationWatchingA'}}
// expected-note@-1{{actor-isolated instance method 'syncMethodF(param:)' cannot be used to satisfy nonisolated requirement from protocol 'SyncProtocol'}}
0 commit comments