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:
Hiroshi Yamauchi
2024-05-22 16:17:47 -07:00
parent 59232e0345
commit d1ccba70d7
2 changed files with 20 additions and 0 deletions

View File

@@ -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())
}
}