-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Error messages with lack of property promotion could be improved #47588
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
Comments
Assigning to Konstantin. As discussed in the meeting, it would also be good to have a quick fix (or assist) that introduces a local variable. |
Hm... Currently we report "not promoted" as attached
|
You're right. I'll do some digging to see how difficult it would be to add this functionality. |
https://dart-review.googlesource.com/c/sdk/+/227900 will add a fix for a few cases. |
…LABLE_VALUE. Bug: #47588 Change-Id: Ice823f239b3b152d9583cecb143ea78a62361539 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227900 Reviewed-by: Samuel Rawlins <[email protected]> Reviewed-by: Phil Quitslund <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
@mit-mit points out that the errors that occur when the user attempts to promote a property could be clearer. For example, this code:
Produces the error message:
with the following suggested fix:
and then the following context message (pointing to the declaration
int? x;
):Two things are unfortunate about this:
(1) The user has to read through a lot of error message text before they get to the meat of the problem (properties can't be promoted).
(2) The suggested fix isn't great.
It would be better to have an error message like this:
and a suggested fix like this:
It probably would still be useful to have a context message pointing to the declaration
int? x;
. Maybe it could say something like:Note that this isn't the only error message that could potentially be improved; it's just an example.
The text was updated successfully, but these errors were encountered: