Skip to content

[region-isolation] Be more aggressive about not looking through Sendable values when getting underlying objects. #75131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gottesmm
Copy link
Contributor

[region-isolation] Be more aggressive about not looking through Sendable values when getting underlying objects.

Otherwise, in cases like the following, we look through the load to x.boolean and think that the closure is actually capturing x instead of y:

func testBooleanCapture(_ x: inout NonSendableKlass) {
  let y = x.boolean
  Task.detached { @MainActor [z = y] in
    print(z)
  }
}

rdar://131369987

…ble values when getting underlying objects.

Otherwise, in cases like the following, we look through the load to x.boolean
and think that the closure is actually capturing x instead of y:

```swift
func testBooleanCapture(_ x: inout NonSendableKlass) {
  let y = x.boolean
  Task.detached { @mainactor [z = y] in
    print(z)
  }
}
```

rdar://131369987
@gottesmm gottesmm requested review from ktoso and eeckstein as code owners July 10, 2024 17:55
@gottesmm
Copy link
Contributor Author

@swift-ci smoke test

@gottesmm gottesmm merged commit a861331 into swiftlang:main Jul 10, 2024
3 checks passed
@gottesmm gottesmm deleted the pr-f98009de45079043f0a356d020d8110306fb159f branch July 10, 2024 21:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant