Documentation ¶
Index ¶
- Constants
- Variables
- type DeclRef
- type Env
- func (e *Env) AddPrimitiveTypes()
- func (e *Env) Extend(name string, typ ast.Type)
- func (e *Env) ExtendInstance(name string, typ ast.Type, isLambdaVar bool)
- func (e *Env) ExtendType(name string, typ ast.Type)
- func (e *Env) ForEachInstance(action func(string, InstanceEnv))
- func (e *Env) Fork() *Env
- func (e *Env) Lookup(name string) (ast.Type, bool)
- func (e *Env) LookupType(name string) (ast.Type, bool)
- func (e *Env) Remove(name string)
- type FullModuleEnv
- type Inference
- type InstanceEnv
- type ModuleEnv
- type PatternVar
- type TypeDeclRef
- type TypeLabel
- type Typechecker
- func (tc *Typechecker) Env() *Env
- func (tc *Typechecker) Errors() []data.CompilerProblem
- func (tc *Typechecker) Infer(mod ast.Module) (ModuleEnv, error)
- func (tc *Typechecker) NewGenVar() ast.TVar
- func (tc *Typechecker) NewGenVarName(name string) ast.TVar
- func (tc *Typechecker) NewVar(level ast.Level) ast.Type
- type TypingContext
- type Unification
Constants ¶
View Source
const ( PrimInt = "Int" PrimInt8 = "Int8" PrimInt16 = "Int16" PrimInt32 = "Int32" PrimInt64 = "Int64" PrimUint = "Uint" PrimUint8 = "Uint8" PrimUint16 = "Uint16" PrimUint32 = "Uint32" PrimUint64 = "Uint64" PrimUintptr = "Uintptr" PrimFloat32 = "Float32" PrimFloat64 = "Float64" PrimComplex64 = "Complex64" PrimComplex128 = "Complex128" PrimByte = "Byte" PrimBool = "Bool" PrimString = "String" PrimRune = "Rune" PrimUnit = "Unit" PrimList = "List" PrimSet = "Set" )
Variables ¶
View Source
var PrimitiveTypes = map[string]ast.Type{
"Byte": tByte,
"Int": tInt,
"Int8": tInt8,
"Int16": tInt16,
"Int32": tInt32,
"Int64": tInt64,
"Uint": tUint,
"Uint8": tUint8,
"Uint16": tUint16,
"Uint32": tUint32,
"Uint64": tUint64,
"Uintptr": tUintptr,
"Float32": tFloat32,
"Float64": tFloat64,
"Complex64": tComplex64,
"Complex128": tComplex128,
"Bool": tBool,
"Rune": tRune,
"String": tString,
"Unit": tUnit,
}
All primitive types that should be added to the environment
Functions ¶
This section is empty.
Types ¶
type Env ¶
type Env struct {
// contains filtered or unexported fields
}
func (*Env) AddPrimitiveTypes ¶
func (e *Env) AddPrimitiveTypes()
func (*Env) ExtendInstance ¶
func (*Env) ForEachInstance ¶
func (e *Env) ForEachInstance(action func(string, InstanceEnv))
type FullModuleEnv ¶
type Inference ¶
type Inference struct {
// contains filtered or unexported fields
}
func NewInference ¶
func NewInference(tc *Typechecker, uni *Unification) *Inference
type PatternVar ¶
type PatternVar struct {
// contains filtered or unexported fields
}
type TypeDeclRef ¶
type Typechecker ¶
func NewTypechecker ¶
func NewTypechecker() *Typechecker
func (*Typechecker) Env ¶
func (tc *Typechecker) Env() *Env
func (*Typechecker) Errors ¶
func (tc *Typechecker) Errors() []data.CompilerProblem
func (*Typechecker) NewGenVar ¶
func (tc *Typechecker) NewGenVar() ast.TVar
func (*Typechecker) NewGenVarName ¶
func (tc *Typechecker) NewGenVarName(name string) ast.TVar
type TypingContext ¶
type TypingContext struct {
// contains filtered or unexported fields
}
type Unification ¶
type Unification struct {
// contains filtered or unexported fields
}
func NewUnification ¶
func NewUnification(tc *Typechecker) *Unification
func (*Unification) MatchRowType ¶
func (*Unification) Unify ¶
func (u *Unification) Unify(t1, t2 ast.Type, span data.Span) *data.CompilerProblem
Click to show internal directories.
Click to hide internal directories.