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

Unified Diff: pkg/analyzer/test/generated/non_error_resolver_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/non_error_resolver_test.dart
diff --git a/pkg/analyzer/test/generated/non_error_resolver_test.dart b/pkg/analyzer/test/generated/non_error_resolver_test.dart
index 22644437256851d226e1593b725de2bf2f0d1489..f63f0890a3f4f8e1217d20f01ef3cb093efaccfd 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -295,6 +295,229 @@ bool x = false;''');
verify([source]);
}
+ void test_async_dynamic_with_return() {
+ Source source = addSource('''
+dynamic f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_dynamic_with_return_value() {
+ Source source = addSource('''
+dynamic f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_dynamic_without_return() {
+ Source source = addSource('''
+dynamic f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_expression_function_type() {
+ Source source = addSource('''
+import 'dart:async';
+typedef Future<int> F(int i);
+main() {
+ F f = (int i) async => i;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_dynamic_with_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<dynamic> f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_dynamic_with_return_value() {
+ Source source = addSource('''
+import 'dart:async';
+Future<dynamic> f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_dynamic_without_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<dynamic> f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_int_with_return_future_int() {
+ Source source = addSource('''
+import 'dart:async';
+Future<int> f() async {
+ return new Future<int>.value(5);
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_int_with_return_value() {
+ Source source = addSource('''
+import 'dart:async';
+Future<int> f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_null_with_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Null> f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_null_without_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Null> f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_object_with_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Object> f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_object_with_return_value() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Object> f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_object_without_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Object> f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_with_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_with_return_value() {
+ Source source = addSource('''
+import 'dart:async';
+Future f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_future_without_return() {
+ Source source = addSource('''
+import 'dart:async';
+Future f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_with_return() {
+ Source source = addSource('''
+f() async {
+ return;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_with_return_value() {
+ Source source = addSource('''
+f() async {
+ return 5;
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_async_without_return() {
+ Source source = addSource('''
+f() async {}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_asyncForInWrongContext_async() {
Source source = addSource(r'''
f(list) async {
@@ -782,8 +1005,7 @@ library root;
import 'lib1.dart' deferred as a;
main() {
new a.A.b();
-}'''],
- <ErrorCode>[]);
+}'''], <ErrorCode>[]);
}
void test_constEval_functionTypeLiteral() {
@@ -2519,8 +2741,7 @@ foo() => 22;''', r'''
import 'lib1.dart' deferred as other;
main() {
other.loadLibrary().then((_) => other.foo());
-}'''],
- <ErrorCode>[]);
+}'''], <ErrorCode>[]);
}
void test_mapKeyTypeNotAssignable() {
@@ -3977,8 +4198,7 @@ library root;
import 'lib1.dart' deferred as lib1;
import 'lib2.dart' as lib;
import 'lib3.dart' as lib;
-main() { lib1.f1(); lib.f2(); lib.f3(); }'''],
- <ErrorCode>[]);
+main() { lib1.f1(); lib.f2(); lib.f3(); }'''], <ErrorCode>[]);
}
void test_staticAccessToInstanceMember_annotation() {

Powered by Google App Engine
This is Rietveld 408576698