blob: 46005fa99aa401a3169894e59a62c8ee8af4bcbf [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;
default constructor •() void
: super core::Object::•()
;
}
class Bar<T extends asy::Stream<core::String>> extends core::Object {
default constructor •() void
: super core::Object::•()
;
method foo(generic-covariant-impl generic-covariant-interface self::Bar::T t) dynamic async {
await for (core::String i in t) {
core::int x = let final dynamic #t1 = i in let dynamic _ = 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'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.\n int x = /*error:INVALID_ASSIGNMENT*/ i;\n ^";
}
}
}
class Baz<T extends core::Object, E extends asy::Stream<self::Baz::T>, S extends self::Baz::E> extends core::Object {
default constructor •() void
: super core::Object::•()
;
method foo(generic-covariant-impl generic-covariant-interface self::Baz::S t) dynamic async {
await for (self::Baz::T i in t) {
core::int x = let final dynamic #t2 = i in let dynamic _ = 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'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.\n int x = /*error:INVALID_ASSIGNMENT*/ i;\n ^";
self::Baz::T y = i;
}
}
}
abstract class MyStream<T extends core::Object> extends asy::Stream<self::MyStream::T> {
static factory •<T extends core::Object>() self::MyStream<self::MyStream::•::T>
return null;
}
static method test() dynamic async {
self::MyStream<self::Foo> myStream = self::MyStream::•<self::Foo>();
await for (self::Foo x in myStream) {
core::String y = let final dynamic #t3 = x in let dynamic _ = 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'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n String y = /*error:INVALID_ASSIGNMENT*/ x;\n ^";
}
await for (dynamic x in myStream) {
core::String y = x as{TypeError} core::String;
}
await for (final self::Foo #t4 in myStream) {
core::String x = let final dynamic #t5 = #t4 in let dynamic _ = 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'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.core::String'.\n await for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ myStream) {\n ^";
core::String y = x;
}
dynamic z;
await for (final self::Foo #t6 in myStream) {
z = #t6;
core::String y = z as{TypeError} core::String;
}
asy::Stream<dynamic> stream = myStream;
await for (final dynamic #t7 in stream) {
self::Foo x = #t7 as{TypeError} self::Foo;
self::Foo y = x;
}
dynamic stream2 = myStream;
await for (final dynamic #t8 in stream2 as{TypeError} asy::Stream<dynamic>) {
self::Foo x = #t8 as{TypeError} self::Foo;
self::Foo y = x;
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
await for (dynamic x in let final dynamic #t9 = map in let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:66:74: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.async::Stream<dynamic>'.\nTry changing the type of the left hand side, or casting the right hand side to 'dart.async::Stream<dynamic>'.\n await for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {\n ^") {
core::String y = x as{TypeError} core::String;
}
}
static method main() dynamic {}