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

Unified Diff: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart

Issue 1413613010: Normalize type masks to use the least upper instantiated subclass/type. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix try/poi Created 5 years, 1 month 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/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
diff --git a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
index 08826d0aa95e9685996e50c9dec55c7d822ae6f2..61f8595ff3abda9e54aa8e54679c6720a49522ad 100644
--- a/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
+++ b/pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart
@@ -647,7 +647,19 @@ class SimpleTypeInferrerVisitor<T>
}
});
}
- returnType = types.nonNullExact(cls);
+ if (analyzedElement.isGenerativeConstructor && cls.isAbstract) {
+ if (compiler.world.isDirectlyInstantiated(cls)) {
+ returnType = types.nonNullExact(cls);
+ } else if (compiler.world.isIndirectlyInstantiated(cls)) {
+ returnType = types.nonNullSubclass(cls);
+ } else {
+ // TODO(johnniwinther): Avoid analyzing [analyzedElement] in this
+ // case; it's never called.
+ returnType = types.nonNullEmpty();
+ }
+ } else {
+ returnType = types.nonNullExact(cls);
+ }
} else {
signature.forEachParameter((LocalParameterElement element) {
locals.update(element, inferrer.typeOfElement(element), node);
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698