-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Sema: (Mostly) check conformance availability #34565
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
Sema: (Mostly) check conformance availability #34565
Conversation
@swift-ci Please test |
@swift-ci Please test source compatibility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good. Did the source compat suite detect project issues?
Do you think we could allow declaring protocol inheritance in extensions within the same module to support availability declaration like these? It's a limitation with @_spi
and I would expect it to affect conformance availability too.
This wasn't used for anything. We model weak linking differently these days.
If a conformance is defined in an extension, we now look for references to the conformance in types and expressions and respect's the extension's availability (or deprecation, etc). The conformance checker itself still needs to check conformance availability of associated conformances and the like; that will be a separate change. Note that conformances defined on types don't require any special handling, since they are as available as the intersection of the conforming type and the protocol. By default, we diagnose conformance availability violations where the OS version is not sufficiently new as warnings, to avoid breaking source compatibility. Stricter behavior where these violations are diagnosed as errors is enabled by passing the -enable-conformance-availability-errors flag. There are test cases that run both with and without this flag. In the future, we hope to make the stricter behavior the default, since after all, violations here can result in link errors and runtime crashes. Uses of completely unavailable conformances are still always diagnosed as errors, even when this flag is not passed in. Progress on <rdar://problem/35158274>.
@xymus Source compatibility picked up a problem where Alamofire has a usage of a conditionally-unavailable conformance. I'm pretty convinced this is a bug in Alamofire, but I've decided to downgrade these violations to warnings. I added a new |
7c27751
to
ceb8675
Compare
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
If a conformance is defined in an extension, we now look for
references to the conformance in types and expressions and
respect's the extension's availability (or deprecation, etc).
The conformance checker itself still needs to check conformance
availability of associated conformances and the like; that will
be a separate change.
Note that conformances defined on types don't require any
special handling, since they are as available as the
intersection of the conforming type and the protocol.
Progress on rdar://problem/35158274.