Skip to content

[6.0][Concurrency] Don't warn about re-stating inherited unavailable conformances to Sendable. #75360

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

hborla
Copy link
Member

@hborla hborla commented Jul 19, 2024

  • Explanation: The compiler warns on classes that inherit @unchecked Sendable conformances and don't re-state the conformance so that the programmer is aware that they're responsible for upholding the promises of Sendable without the compiler's help. This checking was completely skipped for inherited, unavailable Sendable conformances until [6.0][ConformanceLookup] Don't allow skipping inherited unavailable conformances in favor of explicit available ones. #75223. This exposed a bug where the unavailable check was not done on the root conformance, which lead to bogus warnings that subclasses must restate the @unchecked Sendable conformance:

    @available(*, unavailable)
    extension Foo : @unchecked Sendable { }
    
    class Foo {}
    
    class Bar: Foo {} // warning: class 'Bar' must restate inherited '@unchecked Sendable' conformance

    The fix is to look for unavailable attributes on the root conformance's decl context.

  • Scope: Only impacts inherited, unavailable conformances to Sendable.

  • Issues: rdar://132059160

  • Original PRs: [Concurrency] Don't warn about re-stating inherited unavailable conformances to Sendable. #75359

  • Risk: Low; this change effectively replaces a conformance->getDeclContext() argument with conformance->getRootConformance()->getDeclContext(), and the only effect is skipping warnings.

  • Testing: Added a new test exercising the lack of warning.

  • Reviewers: TBD

…rmances

to `Sendable`.

The unavailability check was not using the root conformance, which is where
the extension declaration with the unavailability attribute is for inherited
conformances, leading to bogus warnings about re-stating unchecked conformances
to `Sendable`.

(cherry picked from commit 69b2435)
@hborla hborla requested a review from a team as a code owner July 19, 2024 04:00
@hborla
Copy link
Member Author

hborla commented Jul 19, 2024

@swift-ci please test

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.

3 participants