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
@@ -24,67 +24,6 @@ struct Test2: TestProtocol { // expected-warning{{conformance of 'C2' to 'Sendab
24
24
typealiasValue=C2
25
25
}
26
26
27
-
@globalActor
28
-
actorTestGlobalActor{
29
-
staticvarshared=TestGlobalActor()
30
-
}
31
-
32
-
@TestGlobalActor
33
-
varmutableIsolatedGlobal=1
34
-
35
-
varmutableNonisolatedGlobal=1 // expected-warning{{var 'mutableNonisolatedGlobal' is not concurrency-safe because it is non-isolated global shared mutable state}}
36
-
// expected-note@-1{{isolate 'mutableNonisolatedGlobal' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
staticletimmutableNonsendable=TestNonsendable() // expected-warning{{static property 'immutableNonsendable' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor}}
staticnonisolatedletimmutableNonisolated=TestNonsendable() // expected-warning{{static property 'immutableNonisolated' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor}}
63
-
staticletimmutableInferredSendable=0
64
-
staticvarmutable=0 // expected-warning{{static property 'mutable' is not concurrency-safe because it is non-isolated global shared mutable state}}
65
-
// expected-note@-1{{isolate 'mutable' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
staticvarcomputedProperty:Int{0} // computed property that, though static, has no storage so is not a global
68
-
@TestWrapperstaticvarwrapped:Int // expected-warning{{static property 'wrapped' is not concurrency-safe because it is non-isolated global shared mutable state}}
69
-
// expected-note@-1{{isolate 'wrapped' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
70
-
}
71
-
72
-
@TestGlobalActor
73
-
func f(){
74
-
print(TestStatics.immutableExplicitSendable)
75
-
print(TestStatics.immutableInferredSendable)
76
-
print(TestStatics.mutable) // expected-warning{{reference to static property 'mutable' is not concurrency-safe because it involves shared mutable state}}
varmutableNonisolatedGlobal=1 // expected-error{{var 'mutableNonisolatedGlobal' is not concurrency-safe because it is non-isolated global shared mutable state}}
19
+
// expected-note@-1{{isolate 'mutableNonisolatedGlobal' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
staticletimmutableNonsendable=TestNonsendable() // expected-error{{static property 'immutableNonsendable' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor}}
staticnonisolatedletimmutableNonisolated=TestNonsendable() // expected-error{{static property 'immutableNonisolated' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor}}
46
+
staticletimmutableInferredSendable=0
47
+
staticvarmutable=0 // expected-error{{static property 'mutable' is not concurrency-safe because it is non-isolated global shared mutable state}}
48
+
// expected-note@-1{{isolate 'mutable' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
staticvarcomputedProperty:Int{0} // computed property that, though static, has no storage so is not a global
51
+
@TestWrapperstaticvarwrapped:Int // expected-error{{static property 'wrapped' is not concurrency-safe because it is non-isolated global shared mutable state}}
52
+
// expected-note@-1{{isolate 'wrapped' to a global actor, or convert it to a 'let' constant and conform it to 'Sendable'}}
53
+
}
54
+
55
+
@TestGlobalActor
56
+
func f(){
57
+
print(TestStatics.immutableExplicitSendable)
58
+
print(TestStatics.immutableInferredSendable)
59
+
print(TestStatics.mutable) // expected-error{{reference to static property 'mutable' is not concurrency-safe because it involves shared mutable state}}
60
+
print(Globals.actorInteger) // expected-error{{main actor-isolated static property 'actorInteger' can not be referenced from global actor 'TestGlobalActor'}}
61
+
}
62
+
63
+
func testLocalNonisolatedUnsafe()async{
64
+
nonisolated(unsafe)varvalue=1
65
+
lettask=Task{
66
+
value =2
67
+
return value
68
+
}
69
+
print(await task.value)
70
+
}
71
+
72
+
func testImportedGlobals(){ // expected-note{{add '@MainActor' to make global function 'testImportedGlobals()' part of global actor 'MainActor'}}
73
+
let _ =Globals.integerConstant
74
+
let _ =Globals.integerMutable // expected-warning{{reference to static property 'integerMutable' is not concurrency-safe because it involves shared mutable state}}
75
+
let _ =Globals.nonisolatedUnsafeIntegerConstant
76
+
let _ =Globals.nonisolatedUnsafeIntegerMutable
77
+
let _ =Globals.actorInteger // expected-error{{main actor-isolated static property 'actorInteger' can not be referenced from a non-isolated context}}
0 commit comments