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
let _:anyP=CExplicitMainActor() // expected-error{{main actor-isolated conformance of 'CExplicitMainActor' to 'P' cannot be used in nonisolated context}}
50
-
let _:anyP=CImplicitMainActor() // expected-error{{main actor-isolated conformance of 'CImplicitMainActor' to 'P' cannot be used in nonisolated context}}
49
+
let _:anyP=CExplicitMainActor() // okay
50
+
let _:anyP=CImplicitMainActor() // okay
51
51
52
52
let _:anyP=CNonIsolated()
53
53
let _:anyP=CImplicitMainActorNonisolatedConformance()
Copy file name to clipboardExpand all lines: test/Concurrency/isolated_conformance_inference.swift
+24-1
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,11 @@ extension CExplicit: Q {
32
32
func g(){}
33
33
}
34
34
35
+
@SomeGlobalActor
36
+
classCViaNonisolatedWitness:P{
37
+
nonisolatedfunc f(){} // okay! conformance above is nonisolated via this witness
38
+
}
39
+
35
40
// expected-error@+3{{conformance of 'CNonIsolated' to protocol 'P' crosses into global actor 'SomeGlobalActor'-isolated code and can cause data races}}
36
41
// expected-note@+2{{turn data races into runtime errors with '@preconcurrency'}}
37
42
// expected-note@+1{{isolate this conformance to the global actor 'SomeGlobalActor' with '@SomeGlobalActor'}}{{33-33=@SomeGlobalActor }}
@@ -42,11 +47,29 @@ nonisolated class CNonIsolated: P {
let _:anyP=CExplicit() // expected-error{{global actor 'SomeGlobalActor'-isolated conformance of 'CExplicit' to 'P' cannot be used in nonisolated context}}
0 commit comments