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

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

Issue 2638183002: Issue 28027. Move Null to the bottom in the Analyzer. (Closed)
Patch Set: Fixes for review comments. 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/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/lib/src/generated/resolver.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 1b99f57aaca59e32d6d22f80900cde5fe13cba4e..befeccf958640ff7291ed70d062ba857e77308f3 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -2281,9 +2281,22 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
// RETURN_WITHOUT_VALUE
if (returnExpression == null) {
- if (_inGenerator ||
- _typeSystem.isAssignableTo(
- _computeReturnTypeForMethod(null), expectedReturnType)) {
+ if (_inGenerator) {
+ return;
+ } else if (_inAsync) {
+ if (expectedReturnType.isDynamic) {
+ return;
+ }
+ if (expectedReturnType is InterfaceType &&
+ expectedReturnType.isDartAsyncFuture) {
+ DartType futureArgument = expectedReturnType.typeArguments[0];
+ if (futureArgument.isDynamic ||
+ futureArgument.isDartCoreNull ||
+ futureArgument.isObject) {
+ return;
+ }
+ }
+ } else if (expectedReturnType.isDynamic || expectedReturnType.isVoid) {
return;
}
_hasReturnWithoutValue = true;
@@ -5476,7 +5489,8 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (expectedReturnType.isVoid) {
if (staticReturnType.isVoid ||
staticReturnType.isDynamic ||
- staticReturnType.isBottom) {
+ staticReturnType.isBottom ||
+ staticReturnType.isDartCoreNull) {
return;
}
_errorReporter.reportTypeErrorForNode(
@@ -6427,7 +6441,7 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
}
bool _isFunctionType(DartType type) {
- if (type.isDynamic || type.isBottom) {
+ if (type.isDynamic || type.isDartCoreNull) {
return true;
} else if (type is FunctionType || type.isDartCoreFunction) {
return true;
« no previous file with comments | « pkg/analyzer/lib/src/generated/element_resolver.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698