| Index: lib/compiler/implementation/ssa/types.dart
|
| diff --git a/lib/compiler/implementation/ssa/types.dart b/lib/compiler/implementation/ssa/types.dart
|
| index 8fdde0b0e044484acc9d43492bb5396228dec223..014b82870460b35c06cce7ee74bf859f66d23cb4 100644
|
| --- a/lib/compiler/implementation/ssa/types.dart
|
| +++ b/lib/compiler/implementation/ssa/types.dart
|
| @@ -605,7 +605,8 @@ class HBoundedType extends HType {
|
|
|
| Type computeType(Compiler compiler) => type;
|
|
|
| - HType combine(HType other) {
|
| + HType intersection(HType other) {
|
| + if (other.isNull()) return canBeNull() ? HType.NULL : HType.CONFLICTING;
|
| if (other is HBoundedType) {
|
| HBoundedType temp = other;
|
| // Return [other] in case it is an exact type.
|
| @@ -615,23 +616,17 @@ class HBoundedType extends HType {
|
| return HType.CONFLICTING;
|
| }
|
|
|
| - // As long as we don't keep track of super/sub types for non-primitive types
|
| - // the intersection and union is the same, except when [other] is
|
| - // null.
|
| - HType intersection(HType other) {
|
| - if (other.isNull()) return canBeNull() ? HType.NULL : HType.CONFLICTING;
|
| - return combine(other);
|
| - }
|
| -
|
| HType union(HType other) {
|
| if (other.isNull()) {
|
| - if (canBeNull()) {
|
| - return this;
|
| - } else {
|
| - return new HBoundedType(type, true);
|
| - }
|
| + return canBeNull() ? this : new HBoundedType(type, true);
|
| }
|
| - return combine(other);
|
| + if (other is HBoundedType) {
|
| + HBoundedType temp = other;
|
| + // Return [this] in case [other] is an exact type.
|
| + if (this.type === temp.type) return this;
|
| + }
|
| + if (other.isUnknown()) return this;
|
| + return HType.CONFLICTING;
|
| }
|
| }
|
|
|
| @@ -644,18 +639,20 @@ class HExactType extends HBoundedType {
|
| return classElement.lookupMember(name);
|
| }
|
|
|
| - HType combine(HType other) {
|
| - if (other.isExact()) {
|
| - HExactType concrete = other;
|
| - if (this.type === concrete.type) return this;
|
| + HType intersection(HType other) {
|
| + if (other is HBoundedType) {
|
| + HBoundedType bounded = other;
|
| + if (this.type === bounded.type) return this;
|
| }
|
| - if (other.isUnknown()) return this;
|
| - return HType.CONFLICTING;
|
| + return super.intersection(other);
|
| }
|
|
|
| HType union(HType other) {
|
| - if (other.isNull()) return HType.CONFLICTING;
|
| - return combine(other);
|
| + if (other is HBoundedType) {
|
| + HBoundedType bounded = other;
|
| + if (this.type === bounded.type) return other;
|
| + }
|
| + return super.union(other);
|
| }
|
| }
|
|
|
|
|