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

Unified Diff: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart

Issue 465433003: Fix narrowing for null checks in type graph inferrer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: normalize dynamic type. Created 6 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
diff --git a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
index d7375f66a2b2358fd66003d7bf6c797eb2ec6d2e..caadbaca245bac1c08a31a477600dbcddd378bc6 100644
--- a/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
+++ b/sdk/lib/_internal/compiler/implementation/inferrer/type_graph_inferrer.dart
@@ -213,7 +213,7 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> {
{bool isNullable: true}) {
if (annotation.treatAsDynamic) return type;
if (annotation.isVoid) return nullType;
- if (annotation.element == compiler.objectClass) return type;
+ if (annotation.element == compiler.objectClass && isNullable) return type;
TypeMask otherType;
if (annotation.isTypedef || annotation.isFunctionType) {
otherType = functionType.type;
@@ -222,7 +222,9 @@ class TypeInformationSystem extends TypeSystem<TypeInformation> {
return type;
} else {
assert(annotation.isInterfaceType);
- otherType = new TypeMask.nonNullSubtype(annotation.element);
+ otherType = annotation.element == compiler.objectClass
+ ? dynamicType.type.nonNullable()
floitsch 2014/08/15 17:37:44 Why is this necessary? Isn't that the same?
herhut 2014/08/18 08:06:51 We can have [subclass object] and [subtype object]
+ : new TypeMask.nonNullSubtype(annotation.element);
}
if (isNullable) otherType = otherType.nullable();
if (type.type.isExact) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698