-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Missing error when awaiting a void expression #33415
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
Should we also have an issue filed for the CFE to reject this case? |
This is a larger breaking change than I first thought. There were 6 files violating this in the SDK, and it may be common in g3 as well. I will try to get a measure of the impact this would have on flutter, and on g3. May be worth another "breaking change RFC" in the flutter mailing lists etc. |
Change-Id: I758d66d5112de631283adc791c0e33b3b98edfc1 Reviewed-on: https://dart-review.googlesource.com/60707 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Required to unblock #33415 Change-Id: I18306967737fc26136cc74c70f14cf33509e96f3 Reviewed-on: https://dart-review.googlesource.com/60706 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
Here's a naive drive-by comment: Surely there are some beautiful fixes to each instance of this problem, involving various derived adjustments of declared return types and whatnot; but it should also be enough to replace |
@MichaelRFairhurst - are you the owner on this? Any updates? |
We've got ~500 failing targets in g3 for this. I'll go with @eernstg's suggestion of adding 'as dynamic' to get past these. Of course even with that, that can take a while to roll out externally etc. |
@MichaelRFairhurst got an update on this? |
Migration is taking a while here. Lots of breakages...about 2.5k in google3 so far. cl/202982389. @leafpetersen @eernstg @lrhn that's probably at the scale that you guys should be aware... |
We may want to abandon this as a Dart 2 error and make it an opt in lint. |
Would we plan on making this an error in Dart 3? |
I have no idea about Dart 3. My hope would be that if
then we could fairly easily make this an actual part of the language in Dart 3. Bunch of ifs there though. |
The current I hope the So, to make future improvements more viable, I'd prefer to keep this restriction if at all possible. Casting a |
It's a little bit like With We would get rid of that problem if we were to replace the result of a void typed expression by |
This didn't make the cut for Dart 2, closing as not planned. We may want to open an issue to make a lint for this. |
#30470 is still in the cut and I have implemented the error. |
Bug: 33415 Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc Reviewed-on: https://dart-review.googlesource.com/60522 Commit-Queue: Mike Fairhurst <mfairhurst@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Bug: 33415 Change-Id: I4d4e81fef79a5bc5162e37ab07a8fe99e50c8dfc Reviewed-on: https://dart-review.googlesource.com/60522 Commit-Queue: Mike Fairhurst <mfairhurst@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This error started showing up in The revert at 8af2d70 is in the history for the tag for 2.1.0-dev.0.0 so I guess some other commit has reapplied it or a similar change, and separately something has introduced it as a warning in CFE. I think it would be safe to:
|
Yeah this is definitely weird, I saw this today but hadn't had time to investigate. I definitely did not reland this change. I was not able to get google3 fully clean. Keerti told me recently she saw like, one violation of this, which is weird that both it showed up and that it was missing. The latest plan was to have it be caught by That's all from the analyzer side. From the CFE side, I forgot to coordinate with this. Just in general, @peter-ahe-google expressed that it was hard to follow what he was supposed to do over this topic, and this particular error was something I thought I would land up until the very end where I found I had apparently missed a few thousand errors in g3 and so it was not going to be ready in time. |
I'm also fine with making it a warning, and an error in 3.0. |
I never finished rolling back my CL here, it was only rolled back in th edev channel: |
Should this get moved to Dart2.1? |
I don't think we plan on landing this until at least Dart 3, since its too large a breaking change in practice. It can be caught with the lint rule, await_only_futures |
@MichaelRFairhurst Was this caught too late in the development of Dart 2.0 to be fixed there? |
@Stargator yep. I missed it. There were thousands of await voids in code we had access to, and I was not able to clean up enough of them fast enough. |
@MichaelRFairhurst Ah okay, well. I'd be curious if there might be a way to automate the clean up so whenever this change is done, it doesn't require as much direct intervention. |
Unfortunately its less automatable than you might think. I saw a few fixes:
So I don't have any automation on this that I'm able to share -- but mostly so far, we've done manual cleanup. |
Ah also, I saw some awaits in the wrong place, ie:
here |
The snippet below should be an error per the static analysis section of https://github.com/dart-lang/sdk/blob/master/docs/language/informal/generalized-void.md .
The text was updated successfully, but these errors were encountered: