-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Sema: Prefer class properties to protocol properties when ranking overloads #18206
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
Conversation
…rloads This was the old behavior in Swift 4.1, but it broke after some changes to redeclaration checking and shadowing. Fixes <rdar://problem/42201583>.
@swift-ci Please test |
@swift-ci Please test source compatibility |
@hamishknight Please take a look. |
// If both are properties and one is in a protocol, prefer the one not in | ||
// a protocol. | ||
// | ||
// This is a Swift 4.1 compatibility hack. Changes elsewhere in the compiler |
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.
Should we conditionalize it on language version?
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.
Arguably this is in line with preferring concrete implementations over protocol implementations. It is a little funny when the concrete implementation is a superclass, but…
Build failed |
Build failed |
Thanks for addressing this! LGTM as a stopgap until we decide on a consistent rule to follow for all types of members (i.e not just properties) in this case. |
This was the old behavior in Swift 4.1, but it broke after some changes
to redeclaration checking and shadowing.
Fixes rdar://problem/42201583.