types

package
v0.59.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

type Argument struct {
	*fbsemantic.Argument
}

Argument represents a function argument.

func (*Argument) TypeOf

func (a *Argument) TypeOf() (*MonoType, error)

TypeOf returns the type of the function argument.

type BasicKind

type BasicKind fbsemantic.Type

BasicKind specifies a basic type.

type Kind

type Kind fbsemantic.MonoType

Kind specifies a particular kind of monotype.

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

func (mt *MonoType) Argument(i int) (*Argument, error)

Argument returns the argument give an ordinal position if this monotype is a function, and an error otherwise.

func (*MonoType) Basic

func (mt *MonoType) Basic() (BasicKind, error)

Basic returns the basic type for this monotype if it is a basic type, and an error otherwise.

func (*MonoType) ElemType

func (mt *MonoType) ElemType() (*MonoType, error)

ElemType returns the element type if this monotype is an array, and an error otherise.

func (*MonoType) Extends

func (mt *MonoType) Extends() (*MonoType, error)

Extends returns the extending type variable if this monotype is a row, and an error otherwise.

func (*MonoType) Kind

func (mt *MonoType) Kind() Kind

Kind returns what kind of monotype the receiver is.

func (*MonoType) NumArguments

func (mt *MonoType) NumArguments() (int, error)

NumArguments returns the number of arguments if this monotype is a function, and an error otherwise.

func (*MonoType) NumProperties

func (mt *MonoType) NumProperties() (int, error)

NumProperties returns the number of properties if this monotype is a row, and an error otherwise.

func (*MonoType) Property

func (mt *MonoType) Property(i int) (*Property, error)

Property returns a property given its ordinal position if this monotype is a row, and an error otherwise.

func (*MonoType) ReturnType

func (mt *MonoType) ReturnType() (*MonoType, error)

func (MonoType) SortedArguments added in v0.59.0

func (mt MonoType) SortedArguments() ([]*Argument, error)

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

func (mt *MonoType) SortedProperties() ([]*Property, error)

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.

func (*MonoType) String

func (mt *MonoType) String() string

String returns a string representation of this monotype.

func (*MonoType) VarNum

func (mt *MonoType) VarNum() (uint64, error)

VarNum returns the type variable number if this monotype is a type variable, and an error otherwise.

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) Expr

func (pt *PolyType) Expr() (*MonoType, error)

Expr returns the monotype expression for this polytype.

func (*PolyType) GetCanonicalMapping added in v0.59.0

func (pt *PolyType) GetCanonicalMapping() (map[uint64]int, error)

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

func (pt *PolyType) NumConstraints() int

NumConstraints returns the number of kind constraints in this polytype.

func (*PolyType) NumVars

func (pt *PolyType) NumVars() int

NumVars returns the number of type variables 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)

func (*PolyType) String

func (pt *PolyType) String() string

String returns a string representation for this polytype.

func (*PolyType) Var

func (pt *PolyType) Var(i int) (*fbsemantic.Var, error)

Var returns the type variable at ordinal position i.

type Property

type Property struct {
	// contains filtered or unexported fields
}

Property represents a property of a row.

func (*Property) Name

func (p *Property) Name() string

Name returns the name of the property.

func (*Property) TypeOf

func (p *Property) TypeOf() (*MonoType, error)

TypeOf returns the type of the property.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL