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-12745] Improve diagnostic for keypath used without 'keyPath:' label #55190

Closed
typesanitizer opened this issue May 7, 2020 · 3 comments
Closed
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-12745
Radar rdar://problem/62957095
Original Reporter @typesanitizer
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee None
Priority Medium

md5: f275a7e564eae783d7eb298a952cad8d

Issue Description:

If you have code like

struct S {
  var x : Int = 0
}
var s = S()
s[\.x] = 10 // error: type of expression is ambiguous without more context
 

The master compiler seems to be producing a suboptimal error. (Compiler explorer: https://godbolt.org/z/JPSdNZ) (also reproduced at ad00350 on master)

It would be nice to special case this error and provide a fix-it for adding a `keyPath:` label.

@typesanitizer
Copy link
Author

@swift-ci create

@LucianoPAlmeida
Copy link
Collaborator

Here is a PR #31671 trying to improve this 🙂

@LucianoPAlmeida
Copy link
Collaborator

Resolved by #31716
cc @artemcm

@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