Skip to content
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

[SR-8082] Swift should warn on redundant 'Any' members in a protocol composition #50615

Open
hamishknight opened this issue Jun 22, 2018 · 1 comment
Labels
compiler The Swift compiler in itself improvement

Comments

@hamishknight
Copy link
Collaborator

Previous ID SR-8082
Radar None
Original Reporter @hamishknight
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement
Assignee None
Priority Medium

md5: e62505ea8ab5d2c5332b7a94d0c9e09a

Issue Description:

For example, we should warn on the following:

protocol P {}
func foo(_ x: P & Any) {}

As the Any member of the composition is redundant.

@huonw
Copy link
Mannequin

huonw mannequin commented Jun 28, 2018

It might be nice to have warnings for arbitrary redundancy, like `P & P`, or `Q & (P & R)` where `protocol Q: P, R {}`. If you implement the general check, `Any` might fall out of it, because it is vacuously true that all of the members of the protocol composition are implied by the other members. Of course, fully implementing the general check is likely to be harder than just checking for `Any`.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself improvement
Projects
None yet
Development

No branches or pull requests

1 participant