Skip to content

[6.1] Sema: Always allow method overrides to be as available as the context #78938

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

Conversation

tshortli
Copy link
Contributor

  • Explanation: When a method override is as available as the class it's a member of, then it can't be any more available. It doesn't make sense to diagnose such a method as less available than the method it overrides. This regressed recently for methods belonging to classes that are nested inside extensions. The availability of the derived class may be defined by its context, but the compiler was only checking the availability attributes directly on the class.
  • Scope: Affects type checking for method overrides.
  • Issue/Radar: rdar://143600638
  • Original PR: Sema: Always allow method overrides to be as available as the context #78937
  • Risk: Low. There should be no source compatibility concerns since this change can only result in more overrides being accepted.
  • Testing: New compiler tests.
  • Reviewer: TBD

When a method override is as available as the class it's a member of, then it
can't be any more available. It doesn't make sense to diagnose such a method as
less available than the method it overrides. This regressed recently for
methods belonging to classes that are nested inside extensions. The
availability of the derived class may be defined by its context, but the
compiler was only checking the availability attributes directly on the class.

Resolves rdar://143600638.
@tshortli tshortli requested a review from a team as a code owner January 27, 2025 06:52
@tshortli tshortli changed the title Sema: Always allow method overrides to be as available as the context. [6.1] Sema: Always allow method overrides to be as available as the context Jan 27, 2025
@tshortli tshortli added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.1 labels Jan 27, 2025
@tshortli
Copy link
Contributor Author

@swift-ci please test

@tshortli tshortli merged commit 9cbe177 into swiftlang:release/6.1 Jan 27, 2025
5 checks passed
@tshortli tshortli deleted the allow-overrides-as-available-as-their-context-6.1 branch January 27, 2025 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 6.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants