Skip to content

fix: quickfix deletes active functionality when removing unused variable #60663

Closed
@GuilhermeConstantino

Description

@GuilhermeConstantino

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-quick-fixIssues with analysis server (quick) fixestype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions