Skip to content

[stdlib] Work-around incorrect name resolution with conditional BidirectionalCollections. #18066

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
Jul 19, 2018

Conversation

huonw
Copy link
Contributor

@huonw huonw commented Jul 19, 2018

If a type conditionally conforms to BidirectionalCollection, suffix's (and the
others) use of index ends up dispatching through Collection.index seemingly
because it is a protocol requirement. The intended function is
BidirectionalCollection's overloaded index (which isn't connected to a
protocol requirement), which is called for non-conditional conformances. As
such, this is a work-around to stop code crashing.

Noticed in SR-8022, rdar://problem/41216424.

…ectionalCollections.

If a type conditionally conforms to BidirectionalCollection, suffix's (and the
others) use of `index` ends up dispatching through `Collection.index` seemingly
because it is a protocol requirement. The intended function is
BidirectionalCollection's overloaded `index` (which _isn't_ connected to a
protocol requirement), which is called for non-conditional conformances. As
such, this is a work-around to stop code crashing.

Noticed in SR-8022, rdar://problem/41216424.
@huonw huonw requested a review from moiseev July 19, 2018 02:26
@huonw
Copy link
Contributor Author

huonw commented Jul 19, 2018

@swift-ci please smoke test

Copy link
Contributor

@moiseev moiseev left a comment

Choose a reason for hiding this comment

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

Thanks @huonw!

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