Skip to content

Soften new unavailable conformance diagnostics #42528

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 2 commits into from
Apr 21, 2022

Conversation

beccadax
Copy link
Contributor

In #41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in.

This PR also includes an enhancement to DeclContext dumping that helps when locating imported declarations; I'm not sure this code is actually valid in its present form, and might remove it if it's a problem.

Fixes rdar://91940820.

Becca Royal-Gordon added 2 commits April 21, 2022 01:15
…in DeclContext::dumpContext(). This makes the dumps more usable since these declarations otherwise don’t have usable filenames or line numbers.
In swiftlang#41054, we fixed an oversight which caused us to not notice when a user erased a concrete type to an existential using an unavailable conformance. Unfortunately, this is source-breaking and needs to be reduced to a warning in Swift 5 mode unless the user opts in.

Fixes rdar://91940820.
@beccadax beccadax requested a review from tshortli April 21, 2022 08:21
@beccadax
Copy link
Contributor Author

@swift-ci smoke test

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 for tracking this down! When I implemented the additional diagnostics I think I missed that there was even the possibility of a new hard error being introduced since the majority of conformance availability diagnostics are already warnings for now.

@@ -52,3 +52,33 @@ func passAvailableConformance1a(x: HasAvailableConformance1) {
_ = x.isGalloping
_ = UsesHorse<HasAvailableConformance1>.self
}

// Explicit unavailability
public struct HasAvailableConformance2 {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: I would find this a bit clearer if it were named HasUnavailableConformance (it looks like the equivalent struct is named that way in conformance_availability.swift).

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