Skip to content

False positive with prefer_void_to_null #59179

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
eernstg opened this issue Jun 8, 2023 · 1 comment
Open

False positive with prefer_void_to_null #59179

eernstg opened this issue Jun 8, 2023 · 1 comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-false-positive linter-set-recommended P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Jun 8, 2023

Consider the following program:

void main() {
  List<(int?, int?)> xs = <(Null, int)>[];
}

This program causes the lint prefer_void_to_null to flag the use of the type Null, and it is suggested that it should be replaced by void.

This is a false positive: List<(void, int)> is not a subtype of List<(int?, int?)> and hence the suggested change would turn the program into a compile-time error.

The expected behavior would be that this occurrence of Null is not linted.

@pq pq added linter-false-positive P2 A bug or feature request we're likely to work on labels Jun 8, 2023
@pq
Copy link
Member

pq commented Jun 8, 2023

Thanks!

@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Apr 3, 2024
@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
@bwilkerson bwilkerson added area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. and removed legacy-area-analyzer Use area-devexp instead. labels Feb 21, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
area-devexp For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages. devexp-linter Issues with the analyzer's support for the linter package linter-false-positive linter-set-recommended P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

5 participants