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

Modify error message for const (ASSIGNMENT_TO_CONST) #56953

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Frankdroid7
Copy link

Dart says Constant variables can't be assigned a value., when you try to reassign a value to a const variable.

I feel a better error description should have been Constant variables can't be re-assigned a value.
This is because we are trying to re-assign it not assign it at this point. The assignment has already been done.

Thanks.

Screenshot 2024-10-24 at 12 27 37

Copy link

google-cla bot commented Oct 24, 2024

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/391489

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

This comment was marked as duplicate.

@mit-mit
Copy link
Member

mit-mit commented Nov 4, 2024

Hi @Frankdroid7 can you please take a look at the review feedback in https://dart-review.googlesource.com/c/sdk/+/391489 ?

@Frankdroid7
Copy link
Author

Constant variables can't be assigned a value after initialization.

Yes, we can go with this as the error message @mit-mit
Thanks.

Copy link

https://dart-review.googlesource.com/c/sdk/+/391489 has been updated with the latest commits from this pull request.

@bwilkerson
Copy link
Member

I'm not sure what happened, but this PR only has one commit that I can see. Copybara copied the same commit to the CL, so there are no changes between the first and second patches. Could you please try uploading the commit with your latest changes again?

@Frankdroid7
Copy link
Author

Frankdroid7 commented Nov 6, 2024 via email

@Frankdroid7
Copy link
Author

Pushed a new commit

Copy link

https://dart-review.googlesource.com/c/sdk/+/391489 has been updated with the latest commits from this pull request.

1 similar comment
Copy link

https://dart-review.googlesource.com/c/sdk/+/391489 has been updated with the latest commits from this pull request.

@bwilkerson
Copy link
Member

Thanks! I left some additional comments on the CL (https://dart-review.googlesource.com/c/sdk/+/391489).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants