[6.0][ConformanceLookup] Don't allow skipping inherited unavailable conformances in favor of explicit available ones. #75223
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation: This change fixes an issue where the compiler did not issue redundant conformance warnings when a client tries to add a retroactive
@unchecked Sendable
conformance when the library has already added an unavailableSendable
conformance.Note that this change still does not warn if the original unavailable conformance is declared with
@_nonSendable
due to the way@_nonSendable
expansion happens during implicitSendable
derivation, after no explicit conformance has been found.Scope: Only impacts redundant conformances where at least one of the conformances is unavailable.
Issues: rdar://124423524
Original PRs: [ConformanceLookup] Don't allow skipping inherited unavailable conformances in favor of explicit available ones. #75135
Risk: Low; the redundant conformance diagnostics added by this change are downgraded to warnings unconditionally. This allows libraries to stage in unavailable conformances to
Sendable
later on, and clients that have already added a retroactive@unchecked Sendable
conformance will receive a warning when they rebuild. Conformance lookup will still choose the available conformance to avoid breaking source compatibility in places where the client code uses the type in a way that requires an available conformance toSendable
.Testing: Added new tests. Passed source compatibility on the
main
PR.Reviewers: @ktoso