Handle implicit future unions in downwards inference #25322
Labels
area-analyzer
Use area-analyzer for Dart analyzer issues, including the analysis server and code completion.
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
Various context in Dart essentially treat
Future<T>
as an implicit union typeFuture<T> | T
. For example,await
allows either:Downwards inference currently only considers the
Future<int>
possibility here, and hence will infer type parameters for theFuture
creation and the list literal in the secondawait
, but not for the list literal in the firstawait
. It would be useful to support both.Other examples of this include the return value for the lambda argument to
Future.then
, and values returned from async functions:The text was updated successfully, but these errors were encountered: