Documentation
¶
Overview ¶
Package kind defines type kind enumeration for efficient type discrimination.
Kind values enable fast type classification without reflection, supporting switch-based dispatch throughout the type system. Each type in the typ package returns its Kind via the Kind() method.
Categories ¶
Primitive kinds: Nil, Boolean, Number, Integer, String Represent base Lua types with value semantics.
Top/Bottom types: Any (top), Unknown (unresolved), Never (bottom) Special types for type system boundaries and error handling.
Composite kinds: Optional, Union, Intersection, Tuple, Function, Array, Map, Record Structural types built from other types.
Nominal kinds: Sum, Interface, Alias, Generic, Instantiated Named types with identity-based semantics.
Deferred kinds: Ref, TypeParam, TypeVar, FieldAccess, IndexAccess Types requiring resolution (forward references, generics, projections).
Other kinds: Platform, Literal, Self, Meta, Refined, Recursive Specialized types for platform APIs, literal values, and advanced features.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Kind ¶
type Kind int
Kind identifies the structural category of a type for efficient dispatch. Returned by typ.Type.Kind() to enable type classification without casts.
func FromString ¶
FromString converts a Lua type() result string to a Kind. Returns Unknown for unrecognized strings.
func (Kind) IsComposite ¶
IsComposite returns true for composite types (union, intersection, tuple, etc.).
func (Kind) IsConcrete ¶
IsConcrete returns true for types that are fully resolved (not Any, Unknown, or Never).
func (Kind) IsDeferred ¶
IsDeferred returns true for types that need resolution (ref, typeparam, typevar, fieldaccess, indexaccess).
func (Kind) IsPlaceholder ¶
IsPlaceholder returns true for Any or Unknown kinds. These represent unresolved or open type positions.
func (Kind) IsPrimitive ¶
IsPrimitive returns true for primitive types (nil, boolean, number, integer, string).
func (Kind) IsTopOrBottom ¶ added in v1.5.6
IsTopOrBottom returns true for Any (top), Unknown (unresolved), or Never (bottom).