Skip to content

Commit 0752121

Browse files
committed
add regression tests for SR-13735
1 parent 34d2210 commit 0752121

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/attr/actorindependent.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff 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+
}

0 commit comments

Comments
 (0)