-
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.devexp-linterIssues with the analyzer's support for the linter packageIssues 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.Issues 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)Incorrect behavior (everything from a crash to more subtle misbehavior)
Description
Describe the issue
abstract class Data {}
abstract class DataHolder<T extends Data?> {
const DataHolder({required this.data});
final T? data;
bool isNullable() => null is T;
}
class FooData extends Data {}
class FooHolder extends DataHolder<FooData> {
FooHolder({required super.data});
}
// prefer_void_to_null: Don't use the Null type, unless you are positive that you don't want void.
class ExplicitNullHolder extends DataHolder<Null> {
ExplicitNullHolder() : super(data: null);
}
class ImplicitNullHolder extends DataHolder {
ImplicitNullHolder() : super(data: null);
}
void main() {
print(FooHolder(data: FooData()).isNullable()); // false
print(ExplicitNullHolder().isNullable()); // true
print(ImplicitNullHolder().isNullable()); // true
}Expected behavior
Using explicit Null shouldn't trigger prefer_void_to_null lint rule.
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.devexp-linterIssues with the analyzer's support for the linter packageIssues 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.Issues 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)Incorrect behavior (everything from a crash to more subtle misbehavior)