Skip to content
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

[6.0] Respect @preconcurrency everywhere we diagnose Sendable issues #73720

Merged
merged 6 commits into from
May 19, 2024

Conversation

DougGregor
Copy link
Member

Explanation: A number of places in the Swift type checker were providing diagnostics when a type is not Sendable without respecting @preconcurrency imports that would suppress or downgrade those diagnostics. This both impacts specific classes of diagnostics (such as the diagnostic when a global or staticlet has non-Sendable type) and existing diagnostics where the non-Sendable type is part of a larger non-Sendable type, such as NonSendable? or [NonSendable].
Original PR: #73676, #73698
Radar/issue: rdar://121889248, rdar://125081249
Risk: Low. The changes only affect diagnostics that are warnings prior to Swift 6, and only downgrades diagnostics from warnings -> suppressed (Swift < 6) or errors -> warnings (Swift >= 6).

…currency`

The diagnostic for non-Sendable globa/static `let` properties was checking
for a Sendable conformance without considering `@preconcurrency`. Emit
this diagnostic via a `@preconcurrency`-sensitive path.

Fixes rdar://121889248.

(cherry picked from commit 94a2529)
…f non-Sendable types

(cherry picked from commit 290ec79)
…es in deinit

Instance properties of non-sendable types cannot safely be
accessed within deinitializers. Make sure we respect `@preconcurrency`
when diagnosing these.

(cherry picked from commit c326fd3)
When determining whether a non-sendable type is a nominal type that is
affected by `@preconcurrency`, be sure to look at the specific type
even when it's part of larger type, e.g., the `NS` in `NS?`. This
makes `@preconcurrency` work properly through structural types like
arrays, optionals, and dictionaries.

While here, also check whether the nominal declaration itself has been
marked as `@preconcurrency`.

Fixes rdar://125081249.

(cherry picked from commit d62b565)
(cherry picked from commit 0f8c478)
@DougGregor DougGregor requested a review from a team as a code owner May 17, 2024 20:09
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor merged commit b4792a5 into apple:release/6.0 May 19, 2024
5 checks passed
@DougGregor DougGregor deleted the preconcurrency-fixes-6.0 branch May 19, 2024 19:09
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.

None yet

2 participants