Skip to content

prefer_void_to_null should not be reported in a Cast Pattern or an As Expression #59089

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 23, 2023 · 1 comment · Fixed by dart-archive/linter#4203 or dart-archive/linter#4208
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-set-recommended type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Milestone

Comments

@srawlins
Copy link
Member

void is not allowed in either:

void f(int a) {
  switch (a) {
    case var _ as void: // compile-time error
  }
  a as void; // compile-time error
}

So prefer_void_to_null should not be reported in those positions.

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) linter-false-positive labels Mar 23, 2023
@pq pq added this to the Dart 3 beta 3 milestone Mar 23, 2023
@pq
Copy link
Member

pq commented Mar 23, 2023

Nice one!

@pq pq self-assigned this Mar 23, 2023
@srawlins srawlins reopened this Mar 23, 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-set-recommended type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
3 participants