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
"why not promoted" logic needs to be updated for field promotion #53102
Comments
\cc @MaryaBelanger
Note that since https://dart.dev/tools/non-promotion-reasons is linked to from the SDK, it will need to reflect the behavior in 3.2 and before 3.2, with some way to distinguish between differences as necessary. Edit: Crossed out misunderstood timelines. |
@parlough I can understand why you might have thought these diagnostic improvements wouldn't be included until Dart 3.3, because yesterday was the cutoff deadline for the Beta-2 branch, and our policy is not to turn on new language features after a Beta-2 release. But that policy doesn't apply to improvements that are outside the scope of the language specification. These diagnostic updates are outside the scope of the language specification because they won't change what programs are accepted by the compiler, and they won't the semantics of any accepted programs; they will just help the user to understand an error better when a program is rejected. |
@stereotype441 I definitely misunderstood the estimated timeline then, thanks so much for clarifying! It's great to hear that these diagnostic improvements can still land in 3.2. I edited my comment to avoid confusion by others :) |
…messages. This makes it easier to see at a glance which messages need to be supported by the website. I've included the new links that I intend to support as part of the new "field promotion" feature. Bug: #53102 Change-Id: I67ad47c5a00db9807a6c726677a06427cdbe02c2 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/325803 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Paul Berry <paulberry@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com>
I think these are all addressed in dart-lang/site-www#5246, I'll request your review there to confirm! |
Consider the following code (assuming Dart language version 3.2):
The CFE issues the following error message when trying to compile this:
And the analyzer says:
It's correct to have errors with this example program, but the messages explaining why are incorrect. The reason
_i
can't be promoted is not because it's a property; it's because there's another non-final field with the same name in the same file.The logic that creates these "why not promoted" messages needs to be updated to account for field promotion. Ideally it would be able to distinguish the following situations:
The text was updated successfully, but these errors were encountered: