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

Unified Diff: pkg/analyzer/test/generated/static_type_warning_code_test.dart

Issue 1823793002: Better casting of for-in loops. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Handle supertypes of Iterable and Stream. Created 4 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 | « pkg/analyzer/lib/src/task/strong/info.dart ('k') | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/generated/static_type_warning_code_test.dart
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
index ac762c4bf2dc334a0df4d5c96ca901fc199565c0..02993c54c813e26e65e2c5c4c92d88c4f4660fff 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -1917,6 +1917,26 @@ f() {
[StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE]);
}
+ void test_forIn_object() {
+ assertNoErrorsInCode(
+ '''
+f() {
+ Object o; // Could be [].
+ for (var i in o) {}
+}
+''');
+ }
+
+ void test_forIn_dynamic() {
+ assertNoErrorsInCode(
+ '''
+f() {
+ dynamic d; // Could be [].
+ for (var i in d) {}
+}
+''');
+ }
+
void test_forIn_declaredVariableWrongType() {
assertErrorsInCode(
'''
« no previous file with comments | « pkg/analyzer/lib/src/task/strong/info.dart ('k') | pkg/analyzer/test/src/context/mock_sdk.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698