mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Handle generic self types as the isolation parameters.
This PR builds on https://github.com/apple/swift/pull/73129 and fixes https://github.com/apple/swift/issues/73345. Co-authored with @hyp.
This commit is contained in:
@@ -53,3 +53,17 @@ func f(isolation: isolated MyActor, ns: NotSendable) {
|
||||
}
|
||||
|
||||
func test() async {}
|
||||
|
||||
// A generic actor type, which causes the generic self parameter
|
||||
// (actor isolation parameter) to be added to captures of the
|
||||
// local/nested function.
|
||||
actor GenericActor<K> {
|
||||
var i: Int = 0
|
||||
private func outerFunc() {
|
||||
func accessSelf() -> Int {
|
||||
// CHECK-LABEL: sil private [ossa] @$s24local_function_isolation12GenericActorC9outerFunc33_7B9E2B75110B8600A136A469D51CAF2BLLyyF10accessSelfL_SiylF : $@convention(thin) <K> (@sil_isolated @guaranteed GenericActor<K>) -> Int {
|
||||
return 0
|
||||
}
|
||||
print(accessSelf())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user