fix: quickfix deletes active functionality when removing unused variable #60663
Labels
area-devexp
For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.
devexp-quick-fix
Issues with analysis server (quick) fixes
P2
A bug or feature request we're likely to work on
type-bug
Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
This was an issue that I opened in a library very_good_analysis, they sugested I opened it here.
Linter will remove function calls when made to a unused variable, even though the function itself might still be needed.
System used:
Windows.
Steps To Reproduce
Create a variable that receives the result of a function but is unused
Accept the quickfix
Expected Behavior
Future _postSomething(var something) {
final result = sendPostRequest(something);
}
Now since I didn't do anything with the result, it will cause a unused_local_variable linter
And when I select the "Remove unused local variable" quickfix it will delete the whole send, not just the variable.
Wanted result:
Future _postSomething(var something) {
sendPostRequest(something);
}
Actual result:
Future _postSomething(var something) {
}
Additional Context
The linter deleted some of my app functionality instead of just the variable.
The text was updated successfully, but these errors were encountered: