Skip to content

[Diagnostics] Extract requirement declaration context retrieval into … #18752

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 1 commit into from
Aug 16, 2018

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Aug 16, 2018

…its own method

Change logic to traverse the chain of declaration contexts
starting for "affected" declaration's parent and check if the
requirement is satisfied by one of them, if so return it as
requirement's declaration context.

Extract this logic into a method on RequirementFailure to make
it accessible for other types of requirement failure diagnostics.

…its own method

Change logic to traverse the chain of declaration contexts
starting for "affected" declaration's parent and check if the
requirement is satisfied by one of them, if so return it as
requirement's declaration context.

Extract this logic into a method on `RequirementFailure` to make
it accessible for other types of requirement failure diagnostics.
@xedin
Copy link
Contributor Author

xedin commented Aug 16, 2018

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 0f411b1

break;

if (auto *GC = D->getAsGenericContext()) {
auto *sig = GC->getGenericSignature();
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like you just want DC->getGenericSignatureOfContext() and avoid all this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think I can because getGenericSignatureOfContext is going to traverse parents until it finds one with generic signature and it would only return signature from it, but I wouldn't know which parent that was.

Copy link
Contributor

Choose a reason for hiding this comment

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

getGenericSignatureOfContext() does not traverse parents, but non-generic decls in generic context inherit the generic signature of their parent, so getGenericSignature() has the same behavior.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know, I'll give it a try.

@xedin
Copy link
Contributor Author

xedin commented Aug 16, 2018

@swift-ci please test Linux platform

@xedin xedin merged commit fc41370 into swiftlang:master Aug 16, 2018
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.

3 participants