Skip to content

[6.0][TypeChecker] InferSendableFromCaptures: Infer @Sendable on adjusted types #72741

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
merged 5 commits into from
Apr 2, 2024

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Apr 1, 2024

Cherry-pick of #72527

  • Explanation:

    Previously sendability was inferred directly on an (opened) interface type and
    carried over to the "adjusted" type, this creates a problem for some partially
    applied references to isolated members because they have to be wrapped in an
    autoclosure that would attempt a conversion from i.e. @Sendable to @MainActor
    type and be diagnosed an a concurrency issue.

    Instead of doing that let's apply inference to the adjusted type, which maintains
    original behavior where (opened) interface type is adjusted via FunctionConversionExpr
    to a type with appropriate concurrency annotations.

  • Scope: Partial applications with InferSendableFromCaptures feature enabled.

  • Main Branch PRs: [TypeChecker] InferSendableFromCaptures: Infer @Sendable on adjusted types #72527

  • Resolves: rdar://119593407

  • Risk: Low

  • Reviewed By: @hborla

  • Testing: Added test-cases to the test suite.

xedin added 5 commits April 1, 2024 09:23
…e `FunctionType`

This method is always called after the type is opened by the solver
which means that we never end up with `GenericFunctionType`.

(cherry picked from commit eb97553)
…adjustFunctionTypeForConcurrency`

(cherry picked from commit 48e9684)
…nversions

None of the diagnostics in MiscDiagnostics make a distinction between
sendable or actor-isolated function references which means that we can
skip conversions while reaching for a declaration used in an application.

(cherry picked from commit 64a200a)
…bers to `adjustFunctionTypeForConcurrency`

(cherry picked from commit a7f9a68)
@xedin xedin requested a review from hborla April 1, 2024 16:42
@xedin xedin requested a review from a team as a code owner April 1, 2024 16:42
@xedin
Copy link
Contributor Author

xedin commented Apr 1, 2024

@swift-ci please test

@xedin xedin merged commit 29cade6 into swiftlang:release/6.0 Apr 2, 2024
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.

2 participants