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

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

Issue 898513002: Fix async/await type checking in analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reformat and sort methods Created 5 years, 11 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/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 0ceb9d4bf141f905d3a90e4a8c23e844fd24f702..12c028cf1bf17c7363412a5902887f13074c1a89 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
@@ -567,6 +567,41 @@ f(A a, B b) {
verify([source]);
}
+ void test_returnOfInvalidType_async_future_int_mismatches_future_null() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Null> f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
+ verify([source]);
+ }
+
+ void test_returnOfInvalidType_async_future_int_mismatches_future_string() {
+ Source source = addSource('''
+import 'dart:async';
+Future<String> f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
+ verify([source]);
+ }
+
+ void test_returnOfInvalidType_async_future_int_mismatches_int() {
+ Source source = addSource('''
+int f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertErrors(source, [StaticTypeWarningCode.RETURN_OF_INVALID_TYPE]);
+ verify([source]);
+ }
+
void test_returnOfInvalidType_expressionFunctionBody_function() {
Source source = addSource("int f() => '0';");
resolve(source);

Powered by Google App Engine
This is Rietveld 408576698