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-7984] Constraint to concrete type using : should offer a fixit #50517

Closed
airspeedswift opened this issue Jun 13, 2018 · 8 comments
Closed
Assignees
Labels
compiler The Swift compiler in itself good first issue Good for newcomers improvement

Comments

@airspeedswift
Copy link
Member

Previous ID SR-7984
Radar rdar://problem/41069420
Original Reporter @airspeedswift
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, StarterBug
Assignee @theblixguy
Priority Medium

md5: 809f447920d386ee0c54381c40fa3859

Issue Description:

If you try to constrain a generic parameter to a concrete type using a : you'll get an error message:

// error: Type 'Key' constrained to non-protocol non-class type 'String'
extension Dictionary where Key: String { }

We should also offer a fix it to replace the : with ==.

@airspeedswift
Copy link
Member Author

@swift-ci create

@belkadan
Copy link
Contributor

Tagging as a Starter Bug. It should be possible to get the location of the ":" from a RequirementRepr, which is one of the possible representations of a GenericSignatureBuilder::FloatingRequirementSource. The diagnostic is emitted from GenericSignatureBuilder::addTypeRequirement (look for diag::requires_conformance_nonprotocol).

@vguerra
Copy link
Contributor

vguerra commented Jun 14, 2018

Thanks you for the hints Jordan! I think i can tackel this one.

@belkadan
Copy link
Contributor

Hang on, Kenta was already working on it! Not that you can't try it out, but there are other StarterBugs that might be a better use of your time. :-)

@vguerra
Copy link
Contributor

vguerra commented Jun 14, 2018

Ah sorry![]( I thought this was unassigned) Sure .. will look for another one!

@theblixguy
Copy link
Collaborator

I can pick this up as it's been a long time and Kenta hasn't fixed it yet.

@theblixguy
Copy link
Collaborator

PR: #22152

@theblixguy
Copy link
Collaborator

Fixed on master @airspeedswift 🙂

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
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 good first issue Good for newcomers improvement
Projects
None yet
Development

No branches or pull requests

4 participants