Skip to content

update unnecessary_const to not flag consts in case expressions (required for patterns migration) #59029

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
Tracked by #58837
pq opened this issue Feb 6, 2023 · 1 comment · Fixed by dart-archive/linter#4050
Assignees
Labels
devexp-linter Issues with the analyzer's support for the linter package legacy-area-analyzer Use area-devexp instead. linter-new-language-feature linter-set-recommended P1 A high priority bug; for example, a single project is unusable or has many test failures
Milestone

Comments

@pq
Copy link
Member

pq commented Feb 6, 2023

More context in https://github.com/dart-lang/linter/issues/4044.

TL;DR some fixes to support safe 3.0 migration will get flagged as having unnecessary_consts.

case const [1, 2]:
case const {'k': 'v'}:
case const {1, 2}:
case const Point(1, 2):

(but shouldn't.)

@pq pq added linter-new-language-feature P1 A high priority bug; for example, a single project is unusable or has many test failures labels Feb 6, 2023
@pq pq added this to the Dart 3 beta 2 milestone Feb 6, 2023
@pq pq self-assigned this Feb 6, 2023
@bwilkerson
Copy link
Member

They definitely shouldn't get flagged in 3.0 code, but it isn't clear to me that the lint should stop flagging those cases in pre-3.0 code. (That might be what you meant, but it wasn't super clear.)

@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-new-language-feature linter-set-recommended P1 A high priority bug; for example, a single project is unusable or has many test failures
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants