Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect

Issue 2949093002: Properly type infer for-in loops when the iterator type is a type parameter. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
new file mode 100644
index 0000000000000000000000000000000000000000..552a3ddd6244d08ed151edf17ea035c22cacf3a8
--- /dev/null
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
@@ -0,0 +1,64 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ field core::int bar = 42;
+ constructor •() → void
+ : super core::Object::•()
+ ;
+}
+class Bar<T extends core::Iterable<core::String>> extends core::Object {
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo(self::Bar::T t) → void {
+ for (core::String i in t) {
+ core::int x = i;
+ }
+ }
+}
+class Baz<T extends core::Object, E extends core::Iterable<self::Baz::T>, S extends self::Baz::E> extends core::Object {
+ constructor •() → void
+ : super core::Object::•()
+ ;
+ method foo(self::Baz::S t) → void {
+ for (self::Baz::T i in t) {
+ core::int x = i;
+ 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 = x;
+ }
+ for (dynamic x in list) {
+ core::String y = x;
+ }
+ for (core::String x in list) {
+ core::String y = x;
+ }
+ dynamic z;
+ for (final dynamic #t1 in list) {
+ z = #t1;
+ core::String y = z;
+ }
+ core::Iterable<dynamic> iter = list;
+ for (self::Foo x in iter) {
+ self::Foo y = x;
+ }
+ dynamic iter2 = list;
+ for (self::Foo x in iter2) {
+ self::Foo y = x;
+ }
+ core::Map<core::String, self::Foo> map = <core::String, self::Foo>{};
+ for (dynamic x in map) {
+ core::String y = x;
+ }
+ for (core::String x in map.{core::Map::keys}) {
+ core::String y = x;
+ }
+}
+static method main() → dynamic {}

Powered by Google App Engine
This is Rietveld 408576698