Skip to content

Enable availability attributes for associated types #70735

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 3 commits into from
Jan 6, 2024

Conversation

DougGregor
Copy link
Member

@DougGregor DougGregor commented Jan 5, 2024

Allow @available on associated types, which can be introduced after the protocol was introduced. These work precisely how on expects, because all of the infrastructure for introducing associated types later on has been available for a while, with two small restrictions:

  1. If one uses the primary associated type syntax (e.g., P<A, B>), then the primary associated types must also be available in the current context.
  2. Adding a new associated type to a resilient protocol requires that associated type to have a default.

Fixes rdar://108409322 and rdar://117586830

Allow `@available` on associated types, which can be introduced after
the protocol was introduced. These work precisely how on expects,
because all of the infrastructure for introducing associated types
later on has been available for a while, with two small restrictions:

1. If one uses the primary associated type syntax (e.g., `P<A, B>`),
then the primary associated types must also be available in the
current context.
2. Adding a new associated type to a resilient protocol requires that
associated type to have a default.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor enabled auto-merge January 5, 2024 19:01
Copy link
Contributor

@tshortli tshortli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! This fixes rdar://108409322.

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor
Copy link
Member Author

@swift-ci please smoke test

@DougGregor DougGregor merged commit 26cc99d into swiftlang:main Jan 6, 2024
@DougGregor DougGregor deleted the associated-type-availability branch January 6, 2024 00:11
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