-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P2A bug or feature request we're likely to work onA 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.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.linter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.linter-set-recommendedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Describe the issue
prefer_contains does not catch type parameters bound to Iterable (or promoted to a bound of Iterable). For example:
To Reproduce
bool typeVariableBoundToList<T extends List<int>>(T list) =>
list.indexOf(1) < 0; // LINT
bool typeVariablePromotedToList<T>(T list) =>
list is List<int> && list.indexOf(1) < 0; // LINT
Expected behavior
Each of these should be reported.
Additional context
The recent typeForInterfaceCheck
extension method on DartType should help. only_throw_errors needed a similar fix.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA 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.For issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.linter-false-negativeIssues related to lint rules that fail to report a problem.Issues related to lint rules that fail to report a problem.linter-set-recommendedtype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)Incorrect behavior (everything from a crash to more subtle misbehavior)