Skip to content

Commit e4076b6

Browse files
committed
adding test of SILGen for async actor prop accesses
1 parent 2d0911c commit e4076b6

File tree

3 files changed

+458
-0
lines changed

3 files changed

+458
-0
lines changed

test/Concurrency/actor_inout_isolation.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ actor TestActor {
2929
var value1: Int = 0
3030
var value2: Int = 1
3131
var points: [Point] = []
32+
33+
subscript(x : inout Int) -> Int { // expected-error {{'inout' must not be used on subscript parameters}}
34+
x += 1
35+
return x
36+
}
3237
}
3338

3439
func modifyAsynchronously(_ foo: inout Int) async { foo += 1 }

test/Concurrency/actor_isolation.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,14 @@ actor MyActor: MySuperActor {
5050

5151
let point : Point = Point()
5252

53+
@MainActor
54+
var name : String = "koala"
55+
56+
// FIXME: if you take the 'async' off of this, you get a very confusing error message.
57+
func accessProp() async -> String {
58+
return await self.name
59+
}
60+
5361
class func synchronousClass() { }
5462
static func synchronousStatic() { }
5563

@@ -60,6 +68,12 @@ actor MyActor: MySuperActor {
6068
}
6169
}
6270

71+
actor Camera {
72+
func accessProp(act : MyActor) async -> String {
73+
return await act.name
74+
}
75+
}
76+
6377
func checkAsyncPropertyAccess() async {
6478
let act = MyActor()
6579
let _ : Int = await act.mutable + act.mutable

0 commit comments

Comments
 (0)