types

package
v0.0.0-...-0893d3e Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package types contains the Elk type checker.

Index

Constants

View Source
const (
	METHOD_ABSTRACT_FLAG bitfield.BitFlag16 = 1 << iota
	METHOD_SEALED_FLAG
	METHOD_NATIVE_FLAG
	METHOD_COMPILED_FLAG
	METHOD_NAMED_REST_PARAM_FLAG
	METHOD_INSTANCE_VARIABLES_CHECKED_FLAG
	METHOD_ATTRIBUTE_FLAG
	// used in using expression placeholders
	METHOD_PLACEHOLDER_FLAG
	METHOD_CHECKED_FLAG
	METHOD_REPLACED_FLAG
)

Variables

This section is empty.

Functions

func AllConstants

func AllConstants(namespace Namespace) iter.Seq2[value.Symbol, Constant]

Iterate over every constant that is not a subtype

func AllInstanceVariables

func AllInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, InstanceVariable]

Iterate over every instance variable defined in the given namespace including the inherited ones

func AllMethods

func AllMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]

Iterate over every method defined in the given namespace including the inherited ones

func AllSubtypes

func AllSubtypes(namespace Namespace) iter.Seq2[value.Symbol, Constant]

Iterate over every subtype

func Backward

func Backward[T any](iterator iter.Seq[T]) iter.Seq[T]

iterate backward over an iterator

func CreateTypeArgumentOrderFromTypeParams

func CreateTypeArgumentOrderFromTypeParams(typeParams []*TypeParameter) []value.Symbol

func DirectlyImplementedInterfaces

func DirectlyImplementedInterfaces(namespace Namespace) iter.Seq[Namespace]

iterate over every interface that is directly implemented in the given namespace

func DirectlyIncludedAndImplemented

func DirectlyIncludedAndImplemented(namespace Namespace) iter.Seq[Namespace]

iterate over every mixin that is directly included and every interface that is directly implemented in the given namespace

func DirectlyIncludedMixins

func DirectlyIncludedMixins(namespace Namespace) iter.Seq[Namespace]

iterate over every mixin that is directly included in the given namespace

func GetConstantName

func GetConstantName(fullConstantPath string) string

func GetConstantPath

func GetConstantPath(fullConstantPath string) []string

func GetInstanceVariableInNamespace

func GetInstanceVariableInNamespace(namespace Namespace, name value.Symbol) (Type, Namespace)

func I

func I(typ Type) string

func ImplementInterface

func ImplementInterface(target, interfaceNamespace Namespace)

func ImplementedInterfaces

func ImplementedInterfaces(namespace Namespace) iter.Seq[Namespace]

iterate over every interface that is implemented in the given namespace

func IncludeMixin

func IncludeMixin(target, includedNamespace Namespace)

func IncludedMixins

func IncludedMixins(namespace Namespace) iter.Seq[Namespace]

iterate over every mixin that is included in the given namespace

func Inspect

func Inspect(typ Type) string

func InspectInstanceVariable

func InspectInstanceVariable(name string) string

func InspectInstanceVariableDeclaration

func InspectInstanceVariableDeclaration(name string, typ Type) string

func InspectInstanceVariableDeclarationWithColor

func InspectInstanceVariableDeclarationWithColor(name string, typ Type) string

func InspectInstanceVariableWithColor

func InspectInstanceVariableWithColor(name string) string

func InspectModifier

func InspectModifier(abstract, sealed, primitive bool) string

func InspectWithColor

func InspectWithColor(typ Type) string

func IsAny

func IsAny(t Type) bool

func IsBool

func IsBool(t Type) bool

func IsClosure

func IsClosure(namespace Namespace) bool

func IsConstantPlaceholder

func IsConstantPlaceholder(typ Type) bool

func IsFalse

func IsFalse(t Type) bool

func IsGeneric

func IsGeneric(typ Type) bool

func IsInterface

func IsInterface(typ Type) bool

func IsMixin

func IsMixin(typ Type) bool

func IsMixinWithWhere

func IsMixinWithWhere(typ Type) bool

func IsNever

func IsNever(t Type) bool

func IsNil

func IsNil(t Type, env *GlobalEnvironment) bool

func IsNilLiteral

func IsNilLiteral(t Type) bool

func IsNoValue

func IsNoValue(t Type) bool

func IsPointerNil

func IsPointerNil(val any) bool

func IsSelf

func IsSelf(t Type) bool

func IsTrue

func IsTrue(t Type) bool

func IsUntyped

func IsUntyped(t Type) bool

func IsVoid

func IsVoid(t Type) bool

func MakeFullConstantName

func MakeFullConstantName(containerName, constName string) string

func NamespaceDeclaresInstanceVariables

func NamespaceDeclaresInstanceVariables(namespace Namespace) bool

func NamespaceHasAnyDefinableMethods

func NamespaceHasAnyDefinableMethods(namespace Namespace) bool

func NamespacesAreEqual

func NamespacesAreEqual(left, right Namespace) bool

func OwnInstanceVariables

func OwnInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, Type]

Iterate over every instance variable defined directly under the given namespace

func OwnMethods

func OwnMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]

Iterate over every method defined directly under the given namespace

func Parents

func Parents(namespace Namespace) iter.Seq[Namespace]

Iterate over every parent of the given namespace (including itself).

func SimpleParents

func SimpleParents(namespace Namespace) iter.Seq[Namespace]

Iterate over direct parents of the given namespace (including itself).

func SortedConstants

func SortedConstants(namespace Namespace) iter.Seq2[value.Symbol, Constant]

Iterate over every constant that is not a subtype, sorted by name

func SortedInstanceVariables

func SortedInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, InstanceVariable]

Iterate over every instance variable defined in the given namespace including the inherited ones

func SortedMethods

func SortedMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]

Iterate over every method defined in the given namespace including the inherited ones, sorted by name

func SortedOwnInstanceVariables

func SortedOwnInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, Type]

Iterate over every instance variable defined directly under the given namespace, sorted by name

func SortedOwnMethodAliases

func SortedOwnMethodAliases(namespace Namespace) iter.Seq2[value.Symbol, *MethodAlias]

Iterate over every method alias defined directly under the given namespace, sorted by name

func SortedOwnMethods

func SortedOwnMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]

Iterate over every method defined directly under the given namespace, sorted by name

func SortedSubtypes

func SortedSubtypes(namespace Namespace) iter.Seq2[value.Symbol, Constant]

Iterate over every subtype, sorted by name

Types

type Any

type Any struct{}

All types are subtypes of any. Any is not a subtype of anything other than itself. It is the top type.

func (Any) IsLiteral

func (Any) IsLiteral() bool

func (Any) ToNonLiteral

func (n Any) ToNonLiteral(env *GlobalEnvironment) Type

type AstNode

type AstNode interface {
	position.SpanInterface
}

type BigFloatLiteral

type BigFloatLiteral struct {
	Value string
	// contains filtered or unexported fields
}

func NewBigFloatLiteral

func NewBigFloatLiteral(value string) *BigFloatLiteral

func (*BigFloatLiteral) CopyNumeric

func (f *BigFloatLiteral) CopyNumeric() NumericLiteral

func (*BigFloatLiteral) IsLiteral

func (*BigFloatLiteral) IsLiteral() bool

func (*BigFloatLiteral) IsNegative

func (f *BigFloatLiteral) IsNegative() bool

func (*BigFloatLiteral) SetNegative

func (f *BigFloatLiteral) SetNegative(val bool)

func (*BigFloatLiteral) StringValue

func (f *BigFloatLiteral) StringValue() string

func (*BigFloatLiteral) ToNonLiteral

func (*BigFloatLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type Bool

type Bool struct{}

func (Bool) IsLiteral

func (Bool) IsLiteral() bool

func (Bool) ToNonLiteral

func (Bool) ToNonLiteral(env *GlobalEnvironment) Type

type CharLiteral

type CharLiteral struct {
	Value rune
}

func NewCharLiteral

func NewCharLiteral(value rune) *CharLiteral

func (*CharLiteral) IsLiteral

func (*CharLiteral) IsLiteral() bool

func (*CharLiteral) StringValue

func (c *CharLiteral) StringValue() string

func (*CharLiteral) ToNonLiteral

func (*CharLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type Checker

type Checker interface {
	Env() *GlobalEnvironment
	IsSubtype(a, b Type) bool
	IsNilable(typ Type) bool
	IsNotNilable(typ Type) bool
	IsNil(typ Type) bool
	IsFalsy(typ Type) bool
	IsTruthy(typ Type) bool
	CanBeFalsy(typ Type) bool
	CanBeTruthy(typ Type) bool
	IsTheSameType(a, b Type) bool
	TypesIntersect(a, b Type) bool
	NewNormalisedUnion(elements ...Type) Type
	NewNormalisedIntersection(elements ...Type) Type
	NormaliseType(typ Type) Type
	StdInt() *Class
	StdFloat() *Class
	StdBigFloat() *Class
	StdClass() *Class
	Std(name value.Symbol) Type
	StdString() Type
	StdBool() *Class
	StdNil() *Class
	StdTrue() *Class
	StdFalse() *Class
}

type Class

type Class struct {
	Checked bool

	NamespaceBase
	// contains filtered or unexported fields
}

func NewClass

func NewClass(
	docComment string,
	abstract,
	sealed,
	primitive bool,
	name string,
	parent Namespace,
	env *GlobalEnvironment,
) *Class

func NewClassWithDetails

func NewClassWithDetails(
	docComment string,
	abstract,
	sealed,
	primitive bool,
	name string,
	parent Namespace,
	consts ConstantMap,
	subtypes ConstantMap,
	methods MethodMap,
	env *GlobalEnvironment,
) *Class

func (*Class) Copy

func (c *Class) Copy() *Class

func (*Class) DeepCopyEnv

func (c *Class) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Class

func (*Class) DefineMethod

func (c *Class) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*Class) IsAbstract

func (c *Class) IsAbstract() bool

func (*Class) IsCompiled

func (c *Class) IsCompiled() bool

func (*Class) IsDefined

func (c *Class) IsDefined() bool

func (*Class) IsGeneric

func (c *Class) IsGeneric() bool

func (*Class) IsLiteral

func (*Class) IsLiteral() bool

func (*Class) IsPrimitive

func (c *Class) IsPrimitive() bool

func (*Class) IsSealed

func (c *Class) IsSealed() bool

func (*Class) Parent

func (c *Class) Parent() Namespace

func (*Class) SetAbstract

func (c *Class) SetAbstract(abstract bool) *Class

func (*Class) SetCompiled

func (c *Class) SetCompiled(val bool)

func (*Class) SetDefined

func (c *Class) SetDefined(val bool)

func (*Class) SetParent

func (c *Class) SetParent(parent Namespace)

func (*Class) SetPrimitive

func (c *Class) SetPrimitive(primitive bool) *Class

func (*Class) SetSealed

func (c *Class) SetSealed(sealed bool) *Class

func (*Class) SetSingleton

func (c *Class) SetSingleton(singleton *SingletonClass)

func (*Class) SetTypeParameters

func (c *Class) SetTypeParameters(t []*TypeParameter)

func (*Class) Singleton

func (c *Class) Singleton() *SingletonClass

func (*Class) Superclass

func (c *Class) Superclass() Namespace

func (*Class) ToNonLiteral

func (c *Class) ToNonLiteral(env *GlobalEnvironment) Type

func (*Class) TypeParameters

func (c *Class) TypeParameters() []*TypeParameter

type Closure

type Closure struct {
	Body *Method
}

func NewClosure

func NewClosure(method *Method) *Closure

func NewClosureWithMethod

func NewClosureWithMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType Type, throwType Type) *Closure

func (*Closure) AppendDocComment

func (c *Closure) AppendDocComment(string)

func (*Closure) Constant

func (c *Closure) Constant(name value.Symbol) (Constant, bool)

func (*Closure) ConstantString

func (c *Closure) ConstantString(name string) (Constant, bool)

func (*Closure) Constants

func (c *Closure) Constants() ConstantMap

func (*Closure) Copy

func (c *Closure) Copy() *Closure

func (*Closure) DeepCopyEnv

func (c *Closure) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Closure

func (*Closure) DefineClass

func (c *Closure) DefineClass(docComment string, primitive, abstract, sealed bool, name value.Symbol, parent Namespace, env *GlobalEnvironment) *Class

func (*Closure) DefineConstant

func (c *Closure) DefineConstant(name value.Symbol, val Type)

func (*Closure) DefineConstantWithFullName

func (c *Closure) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)

func (*Closure) DefineInstanceVariable

func (c *Closure) DefineInstanceVariable(name value.Symbol, val Type)

func (*Closure) DefineInterface

func (c *Closure) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface

func (*Closure) DefineMethod

func (c *Closure) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*Closure) DefineMixin

func (c *Closure) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin

func (*Closure) DefineModule

func (c *Closure) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module

func (*Closure) DefineSubtype

func (c *Closure) DefineSubtype(name value.Symbol, val Type)

func (*Closure) DefineSubtypeWithFullName

func (c *Closure) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)

func (*Closure) DocComment

func (c *Closure) DocComment() string

func (*Closure) InstanceVariable

func (c *Closure) InstanceVariable(name value.Symbol) Type

func (*Closure) InstanceVariableString

func (c *Closure) InstanceVariableString(name string) Type

func (*Closure) InstanceVariables

func (c *Closure) InstanceVariables() TypeMap

func (*Closure) IsAbstract

func (c *Closure) IsAbstract() bool

func (*Closure) IsDefined

func (c *Closure) IsDefined() bool

func (*Closure) IsGeneric

func (c *Closure) IsGeneric() bool

func (*Closure) IsLiteral

func (*Closure) IsLiteral() bool

func (*Closure) IsPrimitive

func (c *Closure) IsPrimitive() bool

func (*Closure) IsSealed

func (c *Closure) IsSealed() bool

func (*Closure) Method

func (c *Closure) Method(name value.Symbol) *Method

func (*Closure) MethodAliases

func (c *Closure) MethodAliases() MethodAliasMap

func (*Closure) MethodString

func (c *Closure) MethodString(name string) *Method

func (*Closure) Methods

func (c *Closure) Methods() MethodMap

func (*Closure) MustSubtype

func (c *Closure) MustSubtype(name string) Type

func (*Closure) Name

func (c *Closure) Name() string

func (*Closure) Parent

func (c *Closure) Parent() Namespace

func (*Closure) SetDefined

func (c *Closure) SetDefined(bool)

func (*Closure) SetDocComment

func (c *Closure) SetDocComment(string)

func (*Closure) SetMethod

func (c *Closure) SetMethod(name value.Symbol, method *Method)

func (*Closure) SetMethodAlias

func (c *Closure) SetMethodAlias(name value.Symbol, method *Method)

func (*Closure) SetParent

func (c *Closure) SetParent(Namespace)

func (*Closure) SetSingleton

func (c *Closure) SetSingleton(*SingletonClass)

func (*Closure) SetTypeParameters

func (c *Closure) SetTypeParameters(t []*TypeParameter)

func (*Closure) Singleton

func (c *Closure) Singleton() *SingletonClass

func (*Closure) Subtype

func (c *Closure) Subtype(name value.Symbol) (Constant, bool)

func (*Closure) SubtypeString

func (c *Closure) SubtypeString(name string) (Constant, bool)

func (*Closure) Subtypes

func (c *Closure) Subtypes() ConstantMap

func (*Closure) ToNonLiteral

func (c *Closure) ToNonLiteral(env *GlobalEnvironment) Type

func (*Closure) TypeParameters

func (c *Closure) TypeParameters() []*TypeParameter

type Constant

type Constant struct {
	FullName string
	Type     Type
}

type ConstantMap

type ConstantMap = map[value.Symbol]Constant

func ConstantsDeepCopyEnv

func ConstantsDeepCopyEnv(constants ConstantMap, oldEnv, newEnv *GlobalEnvironment) ConstantMap

type ConstantPlaceholder

type ConstantPlaceholder struct {
	AsName    value.Symbol
	FullName  string
	Container ConstantMap
	Location  *position.Location
	Sibling   *ConstantPlaceholder
	Checked   bool
	Replaced  bool
}

Used during typechecking as a placeholder for a future constant or type in using statements

func NewConstantPlaceholder

func NewConstantPlaceholder(asName value.Symbol, fullName string, container ConstantMap, location *position.Location) *ConstantPlaceholder

func (*ConstantPlaceholder) Copy

func (*ConstantPlaceholder) DeepCopyEnv

func (p *ConstantPlaceholder) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *ConstantPlaceholder

func (*ConstantPlaceholder) IsLiteral

func (*ConstantPlaceholder) IsLiteral() bool

func (*ConstantPlaceholder) ToNonLiteral

func (p *ConstantPlaceholder) ToNonLiteral(env *GlobalEnvironment) Type

type False

type False struct{}

func (False) IsLiteral

func (False) IsLiteral() bool

func (False) ToNonLiteral

func (False) ToNonLiteral(env *GlobalEnvironment) Type

type Float32Literal

type Float32Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewFloat32Literal

func NewFloat32Literal(value string) *Float32Literal

func (*Float32Literal) CopyNumeric

func (f *Float32Literal) CopyNumeric() NumericLiteral

func (*Float32Literal) IsLiteral

func (*Float32Literal) IsLiteral() bool

func (*Float32Literal) IsNegative

func (f *Float32Literal) IsNegative() bool

func (*Float32Literal) SetNegative

func (f *Float32Literal) SetNegative(val bool)

func (*Float32Literal) StringValue

func (f *Float32Literal) StringValue() string

func (*Float32Literal) ToNonLiteral

func (*Float32Literal) ToNonLiteral(env *GlobalEnvironment) Type

type Float64Literal

type Float64Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewFloat64Literal

func NewFloat64Literal(value string) *Float64Literal

func (*Float64Literal) CopyNumeric

func (f *Float64Literal) CopyNumeric() NumericLiteral

func (*Float64Literal) IsLiteral

func (*Float64Literal) IsLiteral() bool

func (*Float64Literal) IsNegative

func (f *Float64Literal) IsNegative() bool

func (*Float64Literal) SetNegative

func (f *Float64Literal) SetNegative(val bool)

func (*Float64Literal) StringValue

func (f *Float64Literal) StringValue() string

func (*Float64Literal) ToNonLiteral

func (*Float64Literal) ToNonLiteral(env *GlobalEnvironment) Type

type FloatLiteral

type FloatLiteral struct {
	Value string
	// contains filtered or unexported fields
}

func NewFloatLiteral

func NewFloatLiteral(value string) *FloatLiteral

func (*FloatLiteral) CopyNumeric

func (f *FloatLiteral) CopyNumeric() NumericLiteral

func (*FloatLiteral) IsLiteral

func (*FloatLiteral) IsLiteral() bool

func (*FloatLiteral) IsNegative

func (f *FloatLiteral) IsNegative() bool

func (*FloatLiteral) SetNegative

func (f *FloatLiteral) SetNegative(val bool)

func (*FloatLiteral) StringValue

func (f *FloatLiteral) StringValue() string

func (*FloatLiteral) ToNonLiteral

func (*FloatLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type Generic

type Generic struct {
	Namespace
	*TypeArguments
}

func NewGeneric

func NewGeneric(typ Namespace, typeArgs *TypeArguments) *Generic

func NewGenericWithTypeArgs

func NewGenericWithTypeArgs(namespace Namespace, args ...Type) *Generic

func NewGenericWithUpperBoundTypeArgs

func NewGenericWithUpperBoundTypeArgs(namespace Namespace) *Generic

func NewGenericWithUpperBoundTypeArgsAndVariance

func NewGenericWithUpperBoundTypeArgsAndVariance(namespace Namespace, variance Variance) *Generic

func NewGenericWithVariance

func NewGenericWithVariance(namespace Namespace, variance Variance, args ...Type) *Generic

func (*Generic) Copy

func (g *Generic) Copy() *Generic

func (*Generic) DeepCopyEnv

func (g *Generic) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Generic

func (*Generic) FixVariance

func (g *Generic) FixVariance()

func (*Generic) IsLiteral

func (*Generic) IsLiteral() bool

func (*Generic) ToNonLiteral

func (g *Generic) ToNonLiteral(env *GlobalEnvironment) Type

type GenericNamedType

type GenericNamedType struct {
	Name           string
	Type           Type
	TypeParameters []*TypeParameter
}

func NewGenericNamedType

func NewGenericNamedType(name string, typ Type, typeVars []*TypeParameter) *GenericNamedType

func (*GenericNamedType) Copy

func (*GenericNamedType) DeepCopyEnv

func (g *GenericNamedType) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *GenericNamedType

func (*GenericNamedType) IsLiteral

func (*GenericNamedType) IsLiteral() bool

func (*GenericNamedType) ToNonLiteral

func (g *GenericNamedType) ToNonLiteral(env *GlobalEnvironment) Type

type GlobalEnvironment

type GlobalEnvironment struct {
	Root *Module
	Init bool // Whether the global environment is in its initialisation stage
}

func NewGlobalEnvironment

func NewGlobalEnvironment() *GlobalEnvironment

Create a new global environment for type checking.

func NewGlobalEnvironmentWithoutHeaders

func NewGlobalEnvironmentWithoutHeaders() *GlobalEnvironment

func (*GlobalEnvironment) DeepCopyEnv

func (g *GlobalEnvironment) DeepCopyEnv() *GlobalEnvironment

func (*GlobalEnvironment) Std

func (g *GlobalEnvironment) Std() *Module

func (*GlobalEnvironment) StdConst

func (g *GlobalEnvironment) StdConst(name value.Symbol) Type

func (*GlobalEnvironment) StdConstString

func (g *GlobalEnvironment) StdConstString(name string) Type

func (*GlobalEnvironment) StdSubtype

func (g *GlobalEnvironment) StdSubtype(name value.Symbol) Type

func (*GlobalEnvironment) StdSubtypeClass

func (g *GlobalEnvironment) StdSubtypeClass(name value.Symbol) *Class

func (*GlobalEnvironment) StdSubtypeModule

func (g *GlobalEnvironment) StdSubtypeModule(name value.Symbol) *Module

func (*GlobalEnvironment) StdSubtypeString

func (g *GlobalEnvironment) StdSubtypeString(name string) Type

type InstanceOf

type InstanceOf struct {
	Type Type
}

func NewInstanceOf

func NewInstanceOf(typ Type) *InstanceOf

func (*InstanceOf) Copy

func (i *InstanceOf) Copy() *InstanceOf

func (*InstanceOf) DeepCopyEnv

func (i *InstanceOf) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *InstanceOf

func (*InstanceOf) IsLiteral

func (*InstanceOf) IsLiteral() bool

func (*InstanceOf) ToNonLiteral

func (s *InstanceOf) ToNonLiteral(env *GlobalEnvironment) Type

type InstanceVariable

type InstanceVariable struct {
	Type      Type
	Namespace Namespace
}

type Int16Literal

type Int16Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewInt16Literal

func NewInt16Literal(value string) *Int16Literal

func (*Int16Literal) CopyNumeric

func (i *Int16Literal) CopyNumeric() NumericLiteral

func (*Int16Literal) IsLiteral

func (*Int16Literal) IsLiteral() bool

func (*Int16Literal) IsNegative

func (i *Int16Literal) IsNegative() bool

func (*Int16Literal) SetNegative

func (i *Int16Literal) SetNegative(val bool)

func (*Int16Literal) StringValue

func (i *Int16Literal) StringValue() string

func (*Int16Literal) ToNonLiteral

func (i *Int16Literal) ToNonLiteral(env *GlobalEnvironment) Type

type Int32Literal

type Int32Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewInt32Literal

func NewInt32Literal(value string) *Int32Literal

func (*Int32Literal) CopyNumeric

func (i *Int32Literal) CopyNumeric() NumericLiteral

func (*Int32Literal) IsLiteral

func (*Int32Literal) IsLiteral() bool

func (*Int32Literal) IsNegative

func (i *Int32Literal) IsNegative() bool

func (*Int32Literal) SetNegative

func (i *Int32Literal) SetNegative(val bool)

func (*Int32Literal) StringValue

func (i *Int32Literal) StringValue() string

func (*Int32Literal) ToNonLiteral

func (i *Int32Literal) ToNonLiteral(env *GlobalEnvironment) Type

type Int64Literal

type Int64Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewInt64Literal

func NewInt64Literal(value string) *Int64Literal

func (*Int64Literal) CopyNumeric

func (i *Int64Literal) CopyNumeric() NumericLiteral

func (*Int64Literal) IsLiteral

func (*Int64Literal) IsLiteral() bool

func (*Int64Literal) IsNegative

func (i *Int64Literal) IsNegative() bool

func (*Int64Literal) SetNegative

func (i *Int64Literal) SetNegative(val bool)

func (*Int64Literal) StringValue

func (i *Int64Literal) StringValue() string

func (*Int64Literal) ToNonLiteral

func (i *Int64Literal) ToNonLiteral(env *GlobalEnvironment) Type

type Int8Literal

type Int8Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewInt8Literal

func NewInt8Literal(value string) *Int8Literal

func (*Int8Literal) CopyNumeric

func (i *Int8Literal) CopyNumeric() NumericLiteral

func (*Int8Literal) IsLiteral

func (*Int8Literal) IsLiteral() bool

func (*Int8Literal) IsNegative

func (i *Int8Literal) IsNegative() bool

func (*Int8Literal) SetNegative

func (i *Int8Literal) SetNegative(val bool)

func (*Int8Literal) StringValue

func (i *Int8Literal) StringValue() string

func (*Int8Literal) ToNonLiteral

func (i *Int8Literal) ToNonLiteral(env *GlobalEnvironment) Type

type IntLiteral

type IntLiteral struct {
	Value string
	// contains filtered or unexported fields
}

func NewIntLiteral

func NewIntLiteral(value string) *IntLiteral

func (*IntLiteral) CopyNumeric

func (i *IntLiteral) CopyNumeric() NumericLiteral

func (*IntLiteral) IsLiteral

func (*IntLiteral) IsLiteral() bool

func (*IntLiteral) IsNegative

func (i *IntLiteral) IsNegative() bool

func (*IntLiteral) SetNegative

func (i *IntLiteral) SetNegative(val bool)

func (*IntLiteral) StringValue

func (i *IntLiteral) StringValue() string

func (*IntLiteral) ToNonLiteral

func (i *IntLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type Interface

type Interface struct {
	Checked bool

	NamespaceBase
	// contains filtered or unexported fields
}

func NewInterface

func NewInterface(docComment string, name string, env *GlobalEnvironment) *Interface

func NewInterfaceWithDetails

func NewInterfaceWithDetails(
	name string,
	parent *InterfaceProxy,
	consts ConstantMap,
	subtypes ConstantMap,
	methods MethodMap,
	env *GlobalEnvironment,
) *Interface

func (*Interface) Copy

func (i *Interface) Copy() *Interface

func (*Interface) DeepCopyEnv

func (i *Interface) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Interface

func (*Interface) DefineMethod

func (i *Interface) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*Interface) IsAbstract

func (*Interface) IsAbstract() bool

func (*Interface) IsDefined

func (i *Interface) IsDefined() bool

func (*Interface) IsGeneric

func (i *Interface) IsGeneric() bool

func (*Interface) IsLiteral

func (*Interface) IsLiteral() bool

func (*Interface) IsPrimitive

func (*Interface) IsPrimitive() bool

func (*Interface) IsSealed

func (*Interface) IsSealed() bool

func (*Interface) Parent

func (i *Interface) Parent() Namespace

func (*Interface) SetDefined

func (i *Interface) SetDefined(compiled bool)

func (*Interface) SetParent

func (i *Interface) SetParent(parent Namespace)

func (*Interface) SetSingleton

func (i *Interface) SetSingleton(singleton *SingletonClass)

func (*Interface) SetTypeParameters

func (i *Interface) SetTypeParameters(t []*TypeParameter)

func (*Interface) Singleton

func (i *Interface) Singleton() *SingletonClass

func (*Interface) ToNonLiteral

func (i *Interface) ToNonLiteral(env *GlobalEnvironment) Type

func (*Interface) TypeParameters

func (i *Interface) TypeParameters() []*TypeParameter

type InterfaceProxy

type InterfaceProxy struct {
	*Interface
	// contains filtered or unexported fields
}

func NewInterfaceProxy

func NewInterfaceProxy(iface *Interface, parent Namespace) *InterfaceProxy

func (*InterfaceProxy) Copy

func (m *InterfaceProxy) Copy() *InterfaceProxy

func (*InterfaceProxy) DeepCopyEnv

func (i *InterfaceProxy) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *InterfaceProxy

func (*InterfaceProxy) Parent

func (i *InterfaceProxy) Parent() Namespace

func (*InterfaceProxy) SetParent

func (i *InterfaceProxy) SetParent(parent Namespace)

func (*InterfaceProxy) ToNonLiteral

func (i *InterfaceProxy) ToNonLiteral(env *GlobalEnvironment) Type

type Intersection

type Intersection struct {
	Elements []Type
}

Intersection type represents a list of types. A value has to satisfy all of the types.

func NewIntersection

func NewIntersection(elements ...Type) *Intersection

func (*Intersection) Copy

func (i *Intersection) Copy() *Intersection

func (*Intersection) DeepCopyEnv

func (i *Intersection) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Intersection

func (*Intersection) IsLiteral

func (*Intersection) IsLiteral() bool

func (*Intersection) ToNonLiteral

func (u *Intersection) ToNonLiteral(env *GlobalEnvironment) Type

type Method

type Method struct {
	DocComment         string
	FullName           string
	Name               value.Symbol
	OptionalParamCount int
	PostParamCount     int

	Params         []*Parameter
	TypeParameters []*TypeParameter
	ReturnType     Type
	ThrowType      Type
	DefinedUnder   Namespace
	Bytecode       *vm.BytecodeFunction

	// used to detect methods that circularly reference constants
	UsedInConstants              ds.Set[value.Symbol] // set of constants in which this method is called
	UsedConstants                ds.Set[value.Symbol] // set of constants references in this method's body
	InitialisedInstanceVariables ds.Set[value.Symbol] // a set of names of instance variables that have been initialised, used when checking constructors
	CalledMethods                []*Method            // list of methods called in this method's body
	Node                         AstNode
	// contains filtered or unexported fields
}

func GetMethod

func GetMethod(typ Type, name string, env *GlobalEnvironment) *Method

func NewMethod

func NewMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType Type, throwType Type, definedUnder Namespace) *Method

func NewMethodPlaceholder

func NewMethodPlaceholder(fullName string, name value.Symbol, definedUnder Namespace, location *position.Location) *Method

func (*Method) AreInstanceVariablesChecked

func (m *Method) AreInstanceVariablesChecked() bool

func (*Method) Copy

func (m *Method) Copy() *Method

func (*Method) DeepCopyEnv

func (m *Method) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Method

func (*Method) ExpectedParamCountString

func (m *Method) ExpectedParamCountString() string

func (*Method) HasNamedRestParam

func (m *Method) HasNamedRestParam() bool

func (*Method) HasPositionalRestParam

func (m *Method) HasPositionalRestParam() bool

func (*Method) InspectSignature

func (m *Method) InspectSignature(showModifiers bool) string

func (*Method) InspectSignatureWithColor

func (m *Method) InspectSignatureWithColor(showModifiers bool) string

func (*Method) IsAbstract

func (m *Method) IsAbstract() bool

func (*Method) IsAttribute

func (m *Method) IsAttribute() bool

func (*Method) IsChecked

func (m *Method) IsChecked() bool

func (*Method) IsCompilable

func (m *Method) IsCompilable() bool

func (*Method) IsCompiled

func (m *Method) IsCompiled() bool

func (*Method) IsDefinable

func (m *Method) IsDefinable() bool

func (*Method) IsGeneric

func (m *Method) IsGeneric() bool

func (*Method) IsInit

func (m *Method) IsInit() bool

func (*Method) IsLiteral

func (*Method) IsLiteral() bool

func (*Method) IsNative

func (m *Method) IsNative() bool

func (*Method) IsPlaceholder

func (m *Method) IsPlaceholder() bool

func (*Method) IsReplaced

func (m *Method) IsReplaced() bool

func (*Method) IsSealed

func (m *Method) IsSealed() bool

func (*Method) IsSetter

func (m *Method) IsSetter() bool

func (*Method) Location

func (m *Method) Location() *position.Location

func (*Method) NamedRestParam

func (m *Method) NamedRestParam() *Parameter

func (*Method) PositionalRestParam

func (m *Method) PositionalRestParam() *Parameter

func (*Method) PositionalRestParamIndex

func (m *Method) PositionalRestParamIndex() int

func (*Method) RequiredParamCount

func (m *Method) RequiredParamCount() int

func (*Method) SetAbstract

func (m *Method) SetAbstract(abstract bool) *Method

func (*Method) SetAttribute

func (m *Method) SetAttribute(val bool) *Method

func (*Method) SetChecked

func (m *Method) SetChecked(val bool) *Method

func (*Method) SetCompiled

func (m *Method) SetCompiled(compiled bool) *Method

func (*Method) SetFlag

func (m *Method) SetFlag(flag bitfield.BitFlag16, val bool)

func (*Method) SetInstanceVariablesChecked

func (m *Method) SetInstanceVariablesChecked(val bool) *Method

func (*Method) SetLocation

func (m *Method) SetLocation(location *position.Location)

func (*Method) SetNamedRestParam

func (m *Method) SetNamedRestParam(val bool) *Method

func (*Method) SetNative

func (m *Method) SetNative(native bool) *Method

func (*Method) SetPlaceholder

func (m *Method) SetPlaceholder(val bool) *Method

func (*Method) SetReplaced

func (m *Method) SetReplaced(val bool) *Method

func (*Method) SetSealed

func (m *Method) SetSealed(sealed bool) *Method

func (*Method) ToNonLiteral

func (m *Method) ToNonLiteral(env *GlobalEnvironment) Type

type MethodAlias

type MethodAlias struct {
	Compiled bool
	Method   *Method
}

Represents a method alias, a second name of a particular method.

func NewMethodAlias

func NewMethodAlias(method *Method) *MethodAlias

func (*MethodAlias) IsDefinable

func (m *MethodAlias) IsDefinable() bool

type MethodAliasMap

type MethodAliasMap = map[value.Symbol]*MethodAlias

type MethodMap

type MethodMap = map[value.Symbol]*Method

func MethodsDeepCopyEnv

func MethodsDeepCopyEnv(methods MethodMap, oldEnv, newEnv *GlobalEnvironment) MethodMap

type Mixin

type Mixin struct {
	Checked bool

	NamespaceBase
	// contains filtered or unexported fields
}

func NewMixin

func NewMixin(docComment string, abstract bool, name string, env *GlobalEnvironment) *Mixin

func NewMixinWithDetails

func NewMixinWithDetails(
	docComment string,
	abstract bool,
	name string,
	parent Namespace,
	consts ConstantMap,
	subtypes ConstantMap,
	methods MethodMap,
	env *GlobalEnvironment,
) *Mixin

func (*Mixin) Copy

func (m *Mixin) Copy() *Mixin

func (*Mixin) DeepCopyEnv

func (m *Mixin) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Mixin

func (*Mixin) DefineMethod

func (m *Mixin) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*Mixin) IsAbstract

func (m *Mixin) IsAbstract() bool

func (*Mixin) IsDefined

func (m *Mixin) IsDefined() bool

func (*Mixin) IsGeneric

func (m *Mixin) IsGeneric() bool

func (*Mixin) IsLiteral

func (*Mixin) IsLiteral() bool

func (*Mixin) IsPrimitive

func (m *Mixin) IsPrimitive() bool

func (*Mixin) IsSealed

func (m *Mixin) IsSealed() bool

func (*Mixin) Parent

func (m *Mixin) Parent() Namespace

func (*Mixin) SetAbstract

func (m *Mixin) SetAbstract(abstract bool) *Mixin

func (*Mixin) SetDefined

func (m *Mixin) SetDefined(compiled bool)

func (*Mixin) SetParent

func (m *Mixin) SetParent(parent Namespace)

func (*Mixin) SetSingleton

func (m *Mixin) SetSingleton(singleton *SingletonClass)

func (*Mixin) SetTypeParameters

func (m *Mixin) SetTypeParameters(t []*TypeParameter)

func (*Mixin) Singleton

func (m *Mixin) Singleton() *SingletonClass

func (*Mixin) ToNonLiteral

func (m *Mixin) ToNonLiteral(env *GlobalEnvironment) Type

func (*Mixin) TypeParameters

func (m *Mixin) TypeParameters() []*TypeParameter

type MixinProxy

type MixinProxy struct {
	*Mixin
	// contains filtered or unexported fields
}

func NewMixinProxy

func NewMixinProxy(mixin *Mixin, parent Namespace) *MixinProxy

func (*MixinProxy) Copy

func (m *MixinProxy) Copy() *MixinProxy

func (*MixinProxy) DeepCopyEnv

func (m *MixinProxy) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *MixinProxy

func (*MixinProxy) Parent

func (m *MixinProxy) Parent() Namespace

func (*MixinProxy) SetParent

func (m *MixinProxy) SetParent(parent Namespace)

func (*MixinProxy) ToNonLiteral

func (m *MixinProxy) ToNonLiteral(env *GlobalEnvironment) Type

type MixinWithWhere

type MixinWithWhere struct {
	*MixinProxy
	Namespace Namespace
	Where     []*TypeParameter
}

Represents a mixin parent with a where clause `extend where Bar < Baz`

func IncludeMixinWithWhere

func IncludeMixinWithWhere(target Namespace, mixin *Mixin, where []*TypeParameter) *MixinWithWhere

func NewMixinWithWhere

func NewMixinWithWhere(mixin *MixinProxy, namespace Namespace, where []*TypeParameter) *MixinWithWhere

func (*MixinWithWhere) Copy

func (m *MixinWithWhere) Copy() *MixinWithWhere

func (*MixinWithWhere) DeepCopyEnv

func (m *MixinWithWhere) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *MixinWithWhere

func (*MixinWithWhere) InspectExtend

func (m *MixinWithWhere) InspectExtend() string

func (*MixinWithWhere) InspectExtendWithColor

func (m *MixinWithWhere) InspectExtendWithColor() string

func (*MixinWithWhere) ToNonLiteral

func (m *MixinWithWhere) ToNonLiteral(env *GlobalEnvironment) Type

type Module

type Module struct {
	NamespaceBase
	// contains filtered or unexported fields
}

func NewModule

func NewModule(docComment, name string, env *GlobalEnvironment) *Module

func NewModuleWithDetails

func NewModuleWithDetails(
	docComment string,
	name string,
	consts ConstantMap,
	subtypes ConstantMap,
	methods MethodMap,
	env *GlobalEnvironment,
) *Module

func (*Module) Copy

func (m *Module) Copy() *Module

func (*Module) DeepCopyEnv

func (m *Module) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Module

func (*Module) DefineMethod

func (m *Module) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*Module) IsAbstract

func (m *Module) IsAbstract() bool

func (*Module) IsDefined

func (m *Module) IsDefined() bool

func (*Module) IsGeneric

func (m *Module) IsGeneric() bool

func (*Module) IsLiteral

func (*Module) IsLiteral() bool

func (*Module) IsPrimitive

func (m *Module) IsPrimitive() bool

func (*Module) IsSealed

func (m *Module) IsSealed() bool

func (*Module) Parent

func (m *Module) Parent() Namespace

func (*Module) SetDefined

func (m *Module) SetDefined(defined bool)

func (*Module) SetParent

func (m *Module) SetParent(parent Namespace)

func (*Module) SetSingleton

func (m *Module) SetSingleton(*SingletonClass)

func (*Module) SetTypeParameters

func (m *Module) SetTypeParameters(t []*TypeParameter)

func (*Module) Singleton

func (*Module) Singleton() *SingletonClass

func (*Module) ToNonLiteral

func (m *Module) ToNonLiteral(env *GlobalEnvironment) Type

func (*Module) TypeParameters

func (m *Module) TypeParameters() []*TypeParameter

type ModulePlaceholder

type ModulePlaceholder struct {
	Module
}

func NewModulePlaceholder

func NewModulePlaceholder(name string) *ModulePlaceholder

func (*ModulePlaceholder) Copy

func (*ModulePlaceholder) DeepCopyEnv

func (m *ModulePlaceholder) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *ModulePlaceholder

type NamedType

type NamedType struct {
	Name string
	Type Type
}

func NewNamedType

func NewNamedType(name string, typ Type) *NamedType

func (*NamedType) Copy

func (n *NamedType) Copy() *NamedType

func (*NamedType) DeepCopyEnv

func (n *NamedType) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *NamedType

func (*NamedType) IsLiteral

func (*NamedType) IsLiteral() bool

func (*NamedType) ToNonLiteral

func (n *NamedType) ToNonLiteral(env *GlobalEnvironment) Type

type Namespace

type Namespace interface {
	Type
	Name() string
	DocComment() string
	SetDocComment(string)
	AppendDocComment(string)
	Parent() Namespace
	SetParent(Namespace)
	Singleton() *SingletonClass
	SetSingleton(*SingletonClass)
	IsAbstract() bool
	IsSealed() bool
	IsPrimitive() bool
	IsGeneric() bool
	IsDefined() bool
	SetDefined(bool)

	TypeParameters() []*TypeParameter
	SetTypeParameters([]*TypeParameter)

	Constants() ConstantMap
	Constant(name value.Symbol) (Constant, bool)
	ConstantString(name string) (Constant, bool)
	DefineConstant(name value.Symbol, val Type)
	DefineConstantWithFullName(name value.Symbol, fullName string, val Type)

	Subtypes() ConstantMap
	Subtype(name value.Symbol) (Constant, bool)
	SubtypeString(name string) (Constant, bool)
	MustSubtype(name string) Type
	DefineSubtype(name value.Symbol, val Type)
	DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)

	Methods() MethodMap
	Method(name value.Symbol) *Method
	MethodString(name string) *Method
	DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method
	SetMethod(name value.Symbol, method *Method)

	InstanceVariables() TypeMap
	InstanceVariable(name value.Symbol) Type
	InstanceVariableString(name string) Type
	DefineInstanceVariable(name value.Symbol, val Type)

	MethodAliases() MethodAliasMap
	SetMethodAlias(name value.Symbol, method *Method)

	DefineClass(docComment string, primitive, abstract, sealed bool, name value.Symbol, parent Namespace, env *GlobalEnvironment) *Class
	DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module
	DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin
	DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface
}

func DeepCopyNamespacePath

func DeepCopyNamespacePath(constantPath []string, oldEnv, newEnv *GlobalEnvironment) Namespace

func NameToNamespace

func NameToNamespace(fullSubtypePath string, env *GlobalEnvironment) Namespace

func ToNamespaceInterface

func ToNamespaceInterface[T Namespace](typ T) Namespace

type NamespaceBase

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

func MakeNamespaceBase

func MakeNamespaceBase(docComment, name string) NamespaceBase

func (*NamespaceBase) AppendDocComment

func (c *NamespaceBase) AppendDocComment(newComment string)

func (*NamespaceBase) Constant

func (c *NamespaceBase) Constant(name value.Symbol) (Constant, bool)

Get the constant with the given name.

func (*NamespaceBase) ConstantString

func (c *NamespaceBase) ConstantString(name string) (Constant, bool)

Get the constant with the given name.

func (*NamespaceBase) Constants

func (c *NamespaceBase) Constants() ConstantMap

func (*NamespaceBase) DefineClass

func (c *NamespaceBase) DefineClass(docComment string, abstract, sealed, primitive bool, name value.Symbol, parent Namespace, env *GlobalEnvironment) *Class

Define a new class.

func (*NamespaceBase) DefineConstant

func (c *NamespaceBase) DefineConstant(name value.Symbol, val Type)

func (*NamespaceBase) DefineConstantWithFullName

func (c *NamespaceBase) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)

func (*NamespaceBase) DefineInstanceVariable

func (c *NamespaceBase) DefineInstanceVariable(name value.Symbol, val Type)

func (*NamespaceBase) DefineInterface

func (c *NamespaceBase) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface

Define a new interface.

func (*NamespaceBase) DefineMixin

func (c *NamespaceBase) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin

Define a new mixin.

func (*NamespaceBase) DefineModule

func (c *NamespaceBase) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module

Define a new module.

func (*NamespaceBase) DefineSubtype

func (c *NamespaceBase) DefineSubtype(name value.Symbol, val Type)

func (*NamespaceBase) DefineSubtypeWithFullName

func (c *NamespaceBase) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)

func (*NamespaceBase) DocComment

func (c *NamespaceBase) DocComment() string

func (*NamespaceBase) InstanceVariable

func (c *NamespaceBase) InstanceVariable(name value.Symbol) Type

Get the instance variable with the given name.

func (*NamespaceBase) InstanceVariableString

func (c *NamespaceBase) InstanceVariableString(name string) Type

Get the instance variable with the given name.

func (*NamespaceBase) InstanceVariables

func (c *NamespaceBase) InstanceVariables() TypeMap

func (*NamespaceBase) Method

func (c *NamespaceBase) Method(name value.Symbol) *Method

Get the method with the given name.

func (*NamespaceBase) MethodAliases

func (c *NamespaceBase) MethodAliases() MethodAliasMap

func (*NamespaceBase) MethodString

func (c *NamespaceBase) MethodString(name string) *Method

Get the method with the given name.

func (*NamespaceBase) Methods

func (c *NamespaceBase) Methods() MethodMap

func (*NamespaceBase) MustSubtype

func (c *NamespaceBase) MustSubtype(name string) Type

func (*NamespaceBase) Name

func (c *NamespaceBase) Name() string

func (*NamespaceBase) SetDocComment

func (c *NamespaceBase) SetDocComment(comment string)

func (*NamespaceBase) SetInstanceVariables

func (c *NamespaceBase) SetInstanceVariables(iv TypeMap)

func (*NamespaceBase) SetMethod

func (c *NamespaceBase) SetMethod(name value.Symbol, method *Method)

func (*NamespaceBase) SetMethodAlias

func (c *NamespaceBase) SetMethodAlias(name value.Symbol, method *Method)

func (*NamespaceBase) SetName

func (c *NamespaceBase) SetName(name string)

func (*NamespaceBase) Subtype

func (c *NamespaceBase) Subtype(name value.Symbol) (Constant, bool)

Get the subtype with the given name.

func (*NamespaceBase) SubtypeString

func (c *NamespaceBase) SubtypeString(name string) (Constant, bool)

Get the subtype with the given name.

func (*NamespaceBase) Subtypes

func (c *NamespaceBase) Subtypes() ConstantMap

func (*NamespaceBase) TryDefineClass

func (c *NamespaceBase) TryDefineClass(docComment string, abstract, sealed, primitive bool, name value.Symbol, parent Namespace, env *GlobalEnvironment) *Class

Define a new class if it does not exist

func (*NamespaceBase) TryDefineInterface

func (c *NamespaceBase) TryDefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface

Define a new module if it does not exist.

func (*NamespaceBase) TryDefineMixin

func (c *NamespaceBase) TryDefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin

Define a new mixin if it does not exist.

func (*NamespaceBase) TryDefineModule

func (c *NamespaceBase) TryDefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module

Define a new module if it does not exist.

type NamespacePlaceholder

type NamespacePlaceholder struct {
	Namespace
	Locations *concurrent.Slice[*position.Location]
	// contains filtered or unexported fields
}

Used during typechecking as a placeholder for a future module, class, mixin, interface etc.

func NewNamespacePlaceholder

func NewNamespacePlaceholder(name string) *NamespacePlaceholder

func (*NamespacePlaceholder) Copy

func (*NamespacePlaceholder) DeepCopyEnv

func (n *NamespacePlaceholder) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) Namespace

func (*NamespacePlaceholder) IsLiteral

func (*NamespacePlaceholder) IsLiteral() bool

func (*NamespacePlaceholder) ToNonLiteral

func (p *NamespacePlaceholder) ToNonLiteral(env *GlobalEnvironment) Type

type Never

type Never struct{}

Never represents no value. It is the bottom type. For example a function that never returns might use the type `never`. It is a subtype of all other types. All method calls on never are valid.

It is used to detect unreachable code.

func (Never) IsLiteral

func (Never) IsLiteral() bool

func (Never) ToNonLiteral

func (n Never) ToNonLiteral(env *GlobalEnvironment) Type

type Nil

type Nil struct{}

func (Nil) IsLiteral

func (Nil) IsLiteral() bool

func (Nil) ToNonLiteral

func (v Nil) ToNonLiteral(env *GlobalEnvironment) Type

type Nilable

type Nilable struct {
	Type Type
}

func NewNilable

func NewNilable(typ Type) *Nilable

func (*Nilable) Copy

func (n *Nilable) Copy() *Nilable

func (*Nilable) DeepCopyEnv

func (n *Nilable) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Nilable

func (*Nilable) IsLiteral

func (*Nilable) IsLiteral() bool

func (*Nilable) ToNonLiteral

func (n *Nilable) ToNonLiteral(env *GlobalEnvironment) Type

type NoValue

type NoValue struct{}

Represents no value. It is used to mark constants of pure types, that do not have a runtime value.

func (NoValue) IsLiteral

func (NoValue) IsLiteral() bool

func (NoValue) ToNonLiteral

func (n NoValue) ToNonLiteral(env *GlobalEnvironment) Type

type Not

type Not struct {
	Type Type
}

func NewNot

func NewNot(typ Type) *Not

func (*Not) Copy

func (n *Not) Copy() *Not

func (*Not) DeepCopyEnv

func (n *Not) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Not

func (*Not) IsLiteral

func (*Not) IsLiteral() bool

func (*Not) ToNonLiteral

func (n *Not) ToNonLiteral(env *GlobalEnvironment) Type

type NumericLiteral

type NumericLiteral interface {
	Type
	SimpleLiteral
	IsNegative() bool
	SetNegative(bool)
	CopyNumeric() NumericLiteral
}

type Parameter

type Parameter struct {
	Name             value.Symbol
	Type             Type
	Kind             ParameterKind
	InstanceVariable bool
}

func NewParameter

func NewParameter(name value.Symbol, typ Type, kind ParameterKind, instanceVariable bool) *Parameter

func (*Parameter) Copy

func (p *Parameter) Copy() *Parameter

func (*Parameter) DeepCopyEnv

func (p *Parameter) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Parameter

func (*Parameter) HasDefaultValue

func (p *Parameter) HasDefaultValue() bool

func (*Parameter) IsLiteral

func (*Parameter) IsLiteral() bool

func (*Parameter) IsNamedRest

func (p *Parameter) IsNamedRest() bool

func (*Parameter) IsOptional

func (p *Parameter) IsOptional() bool

func (*Parameter) IsPositionalRest

func (p *Parameter) IsPositionalRest() bool

func (*Parameter) NameWithKind

func (p *Parameter) NameWithKind() string

func (*Parameter) ToNonLiteral

func (p *Parameter) ToNonLiteral(env *GlobalEnvironment) Type

type ParameterKind

type ParameterKind uint8
const (
	NormalParameterKind ParameterKind = iota
	DefaultValueParameterKind
	PositionalRestParameterKind
	NamedRestParameterKind
)

func (ParameterKind) String

func (p ParameterKind) String() string

type Self

type Self struct{}

func (Self) IsLiteral

func (Self) IsLiteral() bool

func (Self) ToNonLiteral

func (s Self) ToNonLiteral(env *GlobalEnvironment) Type

type SimpleLiteral

type SimpleLiteral interface {
	Type
	StringValue() string
}

type SingletonClass

type SingletonClass struct {
	AttachedObject Namespace
	Class
}

Type that represents the singleton class of a mixin, class etc.

func NewSingletonClass

func NewSingletonClass(attached Namespace, parent Namespace) *SingletonClass

func (*SingletonClass) Copy

func (s *SingletonClass) Copy() *SingletonClass

func (*SingletonClass) DeepCopyEnv

func (s *SingletonClass) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *SingletonClass

func (*SingletonClass) DefineMethod

func (c *SingletonClass) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*SingletonClass) SetParent

func (c *SingletonClass) SetParent(parent Namespace)

func (*SingletonClass) ToNonLiteral

func (s *SingletonClass) ToNonLiteral(env *GlobalEnvironment) Type

type SingletonOf

type SingletonOf struct {
	Type Type
}

func NewSingletonOf

func NewSingletonOf(typ Type) *SingletonOf

func (*SingletonOf) Copy

func (s *SingletonOf) Copy() *SingletonOf

func (*SingletonOf) DeepCopyEnv

func (s *SingletonOf) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *SingletonOf

func (*SingletonOf) IsLiteral

func (*SingletonOf) IsLiteral() bool

func (*SingletonOf) ToNonLiteral

func (s *SingletonOf) ToNonLiteral(env *GlobalEnvironment) Type

type StringLiteral

type StringLiteral struct {
	Value string
}

func NewStringLiteral

func NewStringLiteral(value string) *StringLiteral

func (*StringLiteral) IsLiteral

func (*StringLiteral) IsLiteral() bool

func (*StringLiteral) IsSubtypeOf

func (s *StringLiteral) IsSubtypeOf(other Type, env *GlobalEnvironment) bool

func (*StringLiteral) StringValue

func (s *StringLiteral) StringValue() string

func (*StringLiteral) ToNonLiteral

func (s *StringLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type SymbolLiteral

type SymbolLiteral struct {
	Value string
}

func NewSymbolLiteral

func NewSymbolLiteral(value string) *SymbolLiteral

func (*SymbolLiteral) IsLiteral

func (*SymbolLiteral) IsLiteral() bool

func (*SymbolLiteral) StringValue

func (s *SymbolLiteral) StringValue() string

func (*SymbolLiteral) ToNonLiteral

func (s *SymbolLiteral) ToNonLiteral(env *GlobalEnvironment) Type

type True

type True struct{}

func (True) IsLiteral

func (True) IsLiteral() bool

func (True) ToNonLiteral

func (True) ToNonLiteral(env *GlobalEnvironment) Type

type Type

type Type interface {
	ToNonLiteral(*GlobalEnvironment) Type
	IsLiteral() bool
	// contains filtered or unexported methods
}

func DeepCopyEnv

func DeepCopyEnv(t Type, oldEnv, newEnv *GlobalEnvironment) Type

func NameToConstantOk

func NameToConstantOk(fullSubtypePath string, env *GlobalEnvironment) (result Type, ok bool)

func NameToType

func NameToType(fullSubtypePath string, env *GlobalEnvironment) Type

func NameToTypeOk

func NameToTypeOk(fullSubtypePath string, env *GlobalEnvironment) (Type, bool)

func ToTypeInterface

func ToTypeInterface[T Type](typ T) Type

type TypeArgument

type TypeArgument struct {
	Type     Type
	Variance Variance
}

func NewTypeArgument

func NewTypeArgument(typ Type, variance Variance) *TypeArgument

func (*TypeArgument) Copy

func (t *TypeArgument) Copy() *TypeArgument

Create a shallow copy

func (*TypeArgument) DeepCopyEnv

func (t *TypeArgument) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeArgument

type TypeArgumentMap

type TypeArgumentMap map[value.Symbol]*TypeArgument

func (TypeArgumentMap) HasAllTypeParams

func (t TypeArgumentMap) HasAllTypeParams(typeParams []*TypeParameter) bool

type TypeArguments

type TypeArguments struct {
	ArgumentMap   TypeArgumentMap
	ArgumentOrder []value.Symbol
}

func ConstructTypeArgumentsFromTypeParameterUpperBounds

func ConstructTypeArgumentsFromTypeParameterUpperBounds(typeParams []*TypeParameter) *TypeArguments

func ConstructTypeArgumentsFromTypeParameterUpperBoundsAndVariance

func ConstructTypeArgumentsFromTypeParameterUpperBoundsAndVariance(typeParams []*TypeParameter, variance Variance) *TypeArguments

func NewTypeArguments

func NewTypeArguments(m TypeArgumentMap, order []value.Symbol) *TypeArguments

func (*TypeArguments) AllArguments

func (t *TypeArguments) AllArguments() iter.Seq2[value.Symbol, *TypeArgument]

Iterates over every type argument in definition order.

func (*TypeArguments) Copy

func (t *TypeArguments) Copy() *TypeArguments

Create a shallow copy

func (*TypeArguments) DeepCopy

func (t *TypeArguments) DeepCopy() *TypeArguments

Create a deep copy with ArgumentMap

func (*TypeArguments) DeepCopyEnv

func (t *TypeArguments) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeArguments

func (*TypeArguments) DeleteUnnecessaryArgs

func (t *TypeArguments) DeleteUnnecessaryArgs()

func (*TypeArguments) Get

func (t *TypeArguments) Get(i int) *TypeArgument

Get the type argument under the given index

func (*TypeArguments) Len

func (t *TypeArguments) Len() int

type TypeMap

type TypeMap = map[value.Symbol]Type

func TypesDeepCopyEnv

func TypesDeepCopyEnv(types TypeMap, oldEnv, newEnv *GlobalEnvironment) TypeMap

type TypeParamNamespace

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

func NewTypeParamNamespace

func NewTypeParamNamespace(docComment string) *TypeParamNamespace

func (*TypeParamNamespace) AppendDocComment

func (t *TypeParamNamespace) AppendDocComment(string)

func (*TypeParamNamespace) Constant

func (t *TypeParamNamespace) Constant(name value.Symbol) (Constant, bool)

func (*TypeParamNamespace) ConstantString

func (t *TypeParamNamespace) ConstantString(name string) (Constant, bool)

func (*TypeParamNamespace) Constants

func (t *TypeParamNamespace) Constants() ConstantMap

func (*TypeParamNamespace) Copy

func (*TypeParamNamespace) DeepCopyEnv

func (t *TypeParamNamespace) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeParamNamespace

func (*TypeParamNamespace) DefineClass

func (t *TypeParamNamespace) DefineClass(docComment string, primitive, abstract, sealed bool, name value.Symbol, parent Namespace, env *GlobalEnvironment) *Class

func (*TypeParamNamespace) DefineConstant

func (t *TypeParamNamespace) DefineConstant(name value.Symbol, val Type)

func (*TypeParamNamespace) DefineConstantWithFullName

func (t *TypeParamNamespace) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)

func (*TypeParamNamespace) DefineInstanceVariable

func (t *TypeParamNamespace) DefineInstanceVariable(name value.Symbol, val Type)

func (*TypeParamNamespace) DefineInterface

func (t *TypeParamNamespace) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface

func (*TypeParamNamespace) DefineMethod

func (t *TypeParamNamespace) DefineMethod(docComment string, abstract, sealed, native bool, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method

func (*TypeParamNamespace) DefineMixin

func (t *TypeParamNamespace) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin

func (*TypeParamNamespace) DefineModule

func (t *TypeParamNamespace) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module

func (*TypeParamNamespace) DefineSubtype

func (t *TypeParamNamespace) DefineSubtype(name value.Symbol, val Type)

func (*TypeParamNamespace) DefineSubtypeWithFullName

func (t *TypeParamNamespace) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)

func (*TypeParamNamespace) DocComment

func (t *TypeParamNamespace) DocComment() string

func (*TypeParamNamespace) InstanceVariable

func (t *TypeParamNamespace) InstanceVariable(name value.Symbol) Type

func (*TypeParamNamespace) InstanceVariableString

func (t *TypeParamNamespace) InstanceVariableString(name string) Type

func (*TypeParamNamespace) InstanceVariables

func (t *TypeParamNamespace) InstanceVariables() TypeMap

func (*TypeParamNamespace) IsAbstract

func (t *TypeParamNamespace) IsAbstract() bool

func (*TypeParamNamespace) IsDefined

func (t *TypeParamNamespace) IsDefined() bool

func (*TypeParamNamespace) IsGeneric

func (t *TypeParamNamespace) IsGeneric() bool

func (*TypeParamNamespace) IsLiteral

func (*TypeParamNamespace) IsLiteral() bool

func (*TypeParamNamespace) IsPrimitive

func (t *TypeParamNamespace) IsPrimitive() bool

func (*TypeParamNamespace) IsSealed

func (t *TypeParamNamespace) IsSealed() bool

func (*TypeParamNamespace) Method

func (t *TypeParamNamespace) Method(name value.Symbol) *Method

func (*TypeParamNamespace) MethodAliases

func (t *TypeParamNamespace) MethodAliases() MethodAliasMap

func (*TypeParamNamespace) MethodString

func (t *TypeParamNamespace) MethodString(name string) *Method

func (*TypeParamNamespace) Methods

func (t *TypeParamNamespace) Methods() MethodMap

func (*TypeParamNamespace) MustSubtype

func (t *TypeParamNamespace) MustSubtype(name string) Type

func (*TypeParamNamespace) Name

func (t *TypeParamNamespace) Name() string

func (*TypeParamNamespace) Parent

func (t *TypeParamNamespace) Parent() Namespace

func (*TypeParamNamespace) SetDefined

func (t *TypeParamNamespace) SetDefined(bool)

func (*TypeParamNamespace) SetDocComment

func (t *TypeParamNamespace) SetDocComment(string)

func (*TypeParamNamespace) SetMethod

func (t *TypeParamNamespace) SetMethod(name value.Symbol, method *Method)

func (*TypeParamNamespace) SetMethodAlias

func (t *TypeParamNamespace) SetMethodAlias(name value.Symbol, method *Method)

func (*TypeParamNamespace) SetParent

func (t *TypeParamNamespace) SetParent(Namespace)

func (*TypeParamNamespace) SetSingleton

func (t *TypeParamNamespace) SetSingleton(*SingletonClass)

func (*TypeParamNamespace) SetTypeParameters

func (t *TypeParamNamespace) SetTypeParameters([]*TypeParameter)

func (*TypeParamNamespace) Singleton

func (t *TypeParamNamespace) Singleton() *SingletonClass

func (*TypeParamNamespace) Subtype

func (t *TypeParamNamespace) Subtype(name value.Symbol) (Constant, bool)

func (*TypeParamNamespace) SubtypeString

func (t *TypeParamNamespace) SubtypeString(name string) (Constant, bool)

func (*TypeParamNamespace) Subtypes

func (t *TypeParamNamespace) Subtypes() ConstantMap

func (*TypeParamNamespace) ToNonLiteral

func (t *TypeParamNamespace) ToNonLiteral(env *GlobalEnvironment) Type

func (*TypeParamNamespace) TypeParameters

func (t *TypeParamNamespace) TypeParameters() []*TypeParameter

type TypeParameter

type TypeParameter struct {
	Name       value.Symbol
	Namespace  Namespace
	LowerBound Type
	UpperBound Type
	Variance   Variance
}

func NewTypeParameter

func NewTypeParameter(name value.Symbol, namespace Namespace, lowerBound, upperBound Type, variance Variance) *TypeParameter

func TypeParametersDeepCopyEnv

func TypeParametersDeepCopyEnv(typeParameters []*TypeParameter, oldEnv, newEnv *GlobalEnvironment) []*TypeParameter

func (*TypeParameter) Copy

func (t *TypeParameter) Copy() *TypeParameter

func (*TypeParameter) DeepCopyEnv

func (t *TypeParameter) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeParameter

func (*TypeParameter) InspectSignature

func (t *TypeParameter) InspectSignature() string

func (*TypeParameter) InspectSignatureWithColor

func (t *TypeParameter) InspectSignatureWithColor() string

func (*TypeParameter) IsLiteral

func (*TypeParameter) IsLiteral() bool

func (*TypeParameter) ToNonLiteral

func (t *TypeParameter) ToNonLiteral(env *GlobalEnvironment) Type

type UInt16Literal

type UInt16Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewUInt16Literal

func NewUInt16Literal(value string) *UInt16Literal

func (*UInt16Literal) CopyNumeric

func (i *UInt16Literal) CopyNumeric() NumericLiteral

func (*UInt16Literal) IsLiteral

func (*UInt16Literal) IsLiteral() bool

func (*UInt16Literal) IsNegative

func (i *UInt16Literal) IsNegative() bool

func (*UInt16Literal) SetNegative

func (i *UInt16Literal) SetNegative(val bool)

func (*UInt16Literal) StringValue

func (i *UInt16Literal) StringValue() string

func (*UInt16Literal) ToNonLiteral

func (i *UInt16Literal) ToNonLiteral(env *GlobalEnvironment) Type

type UInt32Literal

type UInt32Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewUInt32Literal

func NewUInt32Literal(value string) *UInt32Literal

func (*UInt32Literal) CopyNumeric

func (i *UInt32Literal) CopyNumeric() NumericLiteral

func (*UInt32Literal) IsLiteral

func (*UInt32Literal) IsLiteral() bool

func (*UInt32Literal) IsNegative

func (i *UInt32Literal) IsNegative() bool

func (*UInt32Literal) SetNegative

func (i *UInt32Literal) SetNegative(val bool)

func (*UInt32Literal) StringValue

func (i *UInt32Literal) StringValue() string

func (*UInt32Literal) ToNonLiteral

func (i *UInt32Literal) ToNonLiteral(env *GlobalEnvironment) Type

type UInt64Literal

type UInt64Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewUInt64Literal

func NewUInt64Literal(value string) *UInt64Literal

func (*UInt64Literal) CopyNumeric

func (i *UInt64Literal) CopyNumeric() NumericLiteral

func (*UInt64Literal) IsLiteral

func (*UInt64Literal) IsLiteral() bool

func (*UInt64Literal) IsNegative

func (i *UInt64Literal) IsNegative() bool

func (*UInt64Literal) SetNegative

func (i *UInt64Literal) SetNegative(val bool)

func (*UInt64Literal) StringValue

func (i *UInt64Literal) StringValue() string

func (*UInt64Literal) ToNonLiteral

func (i *UInt64Literal) ToNonLiteral(env *GlobalEnvironment) Type

type UInt8Literal

type UInt8Literal struct {
	Value string
	// contains filtered or unexported fields
}

func NewUInt8Literal

func NewUInt8Literal(value string) *UInt8Literal

func (*UInt8Literal) CopyNumeric

func (i *UInt8Literal) CopyNumeric() NumericLiteral

func (*UInt8Literal) IsLiteral

func (*UInt8Literal) IsLiteral() bool

func (*UInt8Literal) IsNegative

func (i *UInt8Literal) IsNegative() bool

func (*UInt8Literal) SetNegative

func (i *UInt8Literal) SetNegative(val bool)

func (*UInt8Literal) StringValue

func (i *UInt8Literal) StringValue() string

func (*UInt8Literal) ToNonLiteral

func (i *UInt8Literal) ToNonLiteral(env *GlobalEnvironment) Type

type Union

type Union struct {
	Elements []Type
}

Union type represents a list of types. A value has to satisfy at least one of the types.

func NewUnion

func NewUnion(elements ...Type) *Union

func (*Union) Copy

func (u *Union) Copy() *Union

func (*Union) DeepCopyEnv

func (u *Union) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Union

func (*Union) IsLiteral

func (*Union) IsLiteral() bool

func (*Union) ToNonLiteral

func (u *Union) ToNonLiteral(env *GlobalEnvironment) Type

type Untyped

type Untyped struct{}

Untyped represents no valid type. It is the bottom type and the top type. It is a subtype of all other types. And all types are subtypes of nothing. All method calls on nothing are valid.

It is used internally in the typechecker as a return type for invalid expressions like calls to methods that do not exist. It helps with avoiding cascading errors.

func (Untyped) IsLiteral

func (Untyped) IsLiteral() bool

func (Untyped) ToNonLiteral

func (n Untyped) ToNonLiteral(env *GlobalEnvironment) Type

type UsingBufferNamespace

type UsingBufferNamespace struct {
	Module
}

func NewUsingBufferNamespace

func NewUsingBufferNamespace() *UsingBufferNamespace

func (*UsingBufferNamespace) Copy

func (*UsingBufferNamespace) DeepCopyEnv

func (u *UsingBufferNamespace) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *UsingBufferNamespace

type Variance

type Variance uint8
const (
	INVARIANT Variance = iota
	COVARIANT
	CONTRAVARIANT
	BIVARIANT
)

func (Variance) Name

func (v Variance) Name() string

func (Variance) String

func (v Variance) String() string

type Void

type Void struct{}

Void is the type that is incompatible with any other type.

func (Void) IsLiteral

func (Void) IsLiteral() bool

func (Void) ToNonLiteral

func (v Void) ToNonLiteral(env *GlobalEnvironment) Type

Directories

Path Synopsis
Package checker implements the Elk type checker
Package checker implements the Elk type checker

Jump to

Keyboard shortcuts

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