Chromium Code Reviews| Index: pkg/compiler/lib/src/types/union_type_mask.dart |
| diff --git a/pkg/compiler/lib/src/types/union_type_mask.dart b/pkg/compiler/lib/src/types/union_type_mask.dart |
| index 24a019144a87e3d76477db32517f90d80fc4f17a..6f8c81367584a09ac669ef49f8e5eebfb414dc86 100644 |
| --- a/pkg/compiler/lib/src/types/union_type_mask.dart |
| +++ b/pkg/compiler/lib/src/types/union_type_mask.dart |
| @@ -152,12 +152,17 @@ class UnionTypeMask implements TypeMask { |
| TypeMask intersection(var other, ClassWorld classWorld) { |
| other = TypeMask.nonForwardingMask(other); |
| if (!other.isUnion && disjointMasks.contains(other)) return other; |
| + if (other.isUnion && this == other) return this; |
|
Siggi Cherem (dart-lang)
2016/01/21 01:07:12
These are common cases we hit during type propagat
asgerf
2016/01/21 01:15:45
I say add both.
|
| List<TypeMask> intersections = <TypeMask>[]; |
| for (TypeMask current in disjointMasks) { |
| if (other.isUnion) { |
| - for (FlatTypeMask flatOther in other.disjointMasks) { |
| - intersections.add(current.intersection(flatOther, classWorld)); |
| + if (other.disjointMasks.contains(current)) { |
| + intersections.add(current); |
| + } else { |
| + for (FlatTypeMask flatOther in other.disjointMasks) { |
| + intersections.add(current.intersection(flatOther, classWorld)); |
| + } |
| } |
| } else { |
| intersections.add(current.intersection(other, classWorld)); |