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

Unified Diff: pkg/analyzer/lib/src/task/strong/checker.dart

Issue 1495263003: Allow return of Future in async function (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rename duplicate tests Created 5 years 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 | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/task/strong/checker.dart
diff --git a/pkg/analyzer/lib/src/task/strong/checker.dart b/pkg/analyzer/lib/src/task/strong/checker.dart
index dab56d1138878615b469613aef1e9a380a26a9d4..d557eb244e0f334d97b125182e4a8d3ad138eadd 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -613,6 +613,14 @@ class CodeChecker extends RecursiveAstVisitor {
// analyzer error in this case.
return;
}
+ InterfaceType futureType = rules.provider.futureType;
+ DartType actualType = expression.staticType;
+ if (body.isAsynchronous &&
+ !body.isGenerator &&
+ actualType is InterfaceType &&
+ actualType.element == futureType.element) {
+ type = futureType.substitute4([type]);
+ }
// TODO(vsm): Enforce void or dynamic (to void?) when expression is null.
if (expression != null) checkAssignment(expression, type);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/task/strong/checker_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698