| library /*isNonNullableByDefault*/; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/general/stream_future.dart:18:9: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'FutureOr<Class>'. |
| // - 'Future' is from 'dart:async'. |
| // - 'Class' is from 'pkg/front_end/testcases/general/stream_future.dart'. |
| // yield returnFutureDynamic(); |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| |
| import "dart:async"; |
| |
| class Class extends core::Object { |
| synthetic constructor •() → self::Class |
| : super core::Object::•() |
| ; |
| } |
| static method returnDynamic() → dynamic |
| return new self::Class::•(); |
| static method returnClass() → self::Class |
| return new self::Class::•(); |
| static method returnFutureDynamic() → asy::Future<dynamic> async /* futureValueType= dynamic */ |
| return new self::Class::•(); |
| static method returnFutureClass() → asy::Future<self::Class> async /* futureValueType= self::Class */ |
| return new self::Class::•(); |
| static method error() → asy::Stream<FutureOr<self::Class>> async* { |
| yield invalid-expression "pkg/front_end/testcases/general/stream_future.dart:18:9: Error: A value of type 'Future<dynamic>' can't be assigned to a variable of type 'FutureOr<Class>'. |
| - 'Future' is from 'dart:async'. |
| - 'Class' is from 'pkg/front_end/testcases/general/stream_future.dart'. |
| yield returnFutureDynamic(); |
| ^" in self::returnFutureDynamic() as{TypeError,ForNonNullableByDefault} FutureOr<self::Class>; |
| } |
| static method stream() → asy::Stream<FutureOr<self::Class>> async* { |
| yield self::returnDynamic() as{TypeError,ForDynamic,ForNonNullableByDefault} FutureOr<self::Class>; |
| yield self::returnClass(); |
| yield self::returnFutureClass(); |
| } |
| static method main() → dynamic async /* futureValueType= dynamic */ { |
| { |
| asy::Stream<FutureOr<self::Class>> :stream = self::stream(); |
| asy::_StreamIterator<FutureOr<self::Class>>? :for-iterator = new asy::_StreamIterator::•<FutureOr<self::Class>>(:stream); |
| try |
| while (let dynamic #t1 = asy::_asyncStarMoveNextHelper(:stream) in await :for-iterator.{asy::_StreamIterator::moveNext}(){() → asy::Future<core::bool>}) { |
| FutureOr<self::Class>cls = :for-iterator.{asy::_StreamIterator::current}{FutureOr<self::Class>}; |
| { |
| core::print(cls); |
| } |
| } |
| finally |
| if(!(:for-iterator.{asy::_StreamIterator::_subscription}{asy::StreamSubscription<FutureOr<self::Class>>?} == null)) |
| await :for-iterator.{asy::_StreamIterator::cancel}(){() → asy::Future<dynamic>}; |
| } |
| } |