Skip to content

[AST] Choose an implied conformance source next to the type, if possible. #17786

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 2 commits into from
Jul 9, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Jul 6, 2018

If a conformance to a protocol is implied by several other
conformances (i.e. protocol P: Equatable {} and protocol Q: Equatable {} and a
type declares conformance to both P and Q), we should choose a source that's in
the same file as the type, if we can, because automatic synthesis of
conformances (for Equatable, Hashable, etc.) only works in that case.

Fixes rdar://problem/41852654.

huonw added 2 commits July 6, 2018 18:24
…nce tests.

The special handling of interleaved decls and statements is confusing and makes
other testing hard.
…ble.

If a conformance to a protocol is implied by several other
conformances (i.e. protocol P: Equatable {} and protocol Q: Equatable {} and a
type declares conformance to both P and Q), we should choose a source that's in
the same file as the type, if we can, because automatic synthesis of
conformances (for Equatable, Hashable, etc.) only works in that case.

Fixes rdar://problem/41852654.
@huonw
Copy link
Contributor Author

huonw commented Jul 6, 2018

@swift-ci please test

@huonw
Copy link
Contributor Author

huonw commented Jul 6, 2018

@swift-ci please test source compatibility

@huonw
Copy link
Contributor Author

huonw commented Jul 6, 2018

The failure is ReactiveCocoa, which isn't caused by this PR (rdar://problem/41859797).

@slavapestov
Copy link
Contributor

@huonw The ReactiveCocoa failure should now be fixed.

@huonw
Copy link
Contributor Author

huonw commented Jul 8, 2018

@swift-ci please test source compatibility

@huonw
Copy link
Contributor Author

huonw commented Jul 9, 2018

Those failures aren't related either "error: Failed to clean build folder: The file couldn’t be saved.".

@huonw huonw merged commit d21eedb into swiftlang:master Jul 9, 2018
@huonw huonw deleted the crossfile-synthesis-implication branch July 9, 2018 22:10
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.

2 participants