mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
478602ad79
Previously, when completing a future with another future, we always chained to the other future. This effectively awaits the latter future and then completes the former with its result. This is incorrect behavior if the former future is, say, a `Future<Future<int>>` and the latter is a `Future<int>`. In that case we *must not* await the latter future because we can't complete the former future with an `int`. We should just complete the future directly with the latter future as a value. We now check first whether to chain a `Future<T>` to another future, and only does so if the latter future is a `Future<T>` (or it's not a `T`, which shouldn't happen, but currently does in some places). Add test for behavior. Change-Id: I57e27111c2fc7b7792dcf4ae9b7c1d5d504d0c0f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/53602 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Nate Bosch <nbosch@google.com> Reviewed-by: Erik Ernst <eernst@google.com> |
||
---|---|---|
.. | ||
analyzer | ||
async | ||
collection | ||
convert | ||
developer | ||
html | ||
isolate | ||
js | ||
math | ||
mirrors | ||
typed_data | ||
wasm | ||
web | ||
analysis_options.yaml | ||
lib.status | ||
lib_analyzer.status | ||
lib_app_jit.status | ||
lib_dart2js.status | ||
lib_dartdevc.status | ||
lib_kernel.status | ||
lib_precompiled.status | ||
lib_vm.status |