Skip to content

prefer_final_parameters should not flag params used in destructured patterns #59073

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

Closed
srawlins opened this issue Mar 16, 2023 · 3 comments
Closed
Assignees
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-false-positive linter-new-language-feature P2 A bug or feature request we're likely to work on
Milestone

Comments

@srawlins
Copy link
Member

Child issue of #58837 I suppose.

I think there should be a test case like:

void f(int two) {
  var list = [1, 2, 3];
  var [_, two, _] = list;
}

in which the lint rule would not report that final should be preferred for two.

@pq
Copy link
Member

pq commented Mar 20, 2023

Nice catch!

@pq pq self-assigned this Mar 20, 2023
@pq pq changed the title prefer_final_parameters tests should include variable patterns prefer_final_parameters should not flag params used in destructured patterns Mar 20, 2023
@pq pq added the P2 A bug or feature request we're likely to work on label Mar 20, 2023
@pq
Copy link
Member

pq commented Mar 20, 2023

See: https://dart-review.googlesource.com/c/sdk/+/289884

@pq
Copy link
Member

pq commented Mar 22, 2023

Fixed as of dart-archive/linter#4188.

@pq pq closed this as completed Mar 22, 2023
@devoncarew devoncarew added devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-archive/linter Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-false-positive linter-new-language-feature P2 A bug or feature request we're likely to work on
Projects
None yet
Development

No branches or pull requests

3 participants