| library; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/regress/issue_37681.dart:6:7: Error: Functions marked 'async' must have a return type assignable to 'Future'. |
| // int f_async() async { return 42; } |
| // ^^^^^^^ |
| // |
| // pkg/front_end/testcases/regress/issue_37681.dart:9:7: Error: Functions marked 'async*' must have a return type assignable to 'Stream'. |
| // int f_async_star() async* { yield 42; } |
| // ^^^^^^^^^^^^ |
| // |
| // pkg/front_end/testcases/regress/issue_37681.dart:14:7: Error: Functions marked 'sync*' must have a return type assignable to 'Iterable'. |
| // int f_sync_star() sync* { yield 42; } |
| // ^^^^^^^^^^^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| |
| static method main() → dynamic async /* emittedValueType= dynamic */ { |
| function f_async() → core::int async /* emittedValueType= core::Object? */ { |
| return 42; |
| } |
| core::print(await f_async(){() → core::int} /* runtimeCheckType= asy::Future<core::int> */ ); |
| function f_async_star() → core::int async* /* emittedValueType= dynamic */ { |
| yield 42; |
| } |
| { |
| synthesized asy::Stream<dynamic> :stream = (f_async_star(){() → core::int} as dynamic) as{TypeError,ForDynamic} asy::Stream<dynamic>; |
| synthesized asy::_StreamIterator<dynamic>? :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream); |
| try |
| while (let dynamic #t1 = asy::_asyncStarMoveNextHelper(:stream) in await :for-iterator.{asy::_StreamIterator::moveNext}(){() → asy::Future<core::bool>}) { |
| dynamic x = :for-iterator.{asy::_StreamIterator::current}{dynamic}; |
| { |
| core::print(x); |
| } |
| } |
| finally |
| if(!(:for-iterator.{asy::_StreamIterator::_subscription}{asy::StreamSubscription<dynamic>?} == null)) |
| await :for-iterator.{asy::_StreamIterator::cancel}(){() → asy::Future<dynamic>}; |
| } |
| function f_sync_star() → core::int sync* /* emittedValueType= dynamic */ { |
| yield 42; |
| } |
| { |
| synthesized core::Iterator<dynamic> :sync-for-iterator = ((f_sync_star(){() → core::int} as dynamic) as{TypeError,ForDynamic} core::Iterable<dynamic>).{core::Iterable::iterator}{core::Iterator<dynamic>}; |
| for (; :sync-for-iterator.{core::Iterator::moveNext}(){() → core::bool}; ) { |
| dynamic x = :sync-for-iterator.{core::Iterator::current}{dynamic}; |
| { |
| core::print(x); |
| } |
| } |
| } |
| } |