blob: a3426db185eec6c0d8017b2ff2cafb586ff129c5 [file] [log] [blame]
library test;
import self as self;
import "dart:core" as core;
import "dart:async" as asy;
class Foo extends core::Object {
field core::int bar = 42;
synthetic constructor •() → void
: super core::Object::•()
;
}
class Bar<T extends asy::Stream<core::String> = asy::Stream<core::String>> extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
method foo(generic-covariant-impl self::Bar::T t) → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<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:
{
{
asy::_StreamIterator<core::String> :for-iterator = new asy::_StreamIterator::•<core::String>(t);
try
#L2:
while (true) {
[yield] let dynamic #t1 = 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<BottomType> _ = null in let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:17:44: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
int x = /*error:INVALID_ASSIGNMENT*/ i;
^" in let final core::String #t3 = i in null;
}
}
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);
asy::Future::microtask<dynamic>(: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 •() → void
: super core::Object::•()
;
method foo(generic-covariant-impl self::Baz::S t) → dynamic /* originally async */ {
final asy::Completer<dynamic> :async_completer = asy::Completer::sync<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:
{
{
asy::_StreamIterator<self::Baz::T> :for-iterator = new asy::_StreamIterator::•<self::Baz::T>(t);
try
#L4:
while (true) {
[yield] let dynamic #t5 = 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<BottomType> _ = null in let final dynamic #t6 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:25:44: Error: A value of type 'test::Baz::T' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
int x = /*error:INVALID_ASSIGNMENT*/ i;
^" in let final self::Baz::T #t7 = i in null;
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);
asy::Future::microtask<dynamic>(: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::Completer<dynamic> :async_completer = asy::Completer::sync<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>();
{
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(myStream);
try
#L6:
while (true) {
[yield] let dynamic #t9 = 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<BottomType> _ = null in let final dynamic #t10 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:38:45: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.
String y = /*error:INVALID_ASSIGNMENT*/ x;
^" in let final self::Foo #t11 = x in null;
}
}
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;
}
}
{
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(myStream);
try
#L7:
while (true) {
[yield] let dynamic #t13 = 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 #t14 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
:result;
}
}
{
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(myStream);
try
#L8:
while (true) {
[yield] let dynamic #t15 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
if(:result) {
final self::Foo #t16 = :for-iterator.{asy::_StreamIterator::current};
{
core::String x = let<BottomType> _ = null in let final dynamic #t17 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:45:21: Error: A value of type 'test::Foo' can't be assigned to a variable of type 'dart.core::String'.
Try changing the type of the variable.
await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) {
^" in let final self::Foo #t18 = #t16 in null;
core::String y = x;
}
}
else
break #L8;
}
finally
if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
[yield] let dynamic #t19 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
:result;
}
}
dynamic z;
{
asy::_StreamIterator<self::Foo> :for-iterator = new asy::_StreamIterator::•<self::Foo>(myStream);
try
#L9:
while (true) {
[yield] let dynamic #t20 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
if(:result) {
final self::Foo #t21 = :for-iterator.{asy::_StreamIterator::current};
{
z = #t21;
core::String y = z as{TypeError} core::String;
}
}
else
break #L9;
}
finally
if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
[yield] let dynamic #t22 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
:result;
}
}
asy::Stream<dynamic> stream = myStream;
{
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(stream);
try
#L10:
while (true) {
[yield] let dynamic #t23 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::moveNext}(), :async_op_then, :async_op_error, :async_op) in null;
if(:result) {
final dynamic #t24 = :for-iterator.{asy::_StreamIterator::current};
{
self::Foo x = #t24 as{TypeError} self::Foo;
self::Foo y = x;
}
}
else
break #L10;
}
finally
if(!:for-iterator.{asy::_StreamIterator::_subscription}.{core::Object::==}(null)) {
[yield] let dynamic #t25 = asy::_awaitHelper(:for-iterator.{asy::_StreamIterator::cancel}(), :async_op_then, :async_op_error, :async_op) in null;
:result;
}
}
dynamic stream2 = myStream;
{
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(stream2 as{TypeError} asy::Stream<dynamic>);
try
#L11:
while (true) {
[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 #L11;
}
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;
}
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
{
asy::_StreamIterator<dynamic> :for-iterator = new asy::_StreamIterator::•<dynamic>(let<BottomType> _ = null in let final dynamic #t29 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: The type 'dart.core::Map<dart.core::String, test::Foo>' used in the 'for' loop must implement 'dart.async::Stream<dynamic>'.
await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final core::Map<core::String, self::Foo> #t30 = map in null);
try
#L12:
while (true) {
[yield] let dynamic #t31 = 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 #t32 = 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);
asy::Future::microtask<dynamic>(:async_op);
return :async_completer.{asy::Completer::future};
}
static method main() → dynamic {}