-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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-pkg-metaIssues related to package:metaIssues related to package:metatype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug
Description
Dart currently lets us write
T someFunc<T extends Object>(T Function() f) {...}
I repeatedly make the mistake of passing Future<T> Function()
to a function that expects T Function()
. These mistakes often cause runtime errors. I wish to prevent such errors with a type constraint that means "T does not extend Future". Proposed syntax:
T someFunc<T extends Object + !Future>(T Function() f) {...}
A linter warning would also solve the problem.
Metadata
Metadata
Assignees
Labels
P3A lower priority bug or feature requestA lower priority bug or feature requestarea-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-pkg-metaIssues related to package:metaIssues related to package:metatype-enhancementA request for a change that isn't a bugA request for a change that isn't a bug