Construct a unique union type name based on the type names being unioned.
421013
def _get_union_type_name(type_names_to_union):
    """"""
    if not type_names_to_union:
        raise AssertionError(u'Expected a non-empty list of type names to union, received: '
                             u'{}'.format(type_names_to_union))
    return u'Union__' + u'__'.join(sorted(type_names_to_union))
366515
private Type parseUnionType(EnclosingScope scope) {
		int start = index;
		Type t = parseIntersectionType(scope);
		// Now, attempt to look for union and/or intersection types
		if (tryAndMatch(true, VerticalBar) != null) {
			// This is a union type
			ArrayList<Type> types = new ArrayList<>();
			types.add(t);
			do {
				types.add(parseIntersectionType(scope));
			} while (tryAndMatch(true, VerticalBar) != null);
			//
			Type[] bounds = types.toArray(new Type[types.size()]);
			t = annotateSourceLocation(new Type.Union(bounds), start);
		}
		return t;
	}
1082879
function contextualTypeIsTupleLikeType(type) {
            return !!(type.flags & 524288 /* Union */ ? ts.forEach(type.types, isTupleLikeType) : isTupleLikeType(type));
        }
1092966
def _generate_union_class_h(self, union):
        """"""
        self._generate_init_imports_h(union)
        self._generate_imports_h(self._get_imports_h(union))

        self.emit()
        self.emit('NS_ASSUME_NONNULL_BEGIN')
        self.emit()

        self.emit('#pragma mark - API Object')
        self.emit()
        self._generate_class_comment(union)

        union_name = fmt_class_prefix(union)

        with self.block_h_from_data_type(union, protocol=['DBSerializable', 'NSCopying']):
            self.emit('#pragma mark - Instance fields')
            self.emit()
            self._generate_union_tag_state(union)
            self._generate_union_tag_property(union)
            self._generate_union_properties(union.all_fields)
            self.emit('#pragma mark - Constructors')
            self.emit()
            self._generate_union_cstor_signatures(union, union.all_fields)
            self._generate_init_unavailable_signature(union)
            self.emit('#pragma mark - Tag state methods')
            self.emit()
            self._generate_union_tag_access_signatures(union)

        self.emit()
        self.emit()

        self.emit('#pragma mark - Serializer Object')
        self.emit()
        self.emit(comment_prefix)
        self.emit_wrapped_text(
            'The serialization class for the `{}` union.'.format(union_name),
            prefix=comment_prefix)
        self.emit(comment_prefix)
        with self.block_h(fmt_serial_class(union_name)):
            self._generate_serializer_signatures(union_name)

        self.emit()
        self.emit('NS_ASSUME_NONNULL_END')
        self.emit()
465590
def from_type_name(cls, typ, name):
        """"""
        # Try aliases first.
        for k, nt in cls.defined_aliases.items():
            if typ is not None and typ != nt.type: continue
            #print(name, nt.name)
            if name == nt.name:
                if len(k) == 1: return cls(xc=k)
                if len(k) == 2: return cls(x=k[0], c=k[1])
                raise ValueError("Wrong key: %s" % k)

        # At this point, we should have something in the form
        # name="GGA_X_PBE+GGA_C_PBE" or  name=""LDA_XC_TETER93"
        if "+" in name:
            #if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
            x, c = (s.strip() for s in name.split("+"))
            x, c = LibxcFunc[x], LibxcFunc[c]
            return cls(x=x, c=c)
        else:
            #if typ is not None: raise ValueError("typ: `%s` but name: `%s`" % (typ, name))
            xc = LibxcFunc[name]
            return cls(xc=xc)

        if typ is None:
            raise ValueError("Cannot find name=%s in defined_aliases" % name)
        else:
            raise ValueError("Cannot find type=%s, name=%s in defined_aliases" % (typ, name))
359749
public JSType createUnionType(JSTypeNative... variants) {
    UnionTypeBuilder builder = UnionTypeBuilder.create(this);
    for (JSTypeNative typeId : variants) {
      builder.addAlternate(getNativeType(typeId));
    }
    return builder.build();
  }
1281884
def _join_types(seq, last_separator=''):
    """"""
    class_names = [_format_type(cls) for cls in seq]
    return _join_sequence(class_names, last_separator)
816157
def union(lst1, lst2):
    '''
    
    '''
    if isinstance(lst1, collections.Hashable) and isinstance(lst2, collections.Hashable):
        return set(lst1) | set(lst2)
    return unique(lst1 + lst2)
1208328
def check_union(data: typing.Union, hint: type) -> bool:
    
    r = any(check_type(data, t)[1] for t in hint.__union_params__)
    if not r:
        raise TypeError(
            'expected one of {0!r}, found: {1!r}'.format(
                hint.__union_params__, type(data)
            )
        )
    return hint, r
577227
def union(self, enumerable, key=lambda x: x):
        
        if not isinstance(enumerable, Enumerable):
            raise TypeError(
                u"enumerable parameter must be an instance of Enumerable")
        return self.concat(enumerable).distinct(key)
687594
def union_update(self, other, ignore_conflicts=False):
        """"""
        if not ignore_conflicts:
            ensure_compatible(self, other)
        self._objects |= other._objects
        self._properties |= other._properties
        self._pairs |= other._pairs
192230
function UnionType(schema, opts) {
  Type.call(this);

  if (!Array.isArray(schema)) {
    throw new Error(f('non-array union schema: %j', schema));
  }
  if (!schema.length) {
    throw new Error('empty union');
  }
  this.types = Object.freeze(schema.map(function (obj) {
    return Type.forSchema(obj, opts);
  }));

  this._branchIndices = {};
  this.types.forEach(function (type, i) {
    if (Type.isType(type, 'union')) {
      throw new Error('unions cannot be directly nested');
    }
    var branch = type.branchName;
    if (this._branchIndices[branch] !== undefined) {
      throw new Error(f('duplicate union branch name: %j', branch));
    }
    this._branchIndices[branch] = i;
  }, this);
}
134465
def parse_union_type_definition(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    description = parse_description(lexer)
    expect_keyword(lexer, "union")
    name = parse_name(lexer)
    directives = parse_directives(lexer, True)
    types = parse_union_member_types(lexer)
    return Node(
        description=description,
        name=name,
        directives=directives,
        types=types,
        loc=loc(lexer, start),
    )
491618
function getUnionTypeFromSortedList(types, aliasSymbol, aliasTypeArguments) {
            if (types.length === 0) {
                return neverType;
            }
            if (types.length === 1) {
                return types[0];
            }
            var id = getTypeListId(types);
            var type = unionTypes[id];
            if (!type) {
                var propagatedFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 6144 /* Nullable */);
                type = unionTypes[id] = createObjectType(524288 /* Union */ | propagatedFlags);
                type.types = types;
                type.aliasSymbol = aliasSymbol;
                type.aliasTypeArguments = aliasTypeArguments;
            }
            return type;
        }
140368
private ImmutableList<UTypeVar> freeTypeVars(Unifier unifier) {
    ImmutableList.Builder<UTypeVar> builder = ImmutableList.builder();
    for (UTypeVar var : typeVariables(unifier.getContext())) {
      if (unifier.getBinding(var.key()) == null) {
        builder.add(var);
      }
    }
    return builder.build();
  }
1142556
def is_union(etype) -> bool:
    
    return getattr(etype, '__origin__', None) is not None and \
           getattr(etype.__origin__, '_name', None) and\
           etype.__origin__._name == 'Union'
883271
def Union(self, t2, off):
        """"""
        assert type(t2) is Table
        N.enforce_number(off, N.UOffsetTFlags)

        off += self.Pos
        t2.Pos = off + self.Get(N.UOffsetTFlags, off)
        t2.Bytes = self.Bytes