Skip to content

Sema: Reject unavailable associated types and observing accessors #76403

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
Sep 12, 2024

Conversation

tshortli
Copy link
Contributor

@tshortli tshortli commented Sep 11, 2024

Improve the diagnostics for @available by rejecting the attribute whenever it would make either an associated type declaration or an observing accessor unavailable. The compiler does not consider the availability of these declarations when emitting code that uses them, so it is misleading to accept the @available attribute on them.

Resolves rdar://80337141.

@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli
Copy link
Contributor Author

@swift-ci please test source compatibility

@tshortli
Copy link
Contributor Author

Source compatibility failures are all from a known issue.

@tshortli tshortli force-pushed the availability-attr-diags branch from 61e735c to d86ed15 Compare September 11, 2024 23:40
@tshortli tshortli enabled auto-merge September 11, 2024 23:40
@tshortli tshortli disabled auto-merge September 11, 2024 23:41
@tshortli tshortli force-pushed the availability-attr-diags branch from d86ed15 to 61e735c Compare September 11, 2024 23:42
Make it possible to share the diagnostics string for common case.
It should not be possible to mark an associated type declaration unavailable
since doing so does not have an effect on how a conformance interacts with its
associated types.
Marking an observer unavailable (or potentially unavailable) has no effect
since the compiler emits calls to them unconditionally.

Resolves rdar://80337141.
@tshortli tshortli force-pushed the availability-attr-diags branch from 61e735c to 21837e9 Compare September 11, 2024 23:43
@tshortli
Copy link
Contributor Author

@swift-ci please smoke test

@tshortli tshortli enabled auto-merge September 11, 2024 23:43
@tshortli tshortli merged commit c8cfe8f into swiftlang:main Sep 12, 2024
3 checks passed
@tshortli tshortli deleted the availability-attr-diags branch September 12, 2024 14:56
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.

1 participant