| library test; |
| // |
| // Problems in library: |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:17:44: Error: A value of type 'String' can't be assigned to a variable of type 'int'. |
| // Try changing the type of the left hand side, or casting the right hand side to 'int'. |
| // int x = /*error:INVALID_ASSIGNMENT*/ i; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:25:44: Error: A value of type 'T' can't be assigned to a variable of type 'int'. |
| // Try changing the type of the left hand side, or casting the right hand side to 'int'. |
| // int x = /*error:INVALID_ASSIGNMENT*/ i; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:38:45: Error: A value of type 'Foo' can't be assigned to a variable of type 'String'. |
| // - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| // Try changing the type of the left hand side, or casting the right hand side to 'String'. |
| // String y = /*error:INVALID_ASSIGNMENT*/ x; |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'Foo' can't be assigned to a variable of type 'String'. |
| // - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| // Try changing the type of the variable. |
| // await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) { |
| // ^ |
| // |
| // pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'Map<String, Foo>' used in the 'for' loop must implement 'Stream<dynamic>'. |
| // - 'Map' is from 'dart:core'. |
| // - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| // - 'Stream' is from 'dart:async'. |
| // await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) { |
| // ^ |
| // |
| import self as self; |
| import "dart:core" as core; |
| import "dart:async" as asy; |
| |
| import "dart:async"; |
| |
| class Foo extends core::Object { |
| field core::int bar = 42; |
| synthetic constructor •() → self::Foo |
| : super core::Object::•() |
| ; |
| } |
| class Bar<T extends asy::Stream<core::String> = asy::Stream<core::String>> extends core::Object { |
| synthetic constructor •() → self::Bar<self::Bar::T> |
| : super core::Object::•() |
| ; |
| method foo(generic-covariant-impl self::Bar::T t) → dynamic /* originally async */ { |
| final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>(); |
| asy::FutureOr<dynamic> :return_value; |
| dynamic :async_stack_trace; |
| dynamic :async_op_then; |
| dynamic :async_op_error; |
| dynamic :await_jump_var = 0; |
| dynamic :await_ctx_var; |
| dynamic :saved_try_context_var0; |
| dynamic :saved_try_context_var1; |
| dynamic :exception0; |
| dynamic :stack_trace0; |
| function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding |
| try { |
| #L1: |
| { |
| { |
| dynamic :stream = t; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<core::String> :for-iterator = new asy::_StreamIterator::•<core::String>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L2: |
| while (true) { |
| dynamic #t1 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t2 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| core::String i = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::int x = let final<BottomType> #t3 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:17:44: Error: A value of type 'String' can't be assigned to a variable of type 'int'. |
| Try changing the type of the left hand side, or casting the right hand side to 'int'. |
| int x = /*error:INVALID_ASSIGNMENT*/ i; |
| ^" in i as{TypeError} core::int; |
| } |
| } |
| else |
| break #L2; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t4 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| } |
| asy::_completeOnAsyncReturn(:async_completer, :return_value); |
| return; |
| } |
| on dynamic catch(dynamic :exception, dynamic :stack_trace) { |
| :async_completer.{asy::Completer::completeError}(:exception, :stack_trace); |
| } |
| :async_stack_trace = asy::_asyncStackTraceHelper(:async_op); |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_completer.start(:async_op); |
| return :async_completer.{asy::Completer::future}; |
| } |
| } |
| class Baz<T extends core::Object = dynamic, E extends asy::Stream<self::Baz::T> = asy::Stream<dynamic>, S extends self::Baz::E = asy::Stream<dynamic>> extends core::Object { |
| synthetic constructor •() → self::Baz<self::Baz::T, self::Baz::E, self::Baz::S> |
| : super core::Object::•() |
| ; |
| method foo(generic-covariant-impl self::Baz::S t) → dynamic /* originally async */ { |
| final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>(); |
| asy::FutureOr<dynamic> :return_value; |
| dynamic :async_stack_trace; |
| dynamic :async_op_then; |
| dynamic :async_op_error; |
| dynamic :await_jump_var = 0; |
| dynamic :await_ctx_var; |
| dynamic :saved_try_context_var0; |
| dynamic :saved_try_context_var1; |
| dynamic :exception0; |
| dynamic :stack_trace0; |
| function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding |
| try { |
| #L3: |
| { |
| { |
| dynamic :stream = t; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<self::Baz::T> :for-iterator = new asy::_StreamIterator::•<self::Baz::T>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L4: |
| while (true) { |
| dynamic #t5 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t6 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| self::Baz::T i = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::int x = let final<BottomType> #t7 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:25:44: Error: A value of type 'T' can't be assigned to a variable of type 'int'. |
| Try changing the type of the left hand side, or casting the right hand side to 'int'. |
| int x = /*error:INVALID_ASSIGNMENT*/ i; |
| ^" in i as{TypeError} core::int; |
| self::Baz::T y = i; |
| } |
| } |
| else |
| break #L4; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t8 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| } |
| asy::_completeOnAsyncReturn(:async_completer, :return_value); |
| return; |
| } |
| on dynamic catch(dynamic :exception, dynamic :stack_trace) { |
| :async_completer.{asy::Completer::completeError}(:exception, :stack_trace); |
| } |
| :async_stack_trace = asy::_asyncStackTraceHelper(:async_op); |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_completer.start(:async_op); |
| return :async_completer.{asy::Completer::future}; |
| } |
| } |
| abstract class MyStream<T extends core::Object = dynamic> extends asy::Stream<self::MyStream::T> { |
| static factory •<T extends core::Object = dynamic>() → self::MyStream<self::MyStream::•::T> |
| return null; |
| } |
| static method test() → dynamic /* originally async */ { |
| final asy::_AsyncAwaitCompleter<dynamic> :async_completer = new asy::_AsyncAwaitCompleter::•<dynamic>(); |
| asy::FutureOr<dynamic> :return_value; |
| dynamic :async_stack_trace; |
| dynamic :async_op_then; |
| dynamic :async_op_error; |
| dynamic :await_jump_var = 0; |
| dynamic :await_ctx_var; |
| dynamic :saved_try_context_var0; |
| dynamic :saved_try_context_var1; |
| dynamic :exception0; |
| dynamic :stack_trace0; |
| function :async_op([dynamic :result, dynamic :exception, dynamic :stack_trace]) → dynamic yielding |
| try { |
| #L5: |
| { |
| self::MyStream<self::Foo> myStream = self::MyStream::•<self::Foo>(); |
| { |
| dynamic :stream = myStream; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L6: |
| while (true) { |
| dynamic #t9 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t10 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| self::Foo x = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::String y = let final<BottomType> #t11 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:38:45: Error: A value of type 'Foo' can't be assigned to a variable of type 'String'. |
| - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| Try changing the type of the left hand side, or casting the right hand side to 'String'. |
| String y = /*error:INVALID_ASSIGNMENT*/ x; |
| ^" in x as{TypeError} core::String; |
| } |
| } |
| else |
| break #L6; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t12 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| { |
| dynamic :stream = myStream; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L7: |
| while (true) { |
| dynamic #t13 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t14 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| dynamic x = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::String y = x as{TypeError} core::String; |
| } |
| } |
| else |
| break #L7; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t15 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| { |
| dynamic :stream = myStream; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L8: |
| while (true) { |
| dynamic #t16 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t17 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| final self::Foo #t18 = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::String x = let final<BottomType> #t19 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'Foo' can't be assigned to a variable of type 'String'. |
| - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| Try changing the type of the variable. |
| await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) { |
| ^" in #t18 as{TypeError} core::String; |
| core::String y = x; |
| } |
| } |
| else |
| break #L8; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t20 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| dynamic z; |
| { |
| dynamic :stream = myStream; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L9: |
| while (true) { |
| dynamic #t21 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t22 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| final self::Foo #t23 = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| z = #t23; |
| core::String y = z as{TypeError} core::String; |
| } |
| } |
| else |
| break #L9; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t24 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| asy::Stream<dynamic> stream = myStream; |
| { |
| dynamic :stream = stream; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L10: |
| while (true) { |
| dynamic #t25 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t26 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| final dynamic #t27 = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| self::Foo x = #t27 as{TypeError} self::Foo; |
| self::Foo y = x; |
| } |
| } |
| else |
| break #L10; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t28 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| dynamic stream2 = myStream; |
| { |
| dynamic :stream = stream2 as{TypeError} asy::Stream<dynamic>; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L11: |
| while (true) { |
| dynamic #t29 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t30 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| final dynamic #t31 = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| self::Foo x = #t31 as{TypeError} self::Foo; |
| self::Foo y = x; |
| } |
| } |
| else |
| break #L11; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t32 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| core::Map<core::String, self::Foo> map = <core::String, self::Foo>{}; |
| { |
| dynamic :stream = let final<BottomType> #t33 = invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'Map<String, Foo>' used in the 'for' loop must implement 'Stream<dynamic>'. |
| - 'Map' is from 'dart:core'. |
| - 'Foo' is from 'pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart'. |
| - 'Stream' is from 'dart:async'. |
| await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) { |
| ^" in map as{TypeError} asy::Stream<dynamic>; |
| asy::_asyncStarListenHelper(:stream, :async_op); |
| asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(:stream); |
| const core::bool :product-mode = const core::bool::fromEnvironment("dart.vm.product"); |
| try |
| #L12: |
| while (true) { |
| dynamic #t34 = :product-mode ?{dynamic} null : asy::_asyncStarMoveNextHelper(:stream); |
| [yield] let dynamic #t35 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null; |
| if(:result) { |
| dynamic x = :for-iterator.{asy::_StreamIterator::current}; |
| { |
| core::String y = x as{TypeError} core::String; |
| } |
| } |
| else |
| break #L12; |
| } |
| finally |
| if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) { |
| [yield] let dynamic #t36 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null; |
| :result; |
| } |
| } |
| } |
| asy::_completeOnAsyncReturn(:async_completer, :return_value); |
| return; |
| } |
| on dynamic catch(dynamic :exception, dynamic :stack_trace) { |
| :async_completer.{asy::Completer::completeError}(:exception, :stack_trace); |
| } |
| :async_stack_trace = asy::_asyncStackTraceHelper(:async_op); |
| :async_op_then = asy::_asyncThenWrapperHelper(:async_op); |
| :async_op_error = asy::_asyncErrorWrapperHelper(:async_op); |
| :async_completer.start(:async_op); |
| return :async_completer.{asy::Completer::future}; |
| } |
| static method main() → dynamic {} |