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

Side by Side Diff: pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart

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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 /*@testedFeatures=inference*/ 5 /*@testedFeatures=inference*/
6 library test; 6 library test;
7 7
8 class Foo { 8 class Foo {
9 int bar = 42; 9 int bar = 42;
10 } 10 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) { 60 for (var /*@type=dynamic*/ x in /*error:FOR_IN_OF_INVALID_TYPE*/ map) {
61 String y = /*info:DYNAMIC_CAST*/ x; 61 String y = /*info:DYNAMIC_CAST*/ x;
62 } 62 }
63 63
64 // We're not properly inferring that map.keys is an Iterable<String> 64 // We're not properly inferring that map.keys is an Iterable<String>
65 // and that x is a String. 65 // and that x is a String.
66 for (var /*@type=String*/ x in map. /*@target=Map::keys*/ keys) { 66 for (var /*@type=String*/ x in map. /*@target=Map::keys*/ keys) {
67 String y = x; 67 String y = x;
68 } 68 }
69 } 69 }
70
71 main() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698