Skip to content

False positive with prefer_void_to_null #59179

Open
@eernstg

Description

@eernstg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onarea-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-false-positiveIssues related to lint rules that report a problem when it isn't a problem.linter-set-recommendedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions