-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Infer selectors from protocols for property accessors too. #6634
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
Infer selectors from protocols for property accessors too. #6634
Conversation
This still has two problems:
@DougGregor, do you have any insight into either of these? |
(with expected failures) @swift-ci Please smoke test |
If a base class conforms to a protocol and a subclass implements an optional requirement, we don't record that anywhere. I think this is what that comment is referring to. |
In general do we want to change things so that accessors have witnesses, instead of/in addition to the AbstractStorageDecl? We do this dance in a bunch of places where we check if we have an accessor, get its storage, lookup the witness and then get the right accessor from there. |
Also it would be cool if a no-payload enum case could witness a read-only static property requirement :) |
(still with expected failures) @swift-ci Please smoke test macOS |
Yeah, the comment about inherited conformances is that the superclass can conform to some |
Regarding the double-diagnostic, it seems like we should be recording an erroneous/missing witness when there is a type mismatch, and shouldn't diagnose any problems with that requirement in that conformance later. |
And, thanks for working on this! |
This is a /little/ risky because previously a recorded witness would only be empty if the requirement was optional, but it's a relatively non-intrusive way to improve diagnostics. The conformance is still marked invalid, which is the important part. Groundwork for rdar://problem/28543037.
Most property accessors have selectors matching their protocols, but not all. Don't force the user to write '@objc' explicitly on an accessor, which isn't even possible for stored properties. More groundwork for rdar://problem/28543037.
9225e25
to
63f8479
Compare
Okay, added support for inference from optional requirements as well. Depends on (well, includes) #6698 now. Any more comments, @DougGregor or @slavapestov? (I'm not touching the larger issue of accessor requirements for now; that's more change than I'd want to pull into Swift 3.1.) @swift-ci Please test |
Build failed |
Build failed |
No more comments, thanks @jrose-apple |
Most property accessors have selectors matching their protocols, but not all. Don't force the user to write
@objc
explicitly on an accessor, which isn't even possible for stored properties.Groundwork for rdar://problem/28543037.