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

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

Issue 2159033002: fix #26404, incorrect cast on async function return (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 | « 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 783cdf0b0e8711178ac09413926a314e8ba54c80..7e00395e52b5b1bc96f2a7d8300094b14bdd3d80 100644
--- a/pkg/analyzer/lib/src/task/strong/checker.dart
+++ b/pkg/analyzer/lib/src/task/strong/checker.dart
@@ -720,14 +720,6 @@ class CodeChecker extends RecursiveAstVisitor {
// analyzer error in this case.
return;
}
- InterfaceType futureType = typeProvider.futureType;
- DartType actualType = expression?.staticType;
- if (body.isAsynchronous &&
- !body.isGenerator &&
- actualType is InterfaceType &&
- actualType.element == futureType.element) {
- type = futureType.instantiate([type]);
- }
// TODO(vsm): Enforce void or dynamic (to void?) when expression is null.
if (expression != null) checkAssignment(expression, type);
}
@@ -858,9 +850,9 @@ class CodeChecker extends RecursiveAstVisitor {
// Stream<T> -> T
expectedType = typeProvider.streamType;
} else {
- // Future<T> -> T
- // TODO(vsm): Revisit with issue #228.
- expectedType = typeProvider.futureType;
+ // Don't validate return type of async methods.
+ // They're handled by the runtime implementation.
+ return null;
}
} else {
if (body.isGenerator) {
« 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