Skip to content

[6.2][AST/Sema] SE-0487: Implement @nonexhaustive attribute and new enum exhaustivity checking rule #82922

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

Draft
wants to merge 8 commits into
base: release/6.2
Choose a base branch
from

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jul 9, 2025

xedin added 7 commits July 8, 2025 15:39
This attribute controls whether cross-module access to the declaration
needs `@unknown default:` because it's allowed to gain new cases even
if the module is non-resilient.

(cherry picked from commit a0ae93d)
For now the semantics provided by `@extensible` keyword on per-enum
basis. We might return this as an upcoming feature in the future with
a way to opt-out.

(cherry picked from commit bf19481)
…tribute

Guard against condfails when older compilers get a swift interface
that uses `@extensible` attribute. The attribute itself doesn't
have any effect in swift interfaces yet since all of the public
enums are already resilient in that mode.

(cherry picked from commit 6d89bca)
…s for extensible enums

Just like `@preconcurrency` for concurrency, this attribute is going
to allow exhaustiveness error downgrades for enums that were retroactively
marked as `@extensible`.

(cherry picked from commit 498430a)
This is an accepted spelling for the attribute. This commit
also renames the feature flag from `ExtensibleAttribute` to
`NonexhaustiveAttribute` to match the spelling of the attribute.

(cherry picked from commit fe1ae75)
…n` argument

The spelling `@nonexhaustive(warn)` replaces `@preEnumExtensibility`
attriubte.

(cherry picked from commit 43eec8f)
@xedin xedin requested a review from a team as a code owner July 9, 2025 18:09
@xedin xedin added 🍒 release cherry pick Flag: Release branch cherry picks swift 6.2 labels Jul 9, 2025
@xedin
Copy link
Contributor Author

xedin commented Jul 9, 2025

@swift-ci please test

@xedin xedin force-pushed the nonexhaustive-enums-6.2 branch from 218aeeb to afa6d64 Compare July 9, 2025 18:17
@xedin
Copy link
Contributor Author

xedin commented Jul 9, 2025

@swift-ci please test

@xedin xedin marked this pull request as draft July 10, 2025 00:44
@xedin
Copy link
Contributor Author

xedin commented Jul 10, 2025

@swift-ci please test Windows platform

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.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant