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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 2752423003: Restore weak mode errors on empty returns in Null functions (Closed)
Patch Set: Created 3 years, 9 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/generated/static_warning_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 1fa5eae09db4805cfbc74551a068dbc160ea4184..ec00b6c36e65b492e9caa18cf716328396e8454d 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -2317,7 +2317,11 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
} else if (expectedReturnType.isDynamic ||
expectedReturnType.isVoid ||
- expectedReturnType.isDartCoreNull) {
+ (expectedReturnType.isDartCoreNull && _options.strongMode)) {
+ // TODO(leafp): Empty returns shouldn't be allowed for Null in strong
+ // mode either once we allow void as a type argument. But for now, the
+ // only type we can validly infer for f.then((_) {print("hello");}) is
+ // Future<Null>, so we allow this.
return;
}
_hasReturnWithoutValue = true;
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/static_warning_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698