-
Notifications
You must be signed in to change notification settings - Fork 1.7k
ugly inline #60169
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
This seems to only happen when you have both a Edit: This only happens with no This is probably intended to make |
Okay, I could come up with two simple tests that represent the reason of this: Future<void> function() async {
await function2();
}
Future<void> function2() async {
return Future.delayed(Duration.zero);
} Will be refactored: Future<void> function() async {
await Future.delayed(Duration.zero);
} But the problem happens if you remove the return and add no Future<void> function() async {
await function2();
}
Future<void> function2() async {
Future.delayed(Duration.zero); // No more `return`
} If you refactor the same as above, the resulting code is wrong since now you are awaiting the So in this case, removing the |
It might be reasonable to remove the To do this right I think we need flow analysis, which is implemented, but not exposed in a way that we can make use of it. |
I've managed to reduce the fix to actually two lines of code, the rest of the refactor already handled everything. I'm not sure if this would have any other edge cases but I suspect not. Here is the CL https://dart-review.googlesource.com/c/sdk/+/411440. Added you as a reviewer @bwilkerson. Thanks! |
Hey @bwilkerson, I have a question for you on the CL. Can you take a look, please? Thanks a lot! |
Sorry for the long delay. The tl;dr is that async programming is hard and we think it would be hard for many users to understand what had changed if the refactoring were to make changes that also changed the semantics of the code. In particular, we need to be careful to not remove an |
input code:
inline
_rmBadBookmark
result code:
expected code:
The text was updated successfully, but these errors were encountered: