Namespace: go.std.go.types
v1.0Contents
Summary
Provides a low-level interface to the go/types package.
Package types declares the data types and implements
the algorithms for type-checking of Go packages. Use
Config.Check to invoke the type checker for a package.
Alternatively, create a new type checker with NewChecker
and invoke it incrementally by calling Checker.Files.
Type-checking consists of several interdependent phases:
Name resolution maps each identifier (ast.Ident) in the program to the
language object (Object) it denotes.
Use Info.{Defs,Uses,Implicits} for the results of name resolution.
Constant folding computes the exact constant value (constant.Value)
for every expression (ast.Expr) that is a compile-time constant.
Use Info.Types[expr].Value for the results of constant folding.
Type inference computes the type (Type) of every expression (ast.Expr)
and checks for compliance with the language specification.
Use Info.Types[expr].Type for the results of type inference.
For a tutorial, see https://golang.org/s/types-tutorial.
Index
- *ArgumentError
- *Array
- *Basic
- *BasicInfo
- *BasicKind
- *Builtin
- *Chan
- *ChanDir
- *Checker
- *Config
- *Const
- *Context
- *Error
- *Func
- *ImportMode
- *Info
- *Initializer
- *Instance
- *Interface
- *Label
- *Map
- *MethodSet
- *Named
- *Nil
- *Package
- *PkgName
- *Pointer
- *Qualifier
- *Scope
- *Selection
- *SelectionKind
- *Signature
- *Slice
- *StdSizes
- *Struct
- *Term
- *Tuple
- *TypeAndValue
- *TypeList
- *TypeName
- *TypeParam
- *TypeParamList
- *Union
- *Var
- ArgumentError
- Array
- AssertableTo
- AssignableTo
- Basic
- BasicInfo
- BasicKind
- Bool
- Builtin
- Byte
- Chan
- ChanDir
- CheckExpr
- Checker
- Comparable
- Complex128
- Complex64
- Config
- Const
- Context
- ConvertibleTo
- DefPredeclaredTestFuncs
- Default
- Error
- Eval
- ExprString
- FieldVal
- Float32
- Float64
- Func
- Id
- Identical
- IdenticalIgnoreTags
- Implements
- ImportMode
- Importer
- ImporterFrom
- Info
- Initializer
- Instance
- Instantiate
- Int
- Int16
- Int32
- Int64
- Int8
- Interface
- Invalid
- IsBoolean
- IsComplex
- IsConstType
- IsFloat
- IsInteger
- IsInterface
- IsNumeric
- IsOrdered
- IsString
- IsUnsigned
- IsUntyped
- Label
- LookupFieldOrMethod
- Map
- MethodExpr
- MethodSet
- MethodVal
- MissingMethod
- Named
- NewArray
- NewChan
- NewChecker
- NewConst
- NewContext
- NewField
- NewFunc
- NewInterface
- NewInterfaceType
- NewLabel
- NewMap
- NewMethodSet
- NewNamed
- NewPackage
- NewParam
- NewPkgName
- NewPointer
- NewScope
- NewSignature
- NewSignatureType
- NewSlice
- NewStruct
- NewTerm
- NewTuple
- NewTypeName
- NewTypeParam
- NewUnion
- NewVar
- Nil
- Object
- ObjectString
- Package
- PkgName
- Pointer
- Qualifier
- RecvOnly
- RelativeTo
- Rune
- Scope
- Selection
- SelectionKind
- SelectionString
- SendOnly
- SendRecv
- Signature
- Sizes
- SizesFor
- Slice
- StdSizes
- String
- Struct
- Term
- Tuple
- Typ
- Type
- TypeAndValue
- TypeList
- TypeName
- TypeParam
- TypeParamList
- TypeString
- Uint
- Uint16
- Uint32
- Uint64
- Uint8
- Uintptr
- Union
- Universe
- Unsafe
- UnsafePointer
- UntypedBool
- UntypedComplex
- UntypedFloat
- UntypedInt
- UntypedNil
- UntypedRune
- UntypedString
- Var
- WriteExpr
- WriteSignature
- WriteType
- arrayOfArgumentError
- arrayOfArray
- arrayOfBasic
- arrayOfBasicInfo
- arrayOfBasicKind
- arrayOfBuiltin
- arrayOfChan
- arrayOfChanDir
- arrayOfChecker
- arrayOfConfig
- arrayOfConst
- arrayOfContext
- arrayOfError
- arrayOfFunc
- arrayOfImportMode
- arrayOfImporter
- arrayOfImporterFrom
- arrayOfInfo
- arrayOfInitializer
- arrayOfInstance
- arrayOfInterface
- arrayOfLabel
- arrayOfMap
- arrayOfMethodSet
- arrayOfNamed
- arrayOfNil
- arrayOfObject
- arrayOfPackage
- arrayOfPkgName
- arrayOfPointer
- arrayOfQualifier
- arrayOfScope
- arrayOfSelection
- arrayOfSelectionKind
- arrayOfSignature
- arrayOfSizes
- arrayOfSlice
- arrayOfStdSizes
- arrayOfStruct
- arrayOfTerm
- arrayOfTuple
- arrayOfType
- arrayOfTypeAndValue
- arrayOfTypeList
- arrayOfTypeName
- arrayOfTypeParam
- arrayOfTypeParamList
- arrayOfUnion
- arrayOfVar
Legend
-
Constant
Variable
Function
Macro
Special form
Type
GoVar
Receiver/Method
Constants
Constants are variables with :const true in their metadata. Joker currently does not recognize them as special; as such, it allows redefining them or their values.-
(None.)
Variables
-
Bool
GoObject v1.0predeclared types
-
Byte
GoObject v1.0aliases
-
Complex128
GoObject v1.0 -
Complex64
GoObject v1.0 -
FieldVal
GoObject v1.0x.f is a struct field selector
-
Float32
GoObject v1.0 -
Float64
GoObject v1.0 -
Int
GoObject v1.0 -
Int16
GoObject v1.0 -
Int32
GoObject v1.0 -
Int64
GoObject v1.0 -
Int8
GoObject v1.0 -
Invalid
GoObject v1.0type is invalid
-
IsBoolean
GoObject v1.0Properties of basic types.
-
IsComplex
GoObject v1.0Properties of basic types.
-
IsConstType
GoObject v1.0Properties of basic types.
-
IsFloat
GoObject v1.0Properties of basic types.
-
IsInteger
GoObject v1.0Properties of basic types.
-
IsNumeric
GoObject v1.0Properties of basic types.
-
IsOrdered
GoObject v1.0Properties of basic types.
-
IsString
GoObject v1.0Properties of basic types.
-
IsUnsigned
GoObject v1.0Properties of basic types.
-
IsUntyped
GoObject v1.0Properties of basic types.
-
MethodExpr
GoObject v1.0x.f is a method expression
-
MethodVal
GoObject v1.0x.f is a method selector
-
RecvOnly
GoObject v1.0The direction of a channel is indicated by one of these constants.
-
Rune
GoObject v1.0 -
SendOnly
GoObject v1.0The direction of a channel is indicated by one of these constants.
-
SendRecv
GoObject v1.0The direction of a channel is indicated by one of these constants.
-
String
GoObject v1.0 -
Typ
Var v1.0Typ contains the predeclared *Basic types indexed by their
corresponding BasicKind.
The *Basic type for Typ[Byte] will have the name "uint8".
Use Universe.Lookup("byte").Type() to obtain the specific
alias basic type named "byte" (and analogous for "rune").
-
Uint
GoObject v1.0 -
Uint16
GoObject v1.0 -
Uint32
GoObject v1.0 -
Uint64
GoObject v1.0 -
Uint8
GoObject v1.0 -
Uintptr
GoObject v1.0 -
Universe
Var v1.0The Universe scope contains all predeclared objects of Go.
It is the outermost scope of any chain of nested scopes.
-
Unsafe
Var v1.0The Unsafe package is the package returned by an importer
for the import path "unsafe".
-
UnsafePointer
GoObject v1.0 -
UntypedBool
GoObject v1.0types for untyped values
-
UntypedComplex
GoObject v1.0 -
UntypedFloat
GoObject v1.0 -
UntypedInt
GoObject v1.0 -
UntypedNil
GoObject v1.0 -
UntypedRune
GoObject v1.0 -
UntypedString
GoObject v1.0
Functions, Macros, and Special Forms
-
AssertableTo
Function v1.0(AssertableTo V T)
AssertableTo reports whether a value of type V can be asserted to have type T.
The behavior of AssertableTo is undefined in two cases:
- if V is a generalized interface; i.e., an interface that may only be used
as a type constraint in Go code
- if T is an uninstantiated generic type
Go input arguments: (V *Interface, T Type)
Go returns: bool
Joker input arguments: [^*Interface V, ^Type T]
Joker returns: ^Boolean -
AssignableTo
Function v1.0(AssignableTo V T)
AssignableTo reports whether a value of type V is assignable to a variable
of type T.
The behavior of AssignableTo is undefined if V or T is an uninstantiated
generic type.
Go input arguments: (V Type, T Type)
Go returns: bool
Joker input arguments: [^Type V, ^Type T]
Joker returns: ^Boolean -
CheckExpr
Function v1.0(CheckExpr fset pkg pos expr info)
CheckExpr type checks the expression expr as if it had appeared at position
pos of package pkg. Type information about the expression is recorded in
info. The expression may be an identifier denoting an uninstantiated generic
function or type.
If pkg == nil, the Universe scope is used and the provided
position pos is ignored. If pkg != nil, and pos is invalid,
the package scope is used. Otherwise, pos must belong to the
package.
An error is returned if pos is not within the package or
if the node cannot be type-checked.
Note: Eval and CheckExpr should not be used instead of running Check
to compute types and values, but in addition to Check, as these
functions ignore the context in which an expression is used (e.g., an
assignment). Thus, top-level untyped constants will return an
untyped type rather then the respective context-specific type.
Go input arguments: (fset *go/token.FileSet, pkg *Package, pos go/token.Pos, expr go/ast.Expr, info *Info)
Go returns: error
Joker input arguments: [^go.std.go.token/*FileSet fset, ^*Package pkg, ^go.std.go.token/Pos pos, ^go.std.go.ast/Expr expr, ^*Info info]
Joker returns: ^Error err -
Comparable
Function v1.0(Comparable T)
Comparable reports whether values of type T are comparable.
Go input arguments: (T Type)
Go returns: bool
Joker input arguments: [^Type T]
Joker returns: ^Boolean -
ConvertibleTo
Function v1.0(ConvertibleTo V T)
ConvertibleTo reports whether a value of type V is convertible to a value of
type T.
The behavior of ConvertibleTo is undefined if V or T is an uninstantiated
generic type.
Go input arguments: (V Type, T Type)
Go returns: bool
Joker input arguments: [^Type V, ^Type T]
Joker returns: ^Boolean -
DefPredeclaredTestFuncs
Function v1.0(DefPredeclaredTestFuncs)
DefPredeclaredTestFuncs defines the assert and trace built-ins.
These built-ins are intended for debugging and testing of this
package only.
Joker input arguments: [] -
Default
Function v1.0(Default t)
Default returns the default "typed" type for an "untyped" type;
it returns the incoming type for all other types. The default type
for untyped nil is untyped nil.
Go input arguments: (t Type)
Go returns: Type
Joker input arguments: [^Type t]
Joker returns: ^Type -
Eval
Function v1.0(Eval fset pkg pos expr)
Eval returns the type and, if constant, the value for the
expression expr, evaluated at position pos of package pkg,
which must have been derived from type-checking an AST with
complete position information relative to the provided file
set.
The meaning of the parameters fset, pkg, and pos is the
same as in CheckExpr. An error is returned if expr cannot
be parsed successfully, or the resulting expr AST cannot be
type-checked.
Go input arguments: (fset *go/token.FileSet, pkg *Package, pos go/token.Pos, expr string)
Go returns: (_ TypeAndValue, err error)
Joker input arguments: [^go.std.go.token/*FileSet fset, ^*Package pkg, ^go.std.go.token/Pos pos, ^String expr]
Joker returns: [^TypeAndValue _, ^Error err] -
ExprString
Function v1.0(ExprString x)
ExprString returns the (possibly shortened) string representation for x.
Shortened representations are suitable for user interfaces but may not
necessarily follow Go syntax.
Go input arguments: (x go/ast.Expr)
Go returns: string
Joker input arguments: [^go.std.go.ast/Expr x]
Joker returns: ^String -
Id
Function v1.0(Id pkg name)
Id returns name if it is exported, otherwise it
returns the name qualified with the package path.
Go input arguments: (pkg *Package, name string)
Go returns: string
Joker input arguments: [^*Package pkg, ^String name]
Joker returns: ^String -
Identical
Function v1.0(Identical x y)
Identical reports whether x and y are identical types.
Receivers of Signature types are ignored.
Go input arguments: (x Type, y Type)
Go returns: bool
Joker input arguments: [^Type x, ^Type y]
Joker returns: ^Boolean -
IdenticalIgnoreTags
Function v1.0(IdenticalIgnoreTags x y)
IdenticalIgnoreTags reports whether x and y are identical types if tags are ignored.
Receivers of Signature types are ignored.
Go input arguments: (x Type, y Type)
Go returns: bool
Joker input arguments: [^Type x, ^Type y]
Joker returns: ^Boolean -
Implements
Function v1.0(Implements V T)
Implements reports whether type V implements interface T.
The behavior of Implements is undefined if V is an uninstantiated generic
type.
Go input arguments: (V Type, T *Interface)
Go returns: bool
Joker input arguments: [^Type V, ^*Interface T]
Joker returns: ^Boolean -
Instantiate
Function v1.0(Instantiate ctxt orig targs validate)
Instantiate instantiates the type orig with the given type arguments targs.
orig must be a *Named or a *Signature type. If there is no error, the
resulting Type is an instantiated type of the same kind (either a *Named or
a *Signature). Methods attached to a *Named type are also instantiated, and
associated with a new *Func that has the same position as the original
method, but nil function scope.
If ctxt is non-nil, it may be used to de-duplicate the instance against
previous instances with the same identity. As a special case, generic
*Signature origin types are only considered identical if they are pointer
equivalent, so that instantiating distinct (but possibly identical)
signatures will yield different instances. The use of a shared context does
not guarantee that identical instances are deduplicated in all cases.
If validate is set, Instantiate verifies that the number of type arguments
and parameters match, and that the type arguments satisfy their
corresponding type constraints. If verification fails, the resulting error
may wrap an *ArgumentError indicating which type argument did not satisfy
its corresponding type parameter constraint, and why.
If validate is not set, Instantiate does not verify the type argument count
or whether the type arguments satisfy their constraints. Instantiate is
guaranteed to not return an error, but may panic. Specifically, for
*Signature types, Instantiate will panic immediately if the type argument
count is incorrect; for *Named types, a panic may occur later inside the
*Named API.
Go input arguments: (ctxt *Context, orig Type, targs []Type, validate bool)
Go returns: (Type, error)
Joker input arguments: [^*Context ctxt, ^Type orig, ^arrayOfType targs, ^Boolean validate]
Joker returns: [^Type, ^Error] -
IsInterface
Function v1.0(IsInterface t)
IsInterface reports whether t is an interface type.
Go input arguments: (t Type)
Go returns: bool
Joker input arguments: [^Type t]
Joker returns: ^Boolean -
LookupFieldOrMethod
Function v1.0(LookupFieldOrMethod T addressable pkg name)
LookupFieldOrMethod looks up a field or method with given package and name
in T and returns the corresponding *Var or *Func, an index sequence, and a
bool indicating if there were any pointer indirections on the path to the
field or method. If addressable is set, T is the type of an addressable
variable (only matters for method lookups). T must not be nil.
The last index entry is the field or method index in the (possibly embedded)
type where the entry was found, either:
1. the list of declared methods of a named type; or
2. the list of all methods (method set) of an interface type; or
3. the list of fields of a struct type.
The earlier index entries are the indices of the embedded struct fields
traversed to get to the found entry, starting at depth 0.
If no entry is found, a nil object is returned. In this case, the returned
index and indirect values have the following meaning:
- If index != nil, the index sequence points to an ambiguous entry
(the same name appeared more than once at the same embedding level).
- If indirect is set, a method with a pointer receiver type was found
but there was no pointer on the path from the actual receiver type to
the method's formal receiver base type, nor was the receiver addressable.
Go input arguments: (T Type, addressable bool, pkg *Package, name string)
Go returns: (obj Object, index []int, indirect bool)
Joker input arguments: [^Type T, ^Boolean addressable, ^*Package pkg, ^String name]
Joker returns: [^Object obj, ^arrayOfInt index, ^Boolean indirect] -
MissingMethod
Function v1.0(MissingMethod V T static)
MissingMethod returns (nil, false) if V implements T, otherwise it
returns a missing method required by T and whether it is missing or
just has the wrong type.
For non-interface types V, or if static is set, V implements T if all
methods of T are present in V. Otherwise (V is an interface and static
is not set), MissingMethod only checks that methods of T which are also
present in V have matching types (e.g., for a type assertion x.(T) where
x is of interface type V).
Go input arguments: (V Type, T *Interface, static bool)
Go returns: (method *Func, wrongType bool)
Joker input arguments: [^Type V, ^*Interface T, ^Boolean static]
Joker returns: [^*Func method, ^Boolean wrongType] -
NewArray
Function v1.0(NewArray elem len)
NewArray returns a new array type for the given element type and length.
A negative length indicates an unknown length.
Go input arguments: (elem Type, len int64)
Go returns: *Array
Joker input arguments: [^Type elem, ^BigInt len]
Joker returns: ^*Array -
NewChan
Function v1.0(NewChan dir elem)
NewChan returns a new channel type for the given direction and element type.
Go input arguments: (dir ChanDir, elem Type)
Go returns: *Chan
Joker input arguments: [^ChanDir dir, ^Type elem]
Joker returns: ^*Chan -
NewChecker
Function v1.0(NewChecker conf fset pkg info)
NewChecker returns a new Checker instance for a given package.
Package files may be added incrementally via checker.Files.
Go input arguments: (conf *Config, fset *go/token.FileSet, pkg *Package, info *Info)
Go returns: *Checker
Joker input arguments: [^*Config conf, ^go.std.go.token/*FileSet fset, ^*Package pkg, ^*Info info]
Joker returns: ^*Checker -
NewConst
Function v1.0(NewConst pos pkg name typ val)
NewConst returns a new constant with value val.
The remaining arguments set the attributes found with all Objects.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, typ Type, val go/constant.Value)
Go returns: *Const
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^Type typ, ^go.std.go.constant/Value val]
Joker returns: ^*Const -
NewContext
Function v1.0(NewContext)
NewContext creates a new Context.
Go returns: *Context
Joker input arguments: []
Joker returns: ^*Context -
NewField
Function v1.0(NewField pos pkg name typ embedded)
NewField returns a new variable representing a struct field.
For embedded fields, the name is the unqualified type name
/ under which the field is accessible.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, typ Type, embedded bool)
Go returns: *Var
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^Type typ, ^Boolean embedded]
Joker returns: ^*Var -
NewFunc
Function v1.0(NewFunc pos pkg name sig)
NewFunc returns a new function with the given signature, representing
the function's type.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, sig *Signature)
Go returns: *Func
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^*Signature sig]
Joker returns: ^*Func -
NewInterface
Function v1.0(NewInterface methods embeddeds)
NewInterface returns a new interface for the given methods and embedded types.
NewInterface takes ownership of the provided methods and may modify their types
by setting missing receivers.
Deprecated: Use NewInterfaceType instead which allows arbitrary embedded types.
Go input arguments: (methods []*Func, embeddeds []*Named)
Go returns: *Interface
Joker input arguments: [^arrayOf*Func methods, ^arrayOf*Named embeddeds]
Joker returns: ^*Interface -
NewInterfaceType
Function v1.0(NewInterfaceType methods embeddeds)
NewInterfaceType returns a new interface for the given methods and embedded
types. NewInterfaceType takes ownership of the provided methods and may
modify their types by setting missing receivers.
To avoid race conditions, the interface's type set should be computed before
concurrent use of the interface, by explicitly calling Complete.
Go input arguments: (methods []*Func, embeddeds []Type)
Go returns: *Interface
Joker input arguments: [^arrayOf*Func methods, ^arrayOfType embeddeds]
Joker returns: ^*Interface -
NewLabel
Function v1.0(NewLabel pos pkg name)
NewLabel returns a new label.
Go input arguments: (pos go/token.Pos, pkg *Package, name string)
Go returns: *Label
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name]
Joker returns: ^*Label -
NewMap
Function v1.0(NewMap key elem)
NewMap returns a new map for the given key and element types.
Go input arguments: (key Type, elem Type)
Go returns: *Map
Joker input arguments: [^Type key, ^Type elem]
Joker returns: ^*Map -
NewMethodSet
Function v1.0(NewMethodSet T)
NewMethodSet returns the method set for the given type T.
It always returns a non-nil method set, even if it is empty.
Go input arguments: (T Type)
Go returns: *MethodSet
Joker input arguments: [^Type T]
Joker returns: ^*MethodSet -
NewNamed
Function v1.0(NewNamed obj underlying methods)
NewNamed returns a new named type for the given type name, underlying type, and associated methods.
If the given type name obj doesn't have a type yet, its type is set to the returned named type.
The underlying type must not be a *Named.
Go input arguments: (obj *TypeName, underlying Type, methods []*Func)
Go returns: *Named
Joker input arguments: [^*TypeName obj, ^Type underlying, ^arrayOf*Func methods]
Joker returns: ^*Named -
NewPackage
Function v1.0(NewPackage path name)
NewPackage returns a new Package for the given package path and name.
The package is not complete and contains no explicit imports.
Go input arguments: (path string, name string)
Go returns: *Package
Joker input arguments: [^String path, ^String name]
Joker returns: ^*Package -
NewParam
Function v1.0(NewParam pos pkg name typ)
NewParam returns a new variable representing a function parameter.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, typ Type)
Go returns: *Var
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^Type typ]
Joker returns: ^*Var -
NewPkgName
Function v1.0(NewPkgName pos pkg name imported)
NewPkgName returns a new PkgName object representing an imported package.
The remaining arguments set the attributes found with all Objects.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, imported *Package)
Go returns: *PkgName
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^*Package imported]
Joker returns: ^*PkgName -
NewPointer
Function v1.0(NewPointer elem)
NewPointer returns a new pointer type for the given element (base) type.
Go input arguments: (elem Type)
Go returns: *Pointer
Joker input arguments: [^Type elem]
Joker returns: ^*Pointer -
NewScope
Function v1.0(NewScope parent pos end comment)
NewScope returns a new, empty scope contained in the given parent
scope, if any. The comment is for debugging only.
Go input arguments: (parent *Scope, pos go/token.Pos, end go/token.Pos, comment string)
Go returns: *Scope
Joker input arguments: [^*Scope parent, ^go.std.go.token/Pos pos, ^go.std.go.token/Pos end, ^String comment]
Joker returns: ^*Scope -
NewSignature
Function v1.0(NewSignature recv params results variadic)
NewSignature returns a new function type for the given receiver, parameters,
and results, either of which may be nil. If variadic is set, the function
is variadic, it must have at least one parameter, and the last parameter
must be of unnamed slice type.
Deprecated: Use NewSignatureType instead which allows for type parameters.
Go input arguments: (recv *Var, params *Tuple, results *Tuple, variadic bool)
Go returns: *Signature
Joker input arguments: [^*Var recv, ^*Tuple params, ^*Tuple results, ^Boolean variadic]
Joker returns: ^*Signature -
NewSignatureType
Function v1.0(NewSignatureType recv recvTypeParams typeParams params results variadic)
NewSignatureType creates a new function type for the given receiver,
receiver type parameters, type parameters, parameters, and results. If
variadic is set, params must hold at least one parameter and the last
parameter's core type must be of unnamed slice or bytestring type.
If recv is non-nil, typeParams must be empty. If recvTypeParams is
non-empty, recv must be non-nil.
Go input arguments: (recv *Var, recvTypeParams []*TypeParam, typeParams []*TypeParam, params *Tuple, results *Tuple, variadic bool)
Go returns: *Signature
Joker input arguments: [^*Var recv, ^arrayOf*TypeParam recvTypeParams, ^arrayOf*TypeParam typeParams, ^*Tuple params, ^*Tuple results, ^Boolean variadic]
Joker returns: ^*Signature -
NewSlice
Function v1.0(NewSlice elem)
NewSlice returns a new slice type for the given element type.
Go input arguments: (elem Type)
Go returns: *Slice
Joker input arguments: [^Type elem]
Joker returns: ^*Slice -
NewStruct
Function v1.0(NewStruct fields tags)
NewStruct returns a new struct with the given fields and corresponding field tags.
If a field with index i has a tag, tags[i] must be that tag, but len(tags) may be
only as long as required to hold the tag with the largest index i. Consequently,
if no field has a tag, tags may be nil.
Go input arguments: (fields []*Var, tags []string)
Go returns: *Struct
Joker input arguments: [^arrayOf*Var fields, ^arrayOfString tags]
Joker returns: ^*Struct -
NewTerm
Function v1.0(NewTerm tilde typ)
NewTerm returns a new union term.
Go input arguments: (tilde bool, typ Type)
Go returns: *Term
Joker input arguments: [^Boolean tilde, ^Type typ]
Joker returns: ^*Term -
NewTuple
Function v1.0(NewTuple & x)
NewTuple returns a new tuple for the given variables.
Go input arguments: (x ...*Var)
Go returns: *Tuple
Joker input arguments: [& ^*Var x]
Joker returns: ^*Tuple -
NewTypeName
Function v1.0(NewTypeName pos pkg name typ)
NewTypeName returns a new type name denoting the given typ.
The remaining arguments set the attributes found with all Objects.
The typ argument may be a defined (Named) type or an alias type.
It may also be nil such that the returned TypeName can be used as
argument for NewNamed, which will set the TypeName's type as a side-
effect.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, typ Type)
Go returns: *TypeName
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^Type typ]
Joker returns: ^*TypeName -
NewTypeParam
Function v1.0(NewTypeParam obj constraint)
NewTypeParam returns a new TypeParam. Type parameters may be set on a Named
or Signature type by calling SetTypeParams. Setting a type parameter on more
than one type will result in a panic.
The constraint argument can be nil, and set later via SetConstraint. If the
constraint is non-nil, it must be fully defined.
Go input arguments: (obj *TypeName, constraint Type)
Go returns: *TypeParam
Joker input arguments: [^*TypeName obj, ^Type constraint]
Joker returns: ^*TypeParam -
NewUnion
Function v1.0(NewUnion terms)
NewUnion returns a new Union type with the given terms.
It is an error to create an empty union; they are syntactically not possible.
Go input arguments: (terms []*Term)
Go returns: *Union
Joker input arguments: [^arrayOf*Term terms]
Joker returns: ^*Union -
NewVar
Function v1.0(NewVar pos pkg name typ)
NewVar returns a new variable.
The arguments set the attributes found with all Objects.
Go input arguments: (pos go/token.Pos, pkg *Package, name string, typ Type)
Go returns: *Var
Joker input arguments: [^go.std.go.token/Pos pos, ^*Package pkg, ^String name, ^Type typ]
Joker returns: ^*Var -
ObjectString
Function v1.0(ObjectString obj qf)
ObjectString returns the string form of obj.
The Qualifier controls the printing of
package-level objects, and may be nil.
Go input arguments: (obj Object, qf Qualifier)
Go returns: string
Joker input arguments: [^Object obj, ^Qualifier qf]
Joker returns: ^String -
RelativeTo
Function v1.0(RelativeTo pkg)
RelativeTo returns a Qualifier that fully qualifies members of
all packages other than pkg.
Go input arguments: (pkg *Package)
Go returns: Qualifier
Joker input arguments: [^*Package pkg]
Joker returns: ^Qualifier -
SelectionString
Function v1.0(SelectionString s qf)
SelectionString returns the string form of s.
The Qualifier controls the printing of
package-level objects, and may be nil.
Examples:
"field (T) f int"
"method (T) f(X) Y"
"method expr (T) f(X) Y"
Go input arguments: (s *Selection, qf Qualifier)
Go returns: string
Joker input arguments: [^*Selection s, ^Qualifier qf]
Joker returns: ^String -
SizesFor
Function v1.0(SizesFor compiler arch)
SizesFor returns the Sizes used by a compiler for an architecture.
The result is nil if a compiler/architecture pair is not known.
Supported architectures for compiler "gc":
"386", "arm", "arm64", "amd64", "amd64p32", "mips", "mipsle",
"mips64", "mips64le", "ppc64", "ppc64le", "riscv64", "s390x", "sparc64", "wasm".
Go input arguments: (compiler string, arch string)
Go returns: Sizes
Joker input arguments: [^String compiler, ^String arch]
Joker returns: ^Sizes -
TypeString
Function v1.0(TypeString typ qf)
TypeString returns the string representation of typ.
The Qualifier controls the printing of
package-level objects, and may be nil.
Go input arguments: (typ Type, qf Qualifier)
Go returns: string
Joker input arguments: [^Type typ, ^Qualifier qf]
Joker returns: ^String -
WriteExpr
Function v1.0(WriteExpr buf x)
WriteExpr writes the (possibly shortened) string representation for x to buf.
Shortened representations are suitable for user interfaces but may not
necessarily follow Go syntax.
Go input arguments: (buf *bytes.Buffer, x go/ast.Expr)
Joker input arguments: [^go.std.bytes/*Buffer buf, ^go.std.go.ast/Expr x] -
WriteSignature
Function v1.0(WriteSignature buf sig qf)
WriteSignature writes the representation of the signature sig to buf,
without a leading "func" keyword.
The Qualifier controls the printing of
package-level objects, and may be nil.
Go input arguments: (buf *bytes.Buffer, sig *Signature, qf Qualifier)
Joker input arguments: [^go.std.bytes/*Buffer buf, ^*Signature sig, ^Qualifier qf] -
WriteType
Function v1.0(WriteType buf typ qf)
WriteType writes the string representation of typ to buf.
The Qualifier controls the printing of
package-level objects, and may be nil.
Go input arguments: (buf *bytes.Buffer, typ Type, qf Qualifier)
Joker input arguments: [^go.std.bytes/*Buffer buf, ^Type typ, ^Qualifier qf]
Types
-
*ArgumentError
Concrete Type v1.0An ArgumentError holds an error associated with an argument index.
-
Error
Receiver for *ArgumentError v1.0([])
-
Unwrap
Receiver for *ArgumentError v1.0([])
-
*Array
Concrete Type v1.0An Array represents an array type.
-
Elem
Receiver for *Array v1.0([])
Elem returns element type of array a.
-
Len
Receiver for *Array v1.0([])
Len returns the length of array a.
A negative result indicates an unknown length.
-
String
Receiver for *Array v1.0([])
-
Underlying
Receiver for *Array v1.0([])
-
*Basic
Concrete Type v1.0A Basic represents a basic type.
-
Info
Receiver for *Basic v1.0([])
Info returns information about properties of basic type b.
-
Kind
Receiver for *Basic v1.0([])
Kind returns the kind of basic type b.
-
Name
Receiver for *Basic v1.0([])
Name returns the name of basic type b.
-
String
Receiver for *Basic v1.0([])
-
Underlying
Receiver for *Basic v1.0([])
-
*BasicInfo
Concrete Type v1.0BasicInfo is a set of flags describing properties of a basic type.
-
*BasicKind
Concrete Type v1.0BasicKind describes the kind of basic type.
-
*Builtin
Concrete Type v1.0A Builtin represents a built-in function.
Builtins don't have a valid type.
-
Exported
Receiver for *Builtin v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *Builtin v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Name
Receiver for *Builtin v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Builtin v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Builtin v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Builtin v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *Builtin v1.0([])
-
Type
Receiver for *Builtin v1.0([])
Type returns the object's type.
-
*Chan
Concrete Type v1.0A Chan represents a channel type.
-
Dir
Receiver for *Chan v1.0([])
Dir returns the direction of channel c.
-
Elem
Receiver for *Chan v1.0([])
Elem returns the element type of channel c.
-
String
Receiver for *Chan v1.0([])
-
Underlying
Receiver for *Chan v1.0([])
-
*ChanDir
Concrete Type v1.0A ChanDir value indicates a channel direction.
-
*Checker
Concrete Type v1.0A Checker maintains the state of the type checker.
It must be created with NewChecker.
-
Files
Receiver for *Checker v1.0([files])
Files checks the provided files as part of the checker's package.
-
ObjectOf
Receiver for *Checker v1.0([id])
ObjectOf returns the object denoted by the specified id,
or nil if not found.
If id is an embedded struct field, ObjectOf returns the field (*Var)
it defines, not the type (*TypeName) it uses.
Precondition: the Uses and Defs maps are populated.
-
TypeOf
Receiver for *Checker v1.0([e])
TypeOf returns the type of expression e, or nil if not found.
Precondition: the Types, Uses and Defs maps are populated.
-
*Config
Concrete Type v1.0A Config specifies the configuration for type checking.
The zero value for Config is a ready-to-use default configuration.
-
Check
Receiver for *Config v1.0([path fset files info])
Check type-checks a package and returns the resulting package object and
the first error if any. Additionally, if info != nil, Check populates each
of the non-nil maps in the Info struct.
The package is marked as complete if no errors occurred, otherwise it is
incomplete. See Config.Error for controlling behavior in the presence of
errors.
The package is specified by a list of *ast.Files and corresponding
file set, and the package path the package is identified with.
The clean path must not be empty or dot (".").
-
*Const
Concrete Type v1.0A Const represents a declared constant.
-
Exported
Receiver for *Const v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *Const v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Name
Receiver for *Const v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Const v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Const v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Const v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *Const v1.0([])
-
Type
Receiver for *Const v1.0([])
Type returns the object's type.
-
Val
Receiver for *Const v1.0([])
Val returns the constant's value.
-
*Context
Concrete Type v1.0A Context is an opaque type checking context. It may be used to share
identical type instances across type-checked packages or calls to
Instantiate. Contexts are safe for concurrent use.
The use of a shared context does not guarantee that identical instances are
deduplicated in all cases.
-
*Error
Concrete Type v1.0An Error describes a type-checking error; it implements the error interface.
A "soft" error is an error that still permits a valid interpretation of a
package (such as "unused variable"); "hard" errors may lead to unpredictable
behavior if ignored.
-
*Func
Concrete Type v1.0A Func represents a declared function, concrete method, or abstract
(interface) method. Its Type() is always a *Signature.
An abstract method may belong to many interfaces due to embedding.
-
Exported
Receiver for *Func v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
FullName
Receiver for *Func v1.0([])
FullName returns the package- or receiver-type-qualified name of
function or method obj.
-
Id
Receiver for *Func v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Name
Receiver for *Func v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Func v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Func v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Func v1.0([])
Pos returns the declaration position of the object's identifier.
-
Scope
Receiver for *Func v1.0([])
Scope returns the scope of the function's body block.
The result is nil for imported or instantiated functions and methods
(but there is also no mechanism to get to an instantiated function).
-
String
Receiver for *Func v1.0([])
-
Type
Receiver for *Func v1.0([])
Type returns the object's type.
-
*ImportMode
Concrete Type v1.0ImportMode is reserved for future use.
-
*Info
Concrete Type v1.0Info holds result type information for a type-checked package.
Only the information for which a map is provided is collected.
If the package has type errors, the collected information may
be incomplete.
-
ObjectOf
Receiver for *Info v1.0([id])
ObjectOf returns the object denoted by the specified id,
or nil if not found.
If id is an embedded struct field, ObjectOf returns the field (*Var)
it defines, not the type (*TypeName) it uses.
Precondition: the Uses and Defs maps are populated.
-
TypeOf
Receiver for *Info v1.0([e])
TypeOf returns the type of expression e, or nil if not found.
Precondition: the Types, Uses and Defs maps are populated.
-
*Initializer
Concrete Type v1.0An Initializer describes a package-level variable, or a list of variables in case
of a multi-valued initialization expression, and the corresponding initialization
expression.
-
String
Receiver for *Initializer v1.0([])
-
*Instance
Concrete Type v1.0Instance reports the type arguments and instantiated type for type and
function instantiations. For type instantiations, Type will be of dynamic
type *Named. For function instantiations, Type will be of dynamic type
*Signature.
-
*Interface
Concrete Type v1.0An Interface represents an interface type.
-
Complete
Receiver for *Interface v1.0([])
Complete computes the interface's type set. It must be called by users of
NewInterfaceType and NewInterface after the interface's embedded types are
fully defined and before using the interface type in any way other than to
form other types. The interface must not contain duplicate methods or a
panic occurs. Complete returns the receiver.
Interface types that have been completed are safe for concurrent use.
-
Embedded
Receiver for *Interface v1.0([i])
Embedded returns the i'th embedded defined (*Named) type of interface t for 0 <= i < t.NumEmbeddeds().
The result is nil if the i'th embedded type is not a defined type.
Deprecated: Use EmbeddedType which is not restricted to defined (*Named) types.
-
EmbeddedType
Receiver for *Interface v1.0([i])
EmbeddedType returns the i'th embedded type of interface t for 0 <= i < t.NumEmbeddeds().
-
Empty
Receiver for *Interface v1.0([])
Empty reports whether t is the empty interface.
-
ExplicitMethod
Receiver for *Interface v1.0([i])
ExplicitMethod returns the i'th explicitly declared method of interface t for 0 <= i < t.NumExplicitMethods().
The methods are ordered by their unique Id.
-
IsComparable
Receiver for *Interface v1.0([])
IsComparable reports whether each type in interface t's type set is comparable.
-
IsImplicit
Receiver for *Interface v1.0([])
IsImplicit reports whether the interface t is a wrapper for a type set literal.
-
IsMethodSet
Receiver for *Interface v1.0([])
IsMethodSet reports whether the interface t is fully described by its method
set.
-
MarkImplicit
Receiver for *Interface v1.0([])
MarkImplicit marks the interface t as implicit, meaning this interface
corresponds to a constraint literal such as ~T or A|B without explicit
interface embedding. MarkImplicit should be called before any concurrent use
of implicit interfaces.
-
Method
Receiver for *Interface v1.0([i])
Method returns the i'th method of interface t for 0 <= i < t.NumMethods().
The methods are ordered by their unique Id.
-
NumEmbeddeds
Receiver for *Interface v1.0([])
NumEmbeddeds returns the number of embedded types in interface t.
-
NumExplicitMethods
Receiver for *Interface v1.0([])
NumExplicitMethods returns the number of explicitly declared methods of interface t.
-
NumMethods
Receiver for *Interface v1.0([])
NumMethods returns the total number of methods of interface t.
-
String
Receiver for *Interface v1.0([])
-
Underlying
Receiver for *Interface v1.0([])
-
*Label
Concrete Type v1.0A Label represents a declared label.
Labels don't have a type.
-
Exported
Receiver for *Label v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *Label v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Name
Receiver for *Label v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Label v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Label v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Label v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *Label v1.0([])
-
Type
Receiver for *Label v1.0([])
Type returns the object's type.
-
*Map
Concrete Type v1.0A Map represents a map type.
-
Elem
Receiver for *Map v1.0([])
Elem returns the element type of map m.
-
Key
Receiver for *Map v1.0([])
Key returns the key type of map m.
-
String
Receiver for *Map v1.0([])
-
Underlying
Receiver for *Map v1.0([])
-
*MethodSet
Concrete Type v1.0A MethodSet is an ordered set of concrete or abstract (interface) methods;
a method is a MethodVal selection, and they are ordered by ascending m.Obj().Id().
The zero value for a MethodSet is a ready-to-use empty method set.
-
At
Receiver for *MethodSet v1.0([i])
At returns the i'th method in s for 0 <= i < s.Len().
-
Len
Receiver for *MethodSet v1.0([])
Len returns the number of methods in s.
-
Lookup
Receiver for *MethodSet v1.0([pkg name])
Lookup returns the method with matching package and name, or nil if not found.
-
String
Receiver for *MethodSet v1.0([])
-
*Named
Concrete Type v1.0A Named represents a named (defined) type.
-
AddMethod
Receiver for *Named v1.0([m])
AddMethod adds method m unless it is already in the method list.
t must not have type arguments.
-
Method
Receiver for *Named v1.0([i])
Method returns the i'th method of named type t for 0 <= i < t.NumMethods().
-
NumMethods
Receiver for *Named v1.0([])
NumMethods returns the number of explicit methods defined for t.
For an ordinary or instantiated type t, the receiver base type of these
methods will be the named type t. For an uninstantiated generic type t, each
method receiver will be instantiated with its receiver type parameters.
-
Obj
Receiver for *Named v1.0([])
Obj returns the type name for the declaration defining the named type t. For
instantiated types, this is same as the type name of the origin type.
-
Origin
Receiver for *Named v1.0([])
Origin returns the generic type from which the named type t is
instantiated. If t is not an instantiated type, the result is t.
-
SetTypeParams
Receiver for *Named v1.0([tparams])
SetTypeParams sets the type parameters of the named type t.
t must not have type arguments.
-
SetUnderlying
Receiver for *Named v1.0([underlying])
SetUnderlying sets the underlying type and marks t as complete.
t must not have type arguments.
-
String
Receiver for *Named v1.0([])
-
TypeArgs
Receiver for *Named v1.0([])
TypeArgs returns the type arguments used to instantiate the named type t.
-
TypeParams
Receiver for *Named v1.0([])
TypeParams returns the type parameters of the named type t, or nil.
The result is non-nil for an (originally) generic type even if it is instantiated.
-
Underlying
Receiver for *Named v1.0([])
-
*Nil
Concrete Type v1.0Nil represents the predeclared value nil.
-
Exported
Receiver for *Nil v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *Nil v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Name
Receiver for *Nil v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Nil v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Nil v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Nil v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *Nil v1.0([])
-
Type
Receiver for *Nil v1.0([])
Type returns the object's type.
-
*Package
Concrete Type v1.0A Package describes a Go package.
-
Complete
Receiver for *Package v1.0([])
A package is complete if its scope contains (at least) all
exported objects; otherwise it is incomplete.
-
Imports
Receiver for *Package v1.0([])
Imports returns the list of packages directly imported by
pkg; the list is in source order.
If pkg was loaded from export data, Imports includes packages that
provide package-level objects referenced by pkg. This may be more or
less than the set of packages directly imported by pkg's source code.
-
MarkComplete
Receiver for *Package v1.0([])
MarkComplete marks a package as complete.
-
Name
Receiver for *Package v1.0([])
Name returns the package name.
-
Path
Receiver for *Package v1.0([])
Path returns the package path.
-
Scope
Receiver for *Package v1.0([])
Scope returns the (complete or incomplete) package scope
holding the objects declared at package level (TypeNames,
Consts, Vars, and Funcs).
-
SetImports
Receiver for *Package v1.0([list])
SetImports sets the list of explicitly imported packages to list.
It is the caller's responsibility to make sure list elements are unique.
-
SetName
Receiver for *Package v1.0([name])
SetName sets the package name.
-
String
Receiver for *Package v1.0([])
-
*PkgName
Concrete Type v1.0A PkgName represents an imported Go package.
PkgNames don't have a type.
-
Exported
Receiver for *PkgName v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *PkgName v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
Imported
Receiver for *PkgName v1.0([])
Imported returns the package that was imported.
It is distinct from Pkg(), which is the package containing the import statement.
-
Name
Receiver for *PkgName v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *PkgName v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *PkgName v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *PkgName v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *PkgName v1.0([])
-
Type
Receiver for *PkgName v1.0([])
Type returns the object's type.
-
*Pointer
Concrete Type v1.0A Pointer represents a pointer type.
-
Elem
Receiver for *Pointer v1.0([])
Elem returns the element type for the given pointer p.
-
String
Receiver for *Pointer v1.0([])
-
Underlying
Receiver for *Pointer v1.0([])
-
*Qualifier
Concrete Type v1.0A Qualifier controls how named package-level objects are printed in
calls to TypeString, ObjectString, and SelectionString.
These three formatting routines call the Qualifier for each
package-level object O, and if the Qualifier returns a non-empty
string p, the object is printed in the form p.O.
If it returns an empty string, only the object name O is printed.
Using a nil Qualifier is equivalent to using (*Package).Path: the
object is qualified by the import path, e.g., "encoding/json.Marshal".
-
*Scope
Concrete Type v1.0A Scope maintains a set of objects and links to its containing
(parent) and contained (children) scopes. Objects may be inserted
and looked up by name. The zero value for Scope is a ready-to-use
empty scope.
-
Child
Receiver for *Scope v1.0([i])
Child returns the i'th child scope for 0 <= i < NumChildren().
-
Contains
Receiver for *Scope v1.0([pos])
Contains reports whether pos is within the scope's extent.
The result is guaranteed to be valid only if the type-checked
AST has complete position information.
-
End
Receiver for *Scope v1.0([])
-
Innermost
Receiver for *Scope v1.0([pos])
Innermost returns the innermost (child) scope containing
pos. If pos is not within any scope, the result is nil.
The result is also nil for the Universe scope.
The result is guaranteed to be valid only if the type-checked
AST has complete position information.
-
Insert
Receiver for *Scope v1.0([obj])
Insert attempts to insert an object obj into scope s.
If s already contains an alternative object alt with
the same name, Insert leaves s unchanged and returns alt.
Otherwise it inserts obj, sets the object's parent scope
if not already set, and returns nil.
-
Len
Receiver for *Scope v1.0([])
Len returns the number of scope elements.
-
Lookup
Receiver for *Scope v1.0([name])
Lookup returns the object in scope s with the given name if such an
object exists; otherwise the result is nil.
-
LookupParent
Receiver for *Scope v1.0([name pos])
LookupParent follows the parent chain of scopes starting with s until
it finds a scope where Lookup(name) returns a non-nil object, and then
returns that scope and object. If a valid position pos is provided,
only objects that were declared at or before pos are considered.
If no such scope and object exists, the result is (nil, nil).
Note that obj.Parent() may be different from the returned scope if the
object was inserted into the scope and already had a parent at that
time (see Insert). This can only happen for dot-imported objects
whose scope is the scope of the package that exported them.
-
Names
Receiver for *Scope v1.0([])
Names returns the scope's element names in sorted order.
-
NumChildren
Receiver for *Scope v1.0([])
NumChildren returns the number of scopes nested in s.
-
Parent
Receiver for *Scope v1.0([])
Parent returns the scope's containing (parent) scope.
-
Pos
Receiver for *Scope v1.0([])
Pos and End describe the scope's source code extent [pos, end).
The results are guaranteed to be valid only if the type-checked
AST has complete position information. The extent is undefined
for Universe and package scopes.
-
String
Receiver for *Scope v1.0([])
String returns a string representation of the scope, for debugging.
-
WriteTo
Receiver for *Scope v1.0([w n recurse])
WriteTo writes a string representation of the scope to w,
with the scope elements sorted by name.
The level of indentation is controlled by n >= 0, with
n == 0 for no indentation.
If recurse is set, it also writes nested (children) scopes.
-
*Selection
Concrete Type v1.0A Selection describes a selector expression x.f.
For the declarations:
type T struct{ x int; E }
type E struct{}
func (e E) m() {}
var p *T
the following relations exist:
Selector Kind Recv Obj Type Index Indirect
p.x FieldVal T x int {0} true
p.m MethodVal *T m func() {1, 0} true
T.m MethodExpr T m func(T) {1, 0} false
-
Index
Receiver for *Selection v1.0([])
Index describes the path from x to f in x.f.
The last index entry is the field or method index of the type declaring f;
either:
1) the list of declared methods of a named type; or
2) the list of methods of an interface type; or
3) the list of fields of a struct type.
The earlier index entries are the indices of the embedded fields implicitly
traversed to get from (the type of) x to f, starting at embedding depth 0.
-
Indirect
Receiver for *Selection v1.0([])
Indirect reports whether any pointer indirection was required to get from
x to f in x.f.
-
Kind
Receiver for *Selection v1.0([])
Kind returns the selection kind.
-
Obj
Receiver for *Selection v1.0([])
Obj returns the object denoted by x.f; a *Var for
a field selection, and a *Func in all other cases.
-
Recv
Receiver for *Selection v1.0([])
Recv returns the type of x in x.f.
-
String
Receiver for *Selection v1.0([])
-
Type
Receiver for *Selection v1.0([])
Type returns the type of x.f, which may be different from the type of f.
See Selection for more information.
-
*SelectionKind
Concrete Type v1.0SelectionKind describes the kind of a selector expression x.f
(excluding qualified identifiers).
-
*Signature
Concrete Type v1.0A Signature represents a (non-builtin) function or method type.
The receiver is ignored when comparing signatures for identity.
-
Params
Receiver for *Signature v1.0([])
Params returns the parameters of signature s, or nil.
-
Recv
Receiver for *Signature v1.0([])
Recv returns the receiver of signature s (if a method), or nil if a
function. It is ignored when comparing signatures for identity.
For an abstract method, Recv returns the enclosing interface either
as a *Named or an *Interface. Due to embedding, an interface may
contain methods whose receiver type is a different interface.
-
RecvTypeParams
Receiver for *Signature v1.0([])
RecvTypeParams returns the receiver type parameters of signature s, or nil.
-
Results
Receiver for *Signature v1.0([])
Results returns the results of signature s, or nil.
-
String
Receiver for *Signature v1.0([])
-
TypeParams
Receiver for *Signature v1.0([])
TypeParams returns the type parameters of signature s, or nil.
-
Underlying
Receiver for *Signature v1.0([])
-
Variadic
Receiver for *Signature v1.0([])
Variadic reports whether the signature s is variadic.
-
*Slice
Concrete Type v1.0A Slice represents a slice type.
-
Elem
Receiver for *Slice v1.0([])
Elem returns the element type of slice s.
-
String
Receiver for *Slice v1.0([])
-
Underlying
Receiver for *Slice v1.0([])
-
*StdSizes
Concrete Type v1.0StdSizes is a convenience type for creating commonly used Sizes.
It makes the following simplifying assumptions:
- The size of explicitly sized basic types (int16, etc.) is the
specified size.
- The size of strings and interfaces is 2*WordSize.
- The size of slices is 3*WordSize.
- The size of an array of n elements corresponds to the size of
a struct of n consecutive fields of the array's element type.
- The size of a struct is the offset of the last field plus that
field's size. As with all element types, if the struct is used
in an array its size must first be aligned to a multiple of the
struct's alignment.
- All other types have size WordSize.
- Arrays and structs are aligned per spec definition; all other
types are naturally aligned with a maximum alignment MaxAlign.
*StdSizes implements Sizes.
-
Alignof
Receiver for *StdSizes v1.0([T])
-
Offsetsof
Receiver for *StdSizes v1.0([fields])
-
Sizeof
Receiver for *StdSizes v1.0([T])
-
*Struct
Concrete Type v1.0A Struct represents a struct type.
-
Field
Receiver for *Struct v1.0([i])
Field returns the i'th field for 0 <= i < NumFields().
-
NumFields
Receiver for *Struct v1.0([])
NumFields returns the number of fields in the struct (including blank and embedded fields).
-
String
Receiver for *Struct v1.0([])
-
Tag
Receiver for *Struct v1.0([i])
Tag returns the i'th field tag for 0 <= i < NumFields().
-
Underlying
Receiver for *Struct v1.0([])
-
*Term
Concrete Type v1.0A Term represents a term in a Union.
-
String
Receiver for *Term v1.0([])
-
Tilde
Receiver for *Term v1.0([])
-
Type
Receiver for *Term v1.0([])
-
*Tuple
Concrete Type v1.0A Tuple represents an ordered list of variables; a nil *Tuple is a valid (empty) tuple.
Tuples are used as components of signatures and to represent the type of multiple
assignments; they are not first class types of Go.
-
At
Receiver for *Tuple v1.0([i])
At returns the i'th variable of tuple t.
-
Len
Receiver for *Tuple v1.0([])
Len returns the number variables of tuple t.
-
String
Receiver for *Tuple v1.0([])
-
Underlying
Receiver for *Tuple v1.0([])
-
*TypeAndValue
Concrete Type v1.0TypeAndValue reports the type and value (for constants)
of the corresponding expression.
-
*TypeList
Concrete Type v1.0TypeList holds a list of types.
-
At
Receiver for *TypeList v1.0([i])
At returns the i'th type in the list.
-
Len
Receiver for *TypeList v1.0([])
Len returns the number of types in the list.
It is safe to call on a nil receiver.
-
*TypeName
Concrete Type v1.0A TypeName represents a name for a (defined or alias) type.
-
Exported
Receiver for *TypeName v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *TypeName v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
IsAlias
Receiver for *TypeName v1.0([])
IsAlias reports whether obj is an alias name for a type.
-
Name
Receiver for *TypeName v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *TypeName v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *TypeName v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *TypeName v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *TypeName v1.0([])
-
Type
Receiver for *TypeName v1.0([])
Type returns the object's type.
-
*TypeParam
Concrete Type v1.0A TypeParam represents a type parameter type.
-
Constraint
Receiver for *TypeParam v1.0([])
Constraint returns the type constraint specified for t.
-
Index
Receiver for *TypeParam v1.0([])
Index returns the index of the type param within its param list, or -1 if
the type parameter has not yet been bound to a type.
-
Obj
Receiver for *TypeParam v1.0([])
Obj returns the type name for t.
-
SetConstraint
Receiver for *TypeParam v1.0([bound])
SetConstraint sets the type constraint for t.
It must be called by users of NewTypeParam after the bound's underlying is
fully defined, and before using the type parameter in any way other than to
form other types. Once SetConstraint returns the receiver, t is safe for
concurrent use.
-
String
Receiver for *TypeParam v1.0([])
-
Underlying
Receiver for *TypeParam v1.0([])
-
*TypeParamList
Concrete Type v1.0TypeParamList holds a list of type parameters.
-
At
Receiver for *TypeParamList v1.0([i])
At returns the i'th type parameter in the list.
-
Len
Receiver for *TypeParamList v1.0([])
Len returns the number of type parameters in the list.
It is safe to call on a nil receiver.
-
*Union
Concrete Type v1.0A Union represents a union of terms embedded in an interface.
-
Len
Receiver for *Union v1.0([])
-
String
Receiver for *Union v1.0([])
-
Term
Receiver for *Union v1.0([i])
-
Underlying
Receiver for *Union v1.0([])
-
*Var
Concrete Type v1.0A Variable represents a declared variable (including function parameters and results, and struct fields).
-
Anonymous
Receiver for *Var v1.0([])
Anonymous reports whether the variable is an embedded field.
Same as Embedded; only present for backward-compatibility.
-
Embedded
Receiver for *Var v1.0([])
Embedded reports whether the variable is an embedded field.
-
Exported
Receiver for *Var v1.0([])
Exported reports whether the object is exported (starts with a capital letter).
It doesn't take into account whether the object is in a local (function) scope
or not.
-
Id
Receiver for *Var v1.0([])
Id is a wrapper for Id(obj.Pkg(), obj.Name()).
-
IsField
Receiver for *Var v1.0([])
IsField reports whether the variable is a struct field.
-
Name
Receiver for *Var v1.0([])
Name returns the object's (package-local, unqualified) name.
-
Parent
Receiver for *Var v1.0([])
Parent returns the scope in which the object is declared.
The result is nil for methods and struct fields.
-
Pkg
Receiver for *Var v1.0([])
Pkg returns the package to which the object belongs.
The result is nil for labels and objects in the Universe scope.
-
Pos
Receiver for *Var v1.0([])
Pos returns the declaration position of the object's identifier.
-
String
Receiver for *Var v1.0([])
-
Type
Receiver for *Var v1.0([])
Type returns the object's type.
-
ArgumentError
Concrete Type v1.0An ArgumentError holds an error associated with an argument index.
-
Array
Concrete Type v1.0An Array represents an array type.
-
Basic
Concrete Type v1.0A Basic represents a basic type.
-
BasicInfo
Concrete Type v1.0BasicInfo is a set of flags describing properties of a basic type.
-
BasicKind
Concrete Type v1.0BasicKind describes the kind of basic type.
-
Builtin
Concrete Type v1.0A Builtin represents a built-in function.
Builtins don't have a valid type.
-
Chan
Concrete Type v1.0A Chan represents a channel type.
-
ChanDir
Concrete Type v1.0A ChanDir value indicates a channel direction.
-
Checker
Concrete Type v1.0A Checker maintains the state of the type checker.
It must be created with NewChecker.
-
ObjectOf
Receiver for Checker v1.0([id])
ObjectOf returns the object denoted by the specified id,
or nil if not found.
If id is an embedded struct field, ObjectOf returns the field (*Var)
it defines, not the type (*TypeName) it uses.
Precondition: the Uses and Defs maps are populated.
-
TypeOf
Receiver for Checker v1.0([e])
TypeOf returns the type of expression e, or nil if not found.
Precondition: the Types, Uses and Defs maps are populated.
-
Config
Concrete Type v1.0A Config specifies the configuration for type checking.
The zero value for Config is a ready-to-use default configuration.
-
Const
Concrete Type v1.0A Const represents a declared constant.
-
Context
Concrete Type v1.0A Context is an opaque type checking context. It may be used to share
identical type instances across type-checked packages or calls to
Instantiate. Contexts are safe for concurrent use.
The use of a shared context does not guarantee that identical instances are
deduplicated in all cases.
-
Error
Concrete Type v1.0An Error describes a type-checking error; it implements the error interface.
A "soft" error is an error that still permits a valid interpretation of a
package (such as "unused variable"); "hard" errors may lead to unpredictable
behavior if ignored.
-
Error
Receiver for Error v1.0([])
Error returns an error string formatted as follows:
filename:line:column: message
-
Func
Concrete Type v1.0A Func represents a declared function, concrete method, or abstract
(interface) method. Its Type() is always a *Signature.
An abstract method may belong to many interfaces due to embedding.
-
ImportMode
Concrete Type v1.0ImportMode is reserved for future use.
-
Importer
Abstract Type v1.0An Importer resolves import paths to Packages.
CAUTION: This interface does not support the import of locally
vendored packages. See https://golang.org/s/go15vendor.
If possible, external implementations should implement ImporterFrom.
-
Import
Method for Importer v1.0([path])
-
ImporterFrom
Abstract Type v1.0An ImporterFrom resolves import paths to packages; it
supports vendoring per https://golang.org/s/go15vendor.
Use go/importer to obtain an ImporterFrom implementation.
-
Import
Method for ImporterFrom v1.0([path])
-
ImportFrom
Method for ImporterFrom v1.0([path dir mode])
-
Info
Concrete Type v1.0Info holds result type information for a type-checked package.
Only the information for which a map is provided is collected.
If the package has type errors, the collected information may
be incomplete.
-
Initializer
Concrete Type v1.0An Initializer describes a package-level variable, or a list of variables in case
of a multi-valued initialization expression, and the corresponding initialization
expression.
-
Instance
Concrete Type v1.0Instance reports the type arguments and instantiated type for type and
function instantiations. For type instantiations, Type will be of dynamic
type *Named. For function instantiations, Type will be of dynamic type
*Signature.
-
Interface
Concrete Type v1.0An Interface represents an interface type.
-
Label
Concrete Type v1.0A Label represents a declared label.
Labels don't have a type.
-
Map
Concrete Type v1.0A Map represents a map type.
-
MethodSet
Concrete Type v1.0A MethodSet is an ordered set of concrete or abstract (interface) methods;
a method is a MethodVal selection, and they are ordered by ascending m.Obj().Id().
The zero value for a MethodSet is a ready-to-use empty method set.
-
Named
Concrete Type v1.0A Named represents a named (defined) type.
-
Nil
Concrete Type v1.0Nil represents the predeclared value nil.
-
Object
Abstract Type v1.0An Object describes a named language entity such as a package,
constant, type, variable, function (incl. methods), or label.
All objects implement the Object interface.
-
Exported
Method for Object v1.0([])
-
Id
Method for Object v1.0([])
-
Name
Method for Object v1.0([])
-
Parent
Method for Object v1.0([])
-
Pkg
Method for Object v1.0([])
-
Pos
Method for Object v1.0([])
-
String
Method for Object v1.0([])
-
Type
Method for Object v1.0([])
-
Package
Concrete Type v1.0A Package describes a Go package.
-
PkgName
Concrete Type v1.0A PkgName represents an imported Go package.
PkgNames don't have a type.
-
Pointer
Concrete Type v1.0A Pointer represents a pointer type.
-
Qualifier
Concrete Type v1.0A Qualifier controls how named package-level objects are printed in
calls to TypeString, ObjectString, and SelectionString.
These three formatting routines call the Qualifier for each
package-level object O, and if the Qualifier returns a non-empty
string p, the object is printed in the form p.O.
If it returns an empty string, only the object name O is printed.
Using a nil Qualifier is equivalent to using (*Package).Path: the
object is qualified by the import path, e.g., "encoding/json.Marshal".
-
Scope
Concrete Type v1.0A Scope maintains a set of objects and links to its containing
(parent) and contained (children) scopes. Objects may be inserted
and looked up by name. The zero value for Scope is a ready-to-use
empty scope.
-
Selection
Concrete Type v1.0A Selection describes a selector expression x.f.
For the declarations:
type T struct{ x int; E }
type E struct{}
func (e E) m() {}
var p *T
the following relations exist:
Selector Kind Recv Obj Type Index Indirect
p.x FieldVal T x int {0} true
p.m MethodVal *T m func() {1, 0} true
T.m MethodExpr T m func(T) {1, 0} false
-
SelectionKind
Concrete Type v1.0SelectionKind describes the kind of a selector expression x.f
(excluding qualified identifiers).
-
Signature
Concrete Type v1.0A Signature represents a (non-builtin) function or method type.
The receiver is ignored when comparing signatures for identity.
-
Sizes
Abstract Type v1.0Sizes defines the sizing functions for package unsafe.
-
Alignof
Method for Sizes v1.0([T])
-
Offsetsof
Method for Sizes v1.0([fields])
-
Sizeof
Method for Sizes v1.0([T])
-
Slice
Concrete Type v1.0A Slice represents a slice type.
-
StdSizes
Concrete Type v1.0StdSizes is a convenience type for creating commonly used Sizes.
It makes the following simplifying assumptions:
- The size of explicitly sized basic types (int16, etc.) is the
specified size.
- The size of strings and interfaces is 2*WordSize.
- The size of slices is 3*WordSize.
- The size of an array of n elements corresponds to the size of
a struct of n consecutive fields of the array's element type.
- The size of a struct is the offset of the last field plus that
field's size. As with all element types, if the struct is used
in an array its size must first be aligned to a multiple of the
struct's alignment.
- All other types have size WordSize.
- Arrays and structs are aligned per spec definition; all other
types are naturally aligned with a maximum alignment MaxAlign.
*StdSizes implements Sizes.
-
Struct
Concrete Type v1.0A Struct represents a struct type.
-
Term
Concrete Type v1.0A Term represents a term in a Union.
-
Tuple
Concrete Type v1.0A Tuple represents an ordered list of variables; a nil *Tuple is a valid (empty) tuple.
Tuples are used as components of signatures and to represent the type of multiple
assignments; they are not first class types of Go.
-
Type
Abstract Type v1.0A Type represents a type of Go.
All types implement the Type interface.
-
String
Method for Type v1.0([])
-
Underlying
Method for Type v1.0([])
-
TypeAndValue
Concrete Type v1.0TypeAndValue reports the type and value (for constants)
of the corresponding expression.
-
Addressable
Receiver for TypeAndValue v1.0([])
Addressable reports whether the corresponding expression
is addressable (https://golang.org/ref/spec#Address_operators).
-
Assignable
Receiver for TypeAndValue v1.0([])
Assignable reports whether the corresponding expression
is assignable to (provided a value of the right type).
-
HasOk
Receiver for TypeAndValue v1.0([])
HasOk reports whether the corresponding expression may be
used on the rhs of a comma-ok assignment.
-
IsBuiltin
Receiver for TypeAndValue v1.0([])
IsBuiltin reports whether the corresponding expression denotes
a (possibly parenthesized) built-in function.
-
IsNil
Receiver for TypeAndValue v1.0([])
IsNil reports whether the corresponding expression denotes the
predeclared value nil.
-
IsType
Receiver for TypeAndValue v1.0([])
IsType reports whether the corresponding expression specifies a type.
-
IsValue
Receiver for TypeAndValue v1.0([])
IsValue reports whether the corresponding expression is a value.
Builtins are not considered values. Constant values have a non-
nil Value.
-
IsVoid
Receiver for TypeAndValue v1.0([])
IsVoid reports whether the corresponding expression
is a function call without results.
-
TypeList
Concrete Type v1.0TypeList holds a list of types.
-
TypeName
Concrete Type v1.0A TypeName represents a name for a (defined or alias) type.
-
TypeParam
Concrete Type v1.0A TypeParam represents a type parameter type.
-
TypeParamList
Concrete Type v1.0TypeParamList holds a list of type parameters.
-
Union
Concrete Type v1.0A Union represents a union of terms embedded in an interface.
-
Var
Concrete Type v1.0A Variable represents a declared variable (including function parameters and results, and struct fields).
-
arrayOfArgumentError
Concrete Type v1.0An ArgumentError holds an error associated with an argument index.
-
arrayOfArray
Concrete Type v1.0An Array represents an array type.
-
arrayOfBasic
Concrete Type v1.0A Basic represents a basic type.
-
arrayOfBasicInfo
Concrete Type v1.0BasicInfo is a set of flags describing properties of a basic type.
-
arrayOfBasicKind
Concrete Type v1.0BasicKind describes the kind of basic type.
-
arrayOfBuiltin
Concrete Type v1.0A Builtin represents a built-in function.
Builtins don't have a valid type.
-
arrayOfChan
Concrete Type v1.0A Chan represents a channel type.
-
arrayOfChanDir
Concrete Type v1.0A ChanDir value indicates a channel direction.
-
arrayOfChecker
Concrete Type v1.0A Checker maintains the state of the type checker.
It must be created with NewChecker.
-
arrayOfConfig
Concrete Type v1.0A Config specifies the configuration for type checking.
The zero value for Config is a ready-to-use default configuration.
-
arrayOfConst
Concrete Type v1.0A Const represents a declared constant.
-
arrayOfContext
Concrete Type v1.0A Context is an opaque type checking context. It may be used to share
identical type instances across type-checked packages or calls to
Instantiate. Contexts are safe for concurrent use.
The use of a shared context does not guarantee that identical instances are
deduplicated in all cases.
-
arrayOfError
Concrete Type v1.0An Error describes a type-checking error; it implements the error interface.
A "soft" error is an error that still permits a valid interpretation of a
package (such as "unused variable"); "hard" errors may lead to unpredictable
behavior if ignored.
-
arrayOfFunc
Concrete Type v1.0A Func represents a declared function, concrete method, or abstract
(interface) method. Its Type() is always a *Signature.
An abstract method may belong to many interfaces due to embedding.
-
arrayOfImportMode
Concrete Type v1.0ImportMode is reserved for future use.
-
arrayOfImporter
Concrete Type v1.0An Importer resolves import paths to Packages.
CAUTION: This interface does not support the import of locally
vendored packages. See https://golang.org/s/go15vendor.
If possible, external implementations should implement ImporterFrom.
-
arrayOfImporterFrom
Concrete Type v1.0An ImporterFrom resolves import paths to packages; it
supports vendoring per https://golang.org/s/go15vendor.
Use go/importer to obtain an ImporterFrom implementation.
-
arrayOfInfo
Concrete Type v1.0Info holds result type information for a type-checked package.
Only the information for which a map is provided is collected.
If the package has type errors, the collected information may
be incomplete.
-
arrayOfInitializer
Concrete Type v1.0An Initializer describes a package-level variable, or a list of variables in case
of a multi-valued initialization expression, and the corresponding initialization
expression.
-
arrayOfInstance
Concrete Type v1.0Instance reports the type arguments and instantiated type for type and
function instantiations. For type instantiations, Type will be of dynamic
type *Named. For function instantiations, Type will be of dynamic type
*Signature.
-
arrayOfInterface
Concrete Type v1.0An Interface represents an interface type.
-
arrayOfLabel
Concrete Type v1.0A Label represents a declared label.
Labels don't have a type.
-
arrayOfMap
Concrete Type v1.0A Map represents a map type.
-
arrayOfMethodSet
Concrete Type v1.0A MethodSet is an ordered set of concrete or abstract (interface) methods;
a method is a MethodVal selection, and they are ordered by ascending m.Obj().Id().
The zero value for a MethodSet is a ready-to-use empty method set.
-
arrayOfNamed
Concrete Type v1.0A Named represents a named (defined) type.
-
arrayOfNil
Concrete Type v1.0Nil represents the predeclared value nil.
-
arrayOfObject
Concrete Type v1.0An Object describes a named language entity such as a package,
constant, type, variable, function (incl. methods), or label.
All objects implement the Object interface.
-
arrayOfPackage
Concrete Type v1.0A Package describes a Go package.
-
arrayOfPkgName
Concrete Type v1.0A PkgName represents an imported Go package.
PkgNames don't have a type.
-
arrayOfPointer
Concrete Type v1.0A Pointer represents a pointer type.
-
arrayOfQualifier
Concrete Type v1.0A Qualifier controls how named package-level objects are printed in
calls to TypeString, ObjectString, and SelectionString.
These three formatting routines call the Qualifier for each
package-level object O, and if the Qualifier returns a non-empty
string p, the object is printed in the form p.O.
If it returns an empty string, only the object name O is printed.
Using a nil Qualifier is equivalent to using (*Package).Path: the
object is qualified by the import path, e.g., "encoding/json.Marshal".
-
arrayOfScope
Concrete Type v1.0A Scope maintains a set of objects and links to its containing
(parent) and contained (children) scopes. Objects may be inserted
and looked up by name. The zero value for Scope is a ready-to-use
empty scope.
-
arrayOfSelection
Concrete Type v1.0A Selection describes a selector expression x.f.
For the declarations:
type T struct{ x int; E }
type E struct{}
func (e E) m() {}
var p *T
the following relations exist:
Selector Kind Recv Obj Type Index Indirect
p.x FieldVal T x int {0} true
p.m MethodVal *T m func() {1, 0} true
T.m MethodExpr T m func(T) {1, 0} false
-
arrayOfSelectionKind
Concrete Type v1.0SelectionKind describes the kind of a selector expression x.f
(excluding qualified identifiers).
-
arrayOfSignature
Concrete Type v1.0A Signature represents a (non-builtin) function or method type.
The receiver is ignored when comparing signatures for identity.
-
arrayOfSizes
Concrete Type v1.0Sizes defines the sizing functions for package unsafe.
-
arrayOfSlice
Concrete Type v1.0A Slice represents a slice type.
-
arrayOfStdSizes
Concrete Type v1.0StdSizes is a convenience type for creating commonly used Sizes.
It makes the following simplifying assumptions:
- The size of explicitly sized basic types (int16, etc.) is the
specified size.
- The size of strings and interfaces is 2*WordSize.
- The size of slices is 3*WordSize.
- The size of an array of n elements corresponds to the size of
a struct of n consecutive fields of the array's element type.
- The size of a struct is the offset of the last field plus that
field's size. As with all element types, if the struct is used
in an array its size must first be aligned to a multiple of the
struct's alignment.
- All other types have size WordSize.
- Arrays and structs are aligned per spec definition; all other
types are naturally aligned with a maximum alignment MaxAlign.
*StdSizes implements Sizes.
-
arrayOfStruct
Concrete Type v1.0A Struct represents a struct type.
-
arrayOfTerm
Concrete Type v1.0A Term represents a term in a Union.
-
arrayOfTuple
Concrete Type v1.0A Tuple represents an ordered list of variables; a nil *Tuple is a valid (empty) tuple.
Tuples are used as components of signatures and to represent the type of multiple
assignments; they are not first class types of Go.
-
arrayOfType
Concrete Type v1.0A Type represents a type of Go.
All types implement the Type interface.
-
arrayOfTypeAndValue
Concrete Type v1.0TypeAndValue reports the type and value (for constants)
of the corresponding expression.
-
arrayOfTypeList
Concrete Type v1.0TypeList holds a list of types.
-
arrayOfTypeName
Concrete Type v1.0A TypeName represents a name for a (defined or alias) type.
-
arrayOfTypeParam
Concrete Type v1.0A TypeParam represents a type parameter type.
-
arrayOfTypeParamList
Concrete Type v1.0TypeParamList holds a list of type parameters.
-
arrayOfUnion
Concrete Type v1.0A Union represents a union of terms embedded in an interface.
-
arrayOfVar
Concrete Type v1.0A Variable represents a declared variable (including function parameters and results, and struct fields).