-
Notifications
You must be signed in to change notification settings - Fork 205
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
[breaking change] Remove the colon-syntax for default values. #2357
Comments
@bwilkerson does |
We may wish to start emitting a warning in the next release that this is going away. |
Sorry I missed the ping.
Sounds like we should convert the lint to a warning so that it's always enabled. I think the right path forward is to mark the lint as deprecated when the warning is implemented. Doing so will enable a fix to remove the lint from the analysis options file. |
|
Yes, I think a roll-out plan like this might work:
@bwilkerson does that sound right? And if we do so, would a developer using 2.19 who for some reason want to ignore the warning be able to suppress it with an |
That sounds right to me. I assume that we'll put out a breaking change notice before 2.19 and again before 3.0.
Yes. Warnings can be ignored via the analysis options file or by using an ignore comment. I have a CL to add the warning and am using it to gauge the amount of work that will be required to land it. I don't know what the time frame for 2.19 looks like, so I don't know when this needs to land. |
Thanks! 2.19 branching is several months away. |
I noticed that we have a lot of occurrences in the platform libraries (which includes some of the oldest Dart code in existence, so not entirely surprising). Some clean-up will definitely be needed. Most can be handled by a |
I noticed the same when I ran a dry-run on the CL that adds the analyzer support (https://dart-review.googlesource.com/c/sdk/+/254467). |
As can be seen from the CBuild failure on https://dart-review.googlesource.com/c/sdk/+/254467, there are still a fair number of uses of colon-syntax internally. We probably want to get the lint enabled internally as a path toward being able to land this change. |
This would probably be useful to get the code migrated: dart-lang/sdk#47219 |
@bwilkerson we've been doing a ton of cleanup. Can you try to run your CL checks again after rebasing? |
I'm not sure the timeline for the analyzer warning, but perhaps |
Great suggestion, @parlough !! |
I like that in spirit, but I think practically only pretty old Dart code is likely to use this style, and I doubt any of that is a) configured to use our new lints, and b) would upgrade to a new version of those lints. So I speculate that it would make no practical difference? |
Dart currently allows for two different syntaxes for default values. One is getting deprecated: dart-lang/language#2357 This CL updates fidlgen to no longer use the about-to-be-deprecated syntax. Change-Id: I870e839450b37c51643808a15b0dc9d1fcf7f044 Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/737404 Reviewed-by: Alex Zaslavsky <azaslavsky@google.com> Reviewed-by: Mitchell Kember <mkember@google.com> Commit-Queue: Michael Thomsen <mit@google.com>
The analyzer changes have now landed. |
@bwilkerson can I get you to create a second changelist for the 3.0 alpha change, which makes this an error and removes the lint? This CL would be landed right after we've done the last branch point for 2.19 and the main branch is open for 3.0 development. |
Perhaps the Dart 3 alpha change we can split into two steps: a) make it an error, and b) remove the lint. I think the former is the most urgent. |
Sorry I missed the ping again. Yes.
Yes, it will likely be two steps. We're trying to deprecate the lint before 2.19 so that users will know that it's no longer needed and will be removed. |
The colons cause test failures when the language version is bumped to 3.0. This CL can be landed before the 3.0 version bump. Bug: dart-lang/language#2357 Change-Id: Id8396034b16adc18b476689314e28b9617d25f18 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272200 Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Daco Harkes <dacoharkes@google.com>
@bwilkerson any updates on the CL to make this an error? I don't see it here: |
It should happen automatically with the change in the SDK version number. There are changes in that CL to fix some tests that were reporting the warning to make them expect the error, so I assumed that everything was working correctly. To the best of my knowledge, there is no further work to be done and we can close this issue once that CL has landed. |
Indeed that is the case 🥳 :
Thanks! |
@lrhn - the analyzer reports this as an error now, but the CFE does not. Shouldn't the CFE as well? If so, can you please open an issue on the CFE for Dart 3? |
FYI - @mit-mit @itsjustkevin |
The CFE issue is here. Echoing a comment there on the main issue here for posterity: This is a language versioned changed. It's an error to use |
The CFE change handled in dart-lang/sdk@bd02ce7. I'm not aware of any remaining work. @munificent can we go ahead and close this given all the changes are in main? |
I think so. This change is @lrhn's baby, but as far as I know, it's done. |
Closing as there is no known work |
-[breaking change]Remove the colon-syntax for default values ,to make project compatible for Dart 3 and above Reported issue: dart-lang/language#2357
For historical reasons, named optional parameters can specify their default value using either
:
or=
.The
=
was introduced later because it's better. It's probably about time to remove the ability to use:
.So, we should do so for Dart 3.0.
Example:
is currently valid, will become invalid.
We have a lint recommending using
=
, and it's in our recommended set, so there should hopefully be very few remaining uses, most likely only in code so old it's not null-safe anyway.Might also open up the syntax for something else, even if I don't know what. (Types on the right, anybody?)
The text was updated successfully, but these errors were encountered: