Skip to content

Commit 1dd0f88

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Don't allow null as argument to StreamIterator constructor.
Change-Id: I10c8de2cd12660876908f719ee562006cd3f2c07 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/98001 Commit-Queue: Lasse R.H. Nielsen <lrn@google.com> Reviewed-by: Leaf Petersen <leafp@google.com>
1 parent 9cf5e51 commit 1dd0f88

4 files changed

Lines changed: 14 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
### Core library changes
66

7+
#### `dart:async`
8+
* BREAKING CHANGE:
9+
Fixes bug in `StreamIterator` which allowed constructor argument to be `null`.
10+
Also allowed `await for` on a `null` stream. This is now a runtime error.
11+
712
#### `dart:core`
813

914
* **Breaking change**: The `RegExp` interface has been extended with two new
@@ -27,6 +32,11 @@
2732
This change only affects implementers of the `RegExp` interface; current
2833
code using Dart regular expressions will not be affected.
2934

35+
#### `dart:isolate`
36+
37+
* BREAKING CHANGE: The `await for` allowed `null` as a stream due to a bug
38+
in `StreamIterator` class. This bug has now been fixed.
39+
3040
## 2.3.0
3141

3242
The focus in this release is on the new "UI-as-code" language features which

pkg/front_end/testcases/legacy.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ incomplete_field_formal_parameter: Fail # Fasta doesn't recover well
2020
inference/bug31436: RuntimeError # Test exercises Dart 2.0 semantics
2121
inference/constructors_too_many_positional_arguments: Fail
2222
inference/downwards_inference_annotations_locals: Fail # Issue #30031
23+
inference/downwards_inference_for_each: RuntimeError # Issue #36382
2324
inference/future_then_explicit_future: RuntimeError
2425
inference/generic_methods_infer_js_builtin: RuntimeError # Test attempts to access platform-private library leading to NSM.
2526
inference/infer_assign_to_index: Fail

pkg/front_end/testcases/strong.status

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ inference/constructors_infer_from_arguments_argument_not_assignable: TypeCheckEr
3333
inference/constructors_too_many_positional_arguments: InstrumentationMismatch # Issue #30040
3434
inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer: TypeCheckError
3535
inference/downwards_inference_annotations_type_variable: InstrumentationMismatch # Issue 28981
36+
inference/downwards_inference_for_each: RuntimeError # Issue #36382
3637
inference/downwards_inference_on_function_of_t_using_the_t: InstrumentationMismatch # Issue #29798
3738
inference/downwards_inference_on_list_literals_infer_downwards: RuntimeError
3839
inference/future_then_explicit_future: InstrumentationMismatch # Issue #30040

sdk/lib/async/stream_impl.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,8 @@ class _StreamIterator<T> implements StreamIterator<T> {
967967
/// completed.
968968
bool _isPaused = false;
969969

970-
_StreamIterator(final Stream<T> stream) : _stateData = stream;
970+
_StreamIterator(final Stream<T> stream)
971+
: _stateData = stream ?? (throw ArgumentError.notNull("stream"));
971972

972973
T get current {
973974
if (_subscription != null && _isPaused) {

0 commit comments

Comments
 (0)