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-7445] Call Expressions Need Better Assignment Diagnostics #49988

Closed
CodaFi opened this issue Apr 16, 2018 · 2 comments
Closed

[SR-7445] Call Expressions Need Better Assignment Diagnostics #49988

CodaFi opened this issue Apr 16, 2018 · 2 comments
Assignees
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers improvement

Comments

@CodaFi
Copy link
Member

CodaFi commented Apr 16, 2018

Previous ID SR-7445
Radar None
Original Reporter @CodaFi
Type Improvement
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI, StarterBug
Assignee @AnthonyLatsis
Priority Medium

md5: d9d262db67912b2400f15a80852abcb8

Issue Description:

Call expressions are not handled in the walker at ConstraintSystem::diagnoseAssignmentFailure in CSDiag.cpp. A new diagnostic needs to be added to DiagnosticsSema.def and it needs to be invoked by that function. It would also be great to clean up the existing diagnostics by giving them better messages.

print(1) = () // error: cannot assign to value: function call returns immutable value 
@AnthonyLatsis
Copy link
Collaborator

@CodaFi Would you like a different diag for function calls? This one seems alright, or rather, I can't really think of a more appropriate message.

Maybe expression not assignable: ... . Any ideas?

@AnthonyLatsis
Copy link
Collaborator

PR(merged) – #16179

Also added highlighting for assignments to literals in complex expressions and updated the diagnosing paths to display cannot assign to value for methods (was cannot assign to property)

@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 diagnostics QoI Bug: Diagnostics Quality of Implementation good first issue Good for newcomers improvement
Projects
None yet
Development

No branches or pull requests

2 participants