-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[GSB] Canonicalize conformance access paths on-the-fly. #13424
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
[GSB] Canonicalize conformance access paths on-the-fly. #13424
Conversation
When forming a conformance access path, remove from consideration any requirement sources that contain protocol requirements that aren't found in the requirement signature. This ensure well-formedness of the resulting conformance access path. Huge thanks to Slava for reducing this one, and apologies to Arnold for having to track it down a second time before I fixed it. Fixes SR-6200 / rdar://problem/35113583.
@swift-ci please smoke test |
@swift-ci please test source compatibility |
If we used the requirement signature to create a protocol requirement element in a requirement source, there's no need to verify that it's from the requirement signature (duh).
@swift-ci please smoke test |
@swift-ci please test source compatibility |
@swift-ci please smoke test |
@swift-ci please test source compatibility |
Type subjectType, | ||
ProtocolDecl *proto) { | ||
// Make sure this requirement exists in the requirement signature. | ||
for (const auto& req: requirements) { |
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.
"auto &" maybe?
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.
You're referring to the spacing?
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.
(I'll fix the spacing in a separate PR)
@@ -936,9 +936,11 @@ class GenericSignatureBuilder::RequirementSource final | |||
/// Whether there is a trailing written requirement location. | |||
const bool hasTrailingWrittenRequirementLoc; | |||
|
|||
public: |
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.
Does this need to be public?
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.
Yeah, it's used from a static function. It's const
, so there's no concern about anyone messing with the state.
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.
... although this makes me wonder if I could back-patch the value when it is found to map into the requirement signature, to prevent future work. Feels icky.
Source compatibility suite issues are the same as on master, and should be addressed by #13427 |
When forming a conformance access path, remove from consideration any
requirement sources that contain protocol requirements that aren't
found in the requirement signature. This ensure well-formedness of the
resulting conformance access path. Huge thanks to Slava for reducing
this one, and apologies to Arnold for having to track it down a second
time before I fixed it.
Fixes SR-6200 / rdar://problem/35113583.