blob: 4b7c3128a4f09c6428cf887d16c7f3306c043675 [file] [log] [blame]
library test;
import self as self;
import "dart:core" as core;
class Foo extends core::Object {
field core::int bar = 42;
synthetic constructor •() void
: super core::Object::•()
;
}
class Bar<T extends core::Iterable<core::String> = core::Iterable<core::String>> extends core::Object {
synthetic constructor •() void
: super core::Object::•()
;
method foo(generic-covariant-impl self::Bar::T t) void {
for (core::String i in t) {
core::int x = let dynamic _ = null in let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:15: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 dynamic #t2 = i in null;
}
}
}
class Baz<T extends core::Object = dynamic, E extends core::Iterable<self::Baz::T> = core::Iterable<dynamic>, S extends self::Baz::E = core::Iterable<dynamic>> extends core::Object {
synthetic constructor •() → void
: super core::Object::•()
;
method foo(generic-covariant-impl self::Baz::S t) → void {
for (self::Baz::T i in t) {
core::int x = let dynamic _ = null in let final dynamic #t3 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:23: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 dynamic #t4 = i in null;
self::Baz::T y = i;
}
}
}
static method test() → dynamic {
core::List<self::Foo> list = <self::Foo>[];
for (self::Foo x in list) {
core::String y = let dynamic _ = null in let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:32: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 dynamic #t6 = x in null;
}
for (dynamic x in list) {
core::String y = x as{TypeError} core::String;
}
for (final self::Foo #t7 in list) {
core::String x = let dynamic _ = null in let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:39:15: 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'.
for (String x in /*error:FOR_IN_OF_INVALID_ELEMENT_TYPE*/ list) {
^" in let final dynamic #t9 = #t7 in null;
core::String y = x;
}
dynamic z;
for (final self::Foo #t10 in list) {
z = #t10;
core::String y = z as{TypeError} core::String;
}
core::Iterable<dynamic> iter = list;
for (final dynamic #t11 in iter) {
self::Foo x = #t11 as{TypeError} self::Foo;
self::Foo y = x;
}
dynamic iter2 = list;
for (final dynamic #t12 in iter2 as{TypeError} core::Iterable<dynamic>) {
self::Foo x = #t12 as{TypeError} self::Foo;
self::Foo y = x;
}
core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
for (dynamic x in let dynamic _ = null in let final dynamic #t13 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:60:68: Error: A value of type 'dart.core::Map<dart.core::String, test::Foo>' can't be assigned to a variable of type 'dart.core::Iterable<dynamic>'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::Iterable<dynamic>'.
for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
^" in let final dynamic #t14 = map in null) {
core::String y = x as{TypeError} core::String;
}
for (core::String x in map.{core::Map::keys}) {
core::String y = x;
}
}
static method main() → dynamic {}