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

Unified Diff: test/checker/inferred_type_test.dart

Issue 1048863003: Handle for-in loops (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « lib/src/checker/resolver.dart ('k') | test/codegen/expect/server_mode/html_input.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
}
'''
« no previous file with comments | « lib/src/checker/resolver.dart ('k') | test/codegen/expect/server_mode/html_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698