Skip to content
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

False positive with prefer_void_to_null #59179

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
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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 analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. labels Nov 19, 2024
@devoncarew devoncarew transferred this issue from dart-lang/linter Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer-linter Issues with the analyzer's support for the linter package area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. 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

4 participants