// Specialize this type by meeting with other, but keeping location public JSType specialize(JSType other) { if (other.isTop() || other.isUnknown()) { return this; } else if (other.isTruthy()) { return makeTruthy(); } else if (other.isFalsy()) { return makeFalsy(); } else if (this.isTop() || this.isUnknown()) { return other.withLocation(this.location); } int newMask = this.mask & other.mask; String newTypevar; if (Objects.equal(this.typeVar, other.typeVar)) { newTypevar = this.typeVar; } else { newTypevar = null; newMask = newMask & ~TYPEVAR_MASK; } return new JSType( newMask, this.location, ObjectType.specializeSet(this.objs, other.objs), newTypevar); }