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

Unified Diff: compiler/java/com/google/dart/compiler/type/Types.java

Issue 10909011: Issue 4791. Ignore Dynamic (e.g. null) during types intersection (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/type/Types.java
diff --git a/compiler/java/com/google/dart/compiler/type/Types.java b/compiler/java/com/google/dart/compiler/type/Types.java
index d9d91a065d7f282b77f16cb4039a19a3d192aed7..0cc2c64a0681f4bac88abd2aa9c28cd53229357a 100644
--- a/compiler/java/com/google/dart/compiler/type/Types.java
+++ b/compiler/java/com/google/dart/compiler/type/Types.java
@@ -71,6 +71,20 @@ public class Types {
}
public Type intersection(List<Type> types) {
+ // exclude Dynamic type
+ {
+ List<Type> newTypes = Lists.newArrayList();
+ for (Type type : types) {
+ if (TypeKind.of(type) != TypeKind.DYNAMIC) {
+ newTypes.add(type);
+ }
+ }
+ types = newTypes;
+ }
+ // no types, so Dynamic
+ if (types.isEmpty()) {
+ return typeProvider.getDynamicType();
+ }
// prepare all super types
List<List<InterfaceType>> superTypesLists = Lists.newArrayList();
List<Map<InterfaceType, InterfaceType>> superTypesMaps = Lists.newArrayList();
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698