40e18905f2
Closes https://github.com/dart-lang/sdk/pull/49478 TEST=Manual GitOrigin-RevId: f4c9c6869dfe73639295e86574a021523b3d374d Change-Id: I134a97caed4eec59d70e9cbca16b7e9a472cf2c1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251902 Reviewed-by: Michael Thomsen <mit@google.com> Commit-Queue: Alexander Thomas <athom@google.com> Reviewed-by: Aske Simon Christensen <askesc@google.com> Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com> Reviewed-by: Alexander Thomas <athom@google.com>
22 lines
594 B
Dart
22 lines
594 B
Dart
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:async';
|
|
|
|
import 'package:expect/expect.dart';
|
|
|
|
late StreamSubscription sub;
|
|
|
|
main() async {
|
|
sub = foo().listen((_) => throw 'unexpected item');
|
|
}
|
|
|
|
Stream<int> foo() async* {
|
|
// While the generator (i.e. this function) runs, we cancel the consumer and
|
|
// try to yield more.
|
|
sub.cancel();
|
|
yield* Stream.fromIterable([1, 2, 3]);
|
|
throw 'should not run';
|
|
}
|