go/src/cmd/compile/internal/types2/union.go

type Union

// NewUnion returns a new Union type with the given terms.
// It is an error to create an empty union; they are syntactically not possible.
func NewUnion(terms []*Term) *Union {}

func (u *Union) Len() int         {}

func (u *Union) Term(i int) *Term {}

func (u *Union) Underlying() Type {}

func (u *Union) String() string   {}

type Term

// NewTerm returns a new union term.
func NewTerm(tilde bool, typ Type) *Term {}

func (t *Term) Tilde() bool    {}

func (t *Term) Type() Type     {}

func (t *Term) String() string {}

const maxTermCount

// parseUnion parses uexpr as a union of expressions.
// The result is a Union type, or Typ[Invalid] for some errors.
func parseUnion(check *Checker, uexpr syntax.Expr) Type {}

func parseTilde(check *Checker, tx syntax.Expr) *Term {}

// overlappingTerm reports the index of the term x in terms which is
// overlapping (not disjoint) from y. The result is < 0 if there is no
// such term. The type of term y must not be an interface, and terms
// with an interface type are ignored in the terms list.
func overlappingTerm(terms []*Term, y *Term) int {}

// flattenUnion walks a union type expression of the form A | B | C | ...,
// extracting both the binary exprs (blist) and leaf types (tlist).
func flattenUnion(list []syntax.Expr, x syntax.Expr) (blist, tlist []syntax.Expr) {}