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-13359] Improve diagnostic "has no subscript" for tuple indexing #55799

Closed
typesanitizer opened this issue Aug 6, 2020 · 3 comments
Closed
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation

Comments

@typesanitizer
Copy link

Previous ID SR-13359
Radar rdar://problem/66648847
Original Reporter @typesanitizer
Type Bug
Status Closed
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @LucianoPAlmeida
Priority Medium

md5: 15d80a4471ab3131df3ed4c33639c189

Issue Description:

For the following code:

func first(_ pair: (Int, Int)) -> Int {
  return pair[0] // error: value of type '(Int, Int)' has no subscripts
}

For tuples, we should special-case the diagnostic and say something that points out that tuple elements cannot be accessed using subscript notation.

If the subscript argument is a constant number, we could also offer a fix-it using dot-notation.

@typesanitizer
Copy link
Author

@swift-ci create

@LucianoPAlmeida
Copy link
Collaborator

theindigamer (JIRA User) #33380 🙂

@LucianoPAlmeida
Copy link
Collaborator

cc theindigamer (JIRA User) It is on master 🙂

@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
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation
Projects
None yet
Development

No branches or pull requests

2 participants