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

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

Issue 904743003: Fix analyzer type checking of "await" expressions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 680045a4d3bc6942109d487112815daf660b2849..3238e50e59d390305825a39374059bae81ba6f29 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_test.dart
@@ -487,6 +487,19 @@ Future f() async {}
verify([source]);
}
+ void test_async_return_flattens_futures() {
+ Source source = addSource('''
+import 'dart:async';
+Future<int> f() async {
+ return g();
+}
+Future<Future<int>> g() => null;
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_async_with_return() {
Source source = addSource('''
f() async {
@@ -540,6 +553,32 @@ f(list) async* {
verify([source]);
}
+ void test_await_flattened() {
+ Source source = addSource('''
+import 'dart:async';
+Future<Future<int>> ffi() => null;
+f() async {
+ int b = await ffi();
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
+ void test_await_simple() {
+ Source source = addSource('''
+import 'dart:async';
+Future<int> fi() => null;
+f() async {
+ int a = await fi();
+}
+''');
+ resolve(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
void test_awaitInWrongContext_async() {
Source source = addSource(r'''
f(x, y) async {
« no previous file with comments | « pkg/analyzer/lib/src/generated/static_type_analyzer.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698