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

Unified Diff: pkg/analyzer/lib/src/generated/resolver.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
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 5f0397fd8a6424039f2cd424581c57ce9f726570..60c2700d50fd22000e80afe4c90c1777ab7d559a 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -909,7 +909,9 @@ class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
if (returnTypeType is InterfaceType &&
returnTypeType.isDartAsyncFuture) {
DartType futureArgument = returnTypeType.typeArguments[0];
- if (futureArgument.isDynamic || futureArgument.isDartCoreNull) {
+ if (futureArgument.isDynamic ||
+ futureArgument.isDartCoreNull ||
+ futureArgument.isObject) {
return;
}
}
@@ -4187,7 +4189,7 @@ class InferenceContext {
if (_returnStack.isNotEmpty && _inferredReturn.isNotEmpty) {
DartType context = _returnStack.removeLast() ?? DynamicTypeImpl.instance;
DartType inferred = _inferredReturn.removeLast();
- if (inferred.isBottom) {
+ if (inferred.isBottom || inferred.isDartCoreNull) {
return;
}
@@ -5330,7 +5332,9 @@ class ResolverVisitor extends ScopedVisitor {
return null;
}
- if (potentialType == null || potentialType.isBottom) {
+ if (potentialType == null ||
+ potentialType.isBottom ||
+ potentialType.isDartCoreNull) {
return null;
}
DartType currentType = _overrideManager.getBestType(element);
@@ -5388,7 +5392,11 @@ class ResolverVisitor extends ScopedVisitor {
void recordPropagatedTypeIfBetter(Expression expression, DartType type,
[bool hasOldPropagatedType = false]) {
// Ensure that propagated type invalid.
- if (strongMode || type == null || type.isDynamic || type.isBottom) {
+ if (strongMode ||
+ type == null ||
+ type.isBottom ||
+ type.isDynamic ||
+ type.isDartCoreNull) {
if (!hasOldPropagatedType) {
expression.propagatedType = null;
}
« no previous file with comments | « pkg/analyzer/lib/src/generated/error_verifier.dart ('k') | pkg/analyzer/lib/src/generated/static_type_analyzer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698