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 #4444

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

False positive with prefer_void_to_null #4444

eernstg opened this issue Jun 8, 2023 · 1 comment
Labels
false-positive P2 A bug or feature request we're likely to work on set-recommended Affects a rule in the recommended Dart rule set 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.

@github-actions github-actions bot added the set-recommended Affects a rule in the recommended Dart rule set label Jun 8, 2023
@pq pq added 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
false-positive P2 A bug or feature request we're likely to work on set-recommended Affects a rule in the recommended Dart rule set type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants