Skip to content
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

Add support for collection-if in 'remove comparison' quick-fix #52543

Closed
shilangyu opened this issue May 28, 2023 · 2 comments
Closed

Add support for collection-if in 'remove comparison' quick-fix #52543

shilangyu opened this issue May 28, 2023 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. dartdev-quick-fix Issues with analysis server (quick) fixes P3 A lower priority bug or feature request

Comments

@shilangyu
Copy link
Contributor

The following raises unnecessary_null_comparison warning, but offers no quick-fix for it:

final int a = 123;

final list = [
	if (a != null) // warning here, `a` cannot be null
		a
];

The RemoveComparison quick-fix doesn't implement support for it. If this is a wanted change, I can send a CL with this feature.

@SanketRSalve
Copy link

final int? a =123;
Declare 'a' as a nullable value like above

@lrhn lrhn added the area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. label May 29, 2023
@scheglov scheglov added P3 A lower priority bug or feature request dartdev-quick-fix Issues with analysis server (quick) fixes labels May 30, 2023
@scheglov scheglov self-assigned this May 30, 2023
@scheglov
Copy link
Contributor

copybara-service bot pushed a commit that referenced this issue May 30, 2023
Bug: #52543
Change-Id: Ibeecc42db2135d507ed8f74f5a4888fb122b131f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/306312
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. dartdev-quick-fix Issues with analysis server (quick) fixes P3 A lower priority bug or feature request
Projects
None yet
Development

No branches or pull requests

4 participants