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
@OtherGlobalActorfunc onOtherGlobalActor()->Int{5} // expected-note{{calls to global function 'onOtherGlobalActor()' from outside of its actor context are implicitly asynchronous}}
30
+
@OtherGlobalActor(unsafe)func onOtherGlobalActorUnsafe()->Int{5} // expected-note 2{{calls to global function 'onOtherGlobalActorUnsafe()' from outside of its actor context are implicitly asynchronous}}
// Global actors on synchronous closures become part of the type
34
38
letcl1={@SomeGlobalActorin
35
39
onSomeGlobalActor()
@@ -47,6 +51,7 @@ func testClosures() {
47
51
onSomeGlobalActor()
48
52
}
49
53
54
+
// Infer from context
50
55
acceptOnSomeGlobalActor{
51
56
onSomeGlobalActor()
52
57
}
@@ -55,4 +60,36 @@ func testClosures() {
55
60
leti=onSomeGlobalActor()
56
61
return i
57
62
}
63
+
64
+
acceptOnSomeGlobalActor{()->Intin
65
+
leti=onOtherGlobalActorUnsafe() // expected-error{{global function 'onOtherGlobalActorUnsafe()' isolated to global actor 'OtherGlobalActor' can not be referenced from different global actor 'SomeGlobalActor' in a synchronous context}}
66
+
return i
67
+
}
68
+
}
69
+
70
+
func testClosuresOld(){
71
+
acceptOnSomeGlobalActor{()->Intin
72
+
leti=onSomeGlobalActor()
73
+
return i
74
+
}
75
+
76
+
acceptOnSomeGlobalActor{()->Intin
77
+
leti=onSomeGlobalActorUnsafe()
78
+
return i
79
+
}
80
+
81
+
acceptOnSomeGlobalActor{()->Intin
82
+
leti=onOtherGlobalActor() // expected-error{{global function 'onOtherGlobalActor()' isolated to global actor 'OtherGlobalActor' can not be referenced from different global actor 'SomeGlobalActor' in a synchronous context}}
83
+
return i
84
+
}
85
+
86
+
acceptOnSomeGlobalActor{()->Intin
87
+
leti=onOtherGlobalActorUnsafe()
88
+
return i
89
+
}
90
+
91
+
acceptOnSomeGlobalActor{@SomeGlobalActor()->Intin
92
+
leti=onOtherGlobalActorUnsafe() // expected-error{{global function 'onOtherGlobalActorUnsafe()' isolated to global actor 'OtherGlobalActor' can not be referenced from different global actor 'SomeGlobalActor' in a synchronous context}}
0 commit comments