File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -75,3 +75,22 @@ actor class A {
7575 // expected-error@+1{{'@actorIndependent' can only be applied to instance members of actors}}
7676 @actorIndependent static func staticFunc( ) { }
7777}
78+
79+ actor class FromProperty {
80+ // expected-note@+3{{mutable state is only available within the actor instance}}
81+ // expected-note@+2{{mutable state is only available within the actor instance}}
82+ // expected-note@+1{{mutable state is only available within the actor instance}}
83+ var counter : Int = 0
84+
85+ // expected-error@+2{{actor-isolated property 'counter' can not be referenced from an '@actorIndependent' context}}
86+ @actorIndependent
87+ var halfCounter : Int { counter / 2 }
88+
89+ @actorIndependent
90+ var ticks : Int {
91+ // expected-error@+1{{actor-isolated property 'counter' can not be referenced from an '@actorIndependent' context}}
92+ get { counter }
93+ // expected-error@+1{{actor-isolated property 'counter' can not be referenced from an '@actorIndependent' context}}
94+ set { counter = newValue }
95+ }
96+ }
You can’t perform that action at this time.
0 commit comments