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/grouped_actor_isolation_diagnostics.swift
+33-9Lines changed: 33 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -7,22 +7,34 @@ protocol P {
7
7
nonisolatedfunc g()
8
8
}
9
9
10
-
structS_P:P{
10
+
structS:P{
11
11
func f(){}
12
12
func g(){}
13
13
}
14
14
15
-
// expected-error@+2{{calls to '@MainActor'-isolated' code in global function 'testP(x:p:)'}}
16
-
// expected-note@+1{{add '@MainActor' to make global function 'testP(x:p:)' part of global actor 'MainActor'}}
17
-
func testP(x:S_P, p:P){
15
+
@preconcurrencystructNonConcurrentS:P{
16
+
func f(){}
17
+
func g(){}
18
+
}
19
+
20
+
// expected-note@+1{{add '@MainActor' to make global function 'testP(s:p:)' part of global actor 'MainActor'}}
21
+
func testP(s:S, p:P){ // expected-error {{calls to '@MainActor'-isolated' code in global function 'testP(s:p:)'}}
22
+
18
23
p.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
19
24
p.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
20
25
p.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
21
26
p.g() // OKAY
22
-
x.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
23
-
x.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
24
-
x.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
25
-
x.g() // OKAY
27
+
s.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
28
+
s.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
29
+
s.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
30
+
s.g() // OKAY
31
+
}
32
+
// expected-note @+1{{add '@MainActor' to make global function 'testPreconcurrencyP(ncs:)' part of global actor 'MainActor'}}
33
+
func testPreconcurrencyP(ncs:NonConcurrentS){ // expected-error {{calls to '@MainActor'-isolated' code in global function 'testPreconcurrencyP(ncs:)'}}
34
+
ncs.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
35
+
ncs.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
36
+
ncs.f() // expected-note{{call to main actor-isolated instance method 'f()' in a synchronous nonisolated context}}
0 commit comments