Documentation ¶
Index ¶
- Constants
- type Argument
- type BasicKind
- type Kind
- type MonoType
- func (mt *MonoType) Argument(i int) (*Argument, error)
- func (mt *MonoType) Basic() (BasicKind, error)
- func (mt *MonoType) ElemType() (*MonoType, error)
- func (mt *MonoType) Extends() (*MonoType, error)
- func (mt *MonoType) Kind() Kind
- func (mt *MonoType) NumArguments() (int, error)
- func (mt *MonoType) NumProperties() (int, error)
- func (mt *MonoType) Property(i int) (*Property, error)
- func (mt *MonoType) ReturnType() (*MonoType, error)
- func (mt MonoType) SortedArguments() ([]*Argument, error)
- func (mt *MonoType) SortedProperties() ([]*Property, error)
- func (mt *MonoType) String() string
- func (mt *MonoType) VarNum() (uint64, error)
- type PolyType
- func (pt *PolyType) Constraint(i int) (*fbsemantic.Constraint, error)
- func (pt *PolyType) Expr() (*MonoType, error)
- func (pt *PolyType) GetCanonicalMapping() (map[uint64]int, error)
- func (pt *PolyType) NumConstraints() int
- func (pt *PolyType) NumVars() int
- func (pt *PolyType) SortedConstraints() ([]*fbsemantic.Constraint, error)
- func (pt PolyType) SortedVars() ([]*fbsemantic.Var, error)
- func (pt *PolyType) String() string
- func (pt *PolyType) Var(i int) (*fbsemantic.Var, error)
- type Property
Constants ¶
const ( Unknown = Kind(fbsemantic.MonoTypeNONE) Basic = Kind(fbsemantic.MonoTypeBasic) Var = Kind(fbsemantic.MonoTypeVar) Arr = Kind(fbsemantic.MonoTypeArr) Row = Kind(fbsemantic.MonoTypeRow) Fun = Kind(fbsemantic.MonoTypeFun) )
const ( Bool = BasicKind(fbsemantic.TypeBool) Int = BasicKind(fbsemantic.TypeInt) Uint = BasicKind(fbsemantic.TypeUint) Float = BasicKind(fbsemantic.TypeFloat) String = BasicKind(fbsemantic.TypeString) Duration = BasicKind(fbsemantic.TypeDuration) Time = BasicKind(fbsemantic.TypeTime) Regexp = BasicKind(fbsemantic.TypeRegexp) Bytes = BasicKind(fbsemantic.TypeBytes) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct {
*fbsemantic.Argument
}
Argument represents a function argument.
type MonoType ¶
type MonoType struct {
// contains filtered or unexported fields
}
MonoType represents a monotype. This struct is a thin wrapper around Go code generated by the FlatBuffers compiler.
func NewMonoType ¶
func NewMonoType(tbl *flatbuffers.Table, t fbsemantic.MonoType) (*MonoType, error)
NewMonoType constructs a new monotype from a FlatBuffers table and the given kind of monotype.
func (*MonoType) Argument ¶
Argument returns the argument give an ordinal position if this monotype is a function, and an error otherwise.
func (*MonoType) Basic ¶
Basic returns the basic type for this monotype if it is a basic type, and an error otherwise.
func (*MonoType) ElemType ¶
ElemType returns the element type if this monotype is an array, and an error otherise.
func (*MonoType) Extends ¶
Extends returns the extending type variable if this monotype is a row, and an error otherwise.
func (*MonoType) NumArguments ¶
NumArguments returns the number of arguments if this monotype is a function, and an error otherwise.
func (*MonoType) NumProperties ¶
NumProperties returns the number of properties if this monotype is a row, and an error otherwise.
func (*MonoType) Property ¶
Property returns a property given its ordinal position if this monotype is a row, and an error otherwise.
func (*MonoType) ReturnType ¶
func (MonoType) SortedArguments ¶ added in v0.59.0
SortedArguments returns a slice of function arguments, sorted by argument name, if this monotype is a function.
func (*MonoType) SortedProperties ¶ added in v0.59.0
SortedProperties returns the properties for a Row monotype, sorted by key. It's possible that there are duplicate keys with different types, in this case, this function preserves their order.
type PolyType ¶
type PolyType struct {
// contains filtered or unexported fields
}
PolyType represents a polytype. This struct is a thin wrapper around Go code generated by the FlatBuffers compiler.
func NewPolyType ¶
func NewPolyType(fb *fbsemantic.PolyType) (*PolyType, error)
NewPolyType returns a new polytype given a flatbuffers polytype.
func (*PolyType) Constraint ¶
func (pt *PolyType) Constraint(i int) (*fbsemantic.Constraint, error)
Constraint returns the constraint at ordinal position i.
func (*PolyType) GetCanonicalMapping ¶ added in v0.59.0
GetCanonicalMapping returns a map of type variable numbers to canonicalized numbers that start from 0. Tests that do type inference will have type variables that are sensitive to changes in the standard library, this helps to solve that problem.
func (*PolyType) NumConstraints ¶
NumConstraints returns the number of kind constraints in this polytype.
func (*PolyType) SortedConstraints ¶ added in v0.59.0
func (pt *PolyType) SortedConstraints() ([]*fbsemantic.Constraint, error)
SortedConstraints returns the constraints for this polytype sorted by type variable and constraint kind.
func (PolyType) SortedVars ¶ added in v0.59.0
func (pt PolyType) SortedVars() ([]*fbsemantic.Var, error)