Forward drain argument through after .take(0)

Fixes #30305

Change-Id: I7a30cee3e9a406e99f5d714a201b031c428a12e8
Reviewed-on: https://dart-review.googlesource.com/74015
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
This commit is contained in:
Nate Bosch 2018-09-11 11:07:01 +00:00 committed by commit-bot@chromium.org
parent bf68afbaa9
commit 3c4a86c709
3 changed files with 9 additions and 1 deletions

View file

@ -21,6 +21,11 @@
succeed.
* Exported `Future` and `Stream` from `dart:core`.
#### `dart:async`
* Fix a bug where calling `stream.take(0).drain(value)` would not correctly
forward the `value` through the returned `Future`.
## 2.1.0-dev.3.0
### Core library changes

View file

@ -766,7 +766,7 @@ class _DoneStreamSubscription<T> implements StreamSubscription<T> {
Future<E> asFuture<E>([E futureValue]) {
_Future<E> result = new _Future<E>();
_onDone = () {
result._completeWithValue(null);
result._completeWithValue(futureValue);
};
return result;
}

View file

@ -61,6 +61,9 @@ tests() async {
Expect.listEquals([], await makeStream(5).take(0).toList());
Expect.listEquals([], await makeStream(0).take(0).toList());
// Regression for https://github.com/dart-lang/sdk/issues/30305
Expect.equals('result', await makeStream(5).take(0).drain('result'));
}
Future expectThrowsAsync(Future computation, String name) {