Documentation ¶
Index ¶
- Variables
- func ConcretizeGenericType(typ schema.Type) schema.Type
- func ConcretizeWithTypeArgs(typ schema.Type, typeArgs []schema.Type) schema.Type
- func Deref(t schema.Type) (schema.Type, int)
- func DerefNamedInfo(t schema.Type, requirePointer bool) (info *pkginfo.PkgDeclInfo, ok bool)
- func IsBuiltinKind(t schema.Type, kinds ...schema.BuiltinKind) bool
- func IsNamed(t schema.Type, pkg paths.Pkg, name string) bool
- func IsPointer(t schema.Type) bool
- func ResolveNamedStruct(t schema.Type, requirePointer bool) (ref *schema.TypeDeclRef, ok bool)
- func UnwrapConfigType(errs *perr.List, t schema.NamedType) (typ schema.Type, isList, isConfig bool)
- func Walk(root schema.Type, visitor func(node schema.Type) bool)
- type TypeHash
Constants ¶
This section is empty.
Variables ¶
var Integers = append(append([]schema.BuiltinKind{}, Signed...), Unsigned...)
Integers is a list of all integer builtin kinds.
Functions ¶
func ConcretizeGenericType ¶
ConcretizeGenericType takes a type and applies any type arguments into the slots of the type parameters, producing a concrete type.
To be more robust in the presence of typing errors it supports partial application, where the number of type arguments may be different than the number of type parameters on the decl.
func ConcretizeWithTypeArgs ¶
ConcretizeWithTypeArgs is like ConcretizeGenericType but operates with a list of type arguments. It is used when the type arguments are known separately from the type itself, such as when using *schema.TypeDeclRef.
func Deref ¶
Deref dereferences a type until it is not a pointer type. It returns the number of pointer dereferences required.
func DerefNamedInfo ¶ added in v1.16.0
DerefNamedInfo returns what package declaration a given named type references, if any.
It always requires at most one pointer dereference, and if requirePointer is true it must be exactly one pointer dereference.
If the type is not a named type or otherwise doesn't match the requirements, it returns (nil, false).
func IsBuiltinKind ¶
func IsBuiltinKind(t schema.Type, kinds ...schema.BuiltinKind) bool
IsBuiltinKind reports whether the given type is a builtin of one of the given kinds.
func IsNamed ¶
IsNamed reports whether a given type is a named type with the given package path and name.
func ResolveNamedStruct ¶
ResolveNamedStruct reports whether a given type is a named type pointing to a struct type.
It always requires at most one pointer dereference, and if requirePointer is true it must be exactly one pointer dereference.
If it doesn't match the requirements it returns (nil, false).
func UnwrapConfigType ¶
UnwrapConfigType unwraps a config.Value[T] or config.Values[T] type to T or []T respectively. If the type is not a config.Value[T] or config.Values[T] type, it returns the type unchanged. If there are any errors encountered they are reported to errs.