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

Unified Diff: pkg/analyzer/test/src/task/strong/inferred_type_test.dart

Issue 2655463004: Fix summary type inference of async closures. (Closed)
Patch Set: Remove bogusly added test Created 3 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
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_ast_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/strong/inferred_type_test.dart
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index c7cea7e34312e626bb65c3899031902212e39cf0..2dd918a904808e510716e819155374517c4c7e25 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -36,6 +36,31 @@ abstract class InferredTypeMixin {
*/
CompilationUnitElement checkFile(String content);
+ void test_asyncClosureReturnType_flatten() {
+ var mainUnit = checkFile('''
+import 'dart:async';
+Future<int> futureInt = null;
+var f = () => futureInt;
+var g = () async => futureInt;
+''');
+ var futureInt = mainUnit.topLevelVariables[0];
+ expect(futureInt.name, 'futureInt');
+ expect(futureInt.type.toString(), 'Future<int>');
+ var f = mainUnit.topLevelVariables[1];
+ expect(f.name, 'f');
+ expect(f.type.toString(), '() → Future<int>');
+ var g = mainUnit.topLevelVariables[2];
+ expect(g.name, 'g');
+ expect(g.type.toString(), '() → Future<int>');
+ }
+
+ void test_asyncClosureReturnType_future() {
+ var mainUnit = checkFile('var f = () async => 0;');
+ var f = mainUnit.topLevelVariables[0];
+ expect(f.name, 'f');
+ expect(f.type.toString(), '() → Future<int>');
+ }
+
void test_blockBodiedLambdas_async_allReturnsAreFutures() {
if (!mayCheckTypesOfLocals) {
return;
« no previous file with comments | « pkg/analyzer/test/src/summary/resynthesize_ast_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698