Chromium Code Reviews| Index: test/checker/inferred_type_test.dart |
| diff --git a/test/checker/inferred_type_test.dart b/test/checker/inferred_type_test.dart |
| index 12bcec6028d79c5ff19198a95a279fee9020fee4..757204e8a28a4862c93b922247622945e93713ef 100644 |
| --- a/test/checker/inferred_type_test.dart |
| +++ b/test/checker/inferred_type_test.dart |
| @@ -587,9 +587,37 @@ void main() { |
| } |
| test() { |
| - var l = List<Foo>(); |
| + var list = <Foo>[]; |
| for (var x in list) { |
| - String y = /*info:DynamicCast should be severe:StaticTypeError*/x; |
| + String y = /*severe:StaticTypeError*/x; |
| + } |
| + |
| + for (dynamic x in list) { |
| + String y = /*info:DynamicCast*/x; |
| + } |
| + |
| + for (String x in /*severe:StaticTypeError*/list) { |
| + String y = x; |
| + } |
| + |
| + var z; |
| + for(z in list) { |
| + String y = /*info:DynamicCast*/z; |
| + } |
| + |
| + Iterable iter = list; |
| + for (Foo x in /*warning:DownCastComposite*/iter) { |
| + var y = x; |
| + } |
| + |
| + dynamic iter2 = list; |
| + for (Foo x in /*warning:DownCastComposite*/iter2) { |
| + var y = x; |
| + } |
| + |
| + var map = <String, Foo>{}; |
| + for (var x in /*severe:StaticTypeError*/map) { |
|
Siggi Cherem (dart-lang)
2015/03/30 23:42:12
is this an error because the type is not iterable?
vsm
2015/03/31 00:24:47
Yes, a cast is needed and will fail here. Note, I
|
| + String y = /*info:DynamicCast*/x; |
| } |
| } |
| ''' |