Source File
typeterm.go
Belonging Package
go/types
// Code generated by "go test -run=Generate -write=all"; DO NOT EDIT.// Source: ../../cmd/compile/internal/types2/typeterm.go// Copyright 2021 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package types// A term describes elementary type sets://// β : (*term)(nil) == β // set of no types (empty set)// π€: &term{} == π€ // set of all types (π€niverse)// T: &term{false, T} == {T} // set of type T// ~t: &term{true, t} == {t' | under(t') == t} // set of types with underlying type ttype term struct {tilde bool // valid if typ != niltyp Type}func ( *term) () string {switch {case == nil:return "β "case .typ == nil:return "π€"case .tilde:return "~" + .typ.String()default:return .typ.String()}}// equal reports whether x and y represent the same type set.func ( *term) ( *term) bool {// easy casesswitch {case == nil || == nil:return ==case .typ == nil || .typ == nil:return .typ == .typ}// β β x, y β π€return .tilde == .tilde && Identical(.typ, .typ)}// union returns the union x βͺ y: zero, one, or two non-nil terms.func ( *term) ( *term) (, *term) {// easy casesswitch {case == nil && == nil:return nil, nil // β βͺ β == βcase == nil:return , nil // β βͺ y == ycase == nil:return , nil // x βͺ β == xcase .typ == nil:return , nil // π€ βͺ y == π€case .typ == nil:return , nil // x βͺ π€ == π€}// β β x, y β π€if .disjoint() {return , // x βͺ y == (x, y) if x β© y == β}// x.typ == y.typ// ~t βͺ ~t == ~t// ~t βͺ T == ~t// T βͺ ~t == ~t// T βͺ T == Tif .tilde || !.tilde {return , nil}return , nil}// intersect returns the intersection x β© y.func ( *term) ( *term) *term {// easy casesswitch {case == nil || == nil:return nil // β β© y == β and β© β == βcase .typ == nil:return // π€ β© y == ycase .typ == nil:return // x β© π€ == x}// β β x, y β π€if .disjoint() {return nil // x β© y == β if x β© y == β}// x.typ == y.typ// ~t β© ~t == ~t// ~t β© T == T// T β© ~t == T// T β© T == Tif !.tilde || .tilde {return}return}// includes reports whether t β x.func ( *term) ( Type) bool {// easy casesswitch {case == nil:return false // t β β == falsecase .typ == nil:return true // t β π€ == true}// β β x β π€:=if .tilde {= under()}return Identical(.typ, )}// subsetOf reports whether x β y.func ( *term) ( *term) bool {// easy casesswitch {case == nil:return true // β β y == truecase == nil:return false // x β β == false since x != βcase .typ == nil:return true // x β π€ == truecase .typ == nil:return false // π€ β y == false since y != π€}// β β x, y β π€if .disjoint() {return false // x β y == false if x β© y == β}// x.typ == y.typ// ~t β ~t == true// ~t β T == false// T β ~t == true// T β T == truereturn !.tilde || .tilde}// disjoint reports whether x β© y == β .// x.typ and y.typ must not be nil.func ( *term) ( *term) bool {if debug && (.typ == nil || .typ == nil) {panic("invalid argument(s)")}:= .typif .tilde {= under()}:= .typif .tilde {= under()}return !Identical(, )}
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)