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
// expected-warning@-1 {{'nonisolated(unsafe)' is unnecessary for a constant actor-isolated property with 'Sendable' type 'TestSendable', consider removing it}} {{3-23=}}
44
+
}
45
+
40
46
structTestStatics{
41
47
staticletimmutableExplicitSendable=TestSendable()
42
48
staticletimmutableNonsendable=TestNonsendable() // expected-error{{static property 'immutableNonsendable' is not concurrency-safe because non-'Sendable' type 'TestNonsendable' may have shared mutable state}}
@@ -45,6 +51,8 @@ struct TestStatics {
45
51
staticnonisolatedletimmutableNonisolated=TestNonsendable() // expected-error{{static property 'immutableNonisolated' is not concurrency-safe because non-'Sendable' type 'TestNonsendable' may have shared mutable state}}
46
52
// expected-note@-1 {{isolate 'immutableNonisolated' to a global actor, or conform 'TestNonsendable' to 'Sendable'}}
47
53
// expected-error@-2 {{'nonisolated' can not be applied to variable with non-'Sendable' type 'TestNonsendable'}}
// expected-warning@-1 {{'(unsafe)' is unnecessary for a constant public actor property with 'Sendable' type 'TestSendable', consider removing it}} {{14-22=}}
68
+
}
69
+
57
70
@TestGlobalActor
58
71
func f(){
59
72
print(TestStatics.immutableExplicitSendable)
@@ -63,6 +76,9 @@ func f() {
63
76
}
64
77
65
78
func testLocalNonisolatedUnsafe()async{
79
+
nonisolated(unsafe)letimmutable=1
80
+
// expected-warning@-1{{'nonisolated(unsafe)' is unnecessary for a constant with 'Sendable' type 'Int', consider removing it}} {{3-23=}}
81
+
// expected-warning@-2{{initialization of immutable value 'immutable' was never used; consider replacing with assignment to '_' or removing it}}
0 commit comments