Documentation
¶
Overview ¶
Package types contains the Elk type checker.
Index ¶
- Constants
- func AllConstants(namespace Namespace) iter.Seq2[value.Symbol, Constant]
- func AllInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, InstanceVariable]
- func AllMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]
- func AllSubtypes(namespace Namespace) iter.Seq2[value.Symbol, Constant]
- func Backward[T any](iterator iter.Seq[T]) iter.Seq[T]
- func CreateTypeArgumentOrderFromTypeParams(typeParams []*TypeParameter) []value.Symbol
- func DirectParents(namespace Namespace) iter.Seq[Namespace]
- func DirectlyImplementedInterfaces(namespace Namespace) iter.Seq[Namespace]
- func DirectlyIncludedAndImplemented(namespace Namespace) iter.Seq[Namespace]
- func DirectlyIncludedMixins(namespace Namespace) iter.Seq[Namespace]
- func GetConstantName(fullConstantPath string) string
- func GetConstantPath(fullConstantPath string) []string
- func GetInstanceVariableInNamespace(namespace Namespace, name value.Symbol) (Type, Namespace)
- func I(typ Type) string
- func ImplementInterface(target, interfaceNamespace Namespace)
- func ImplementedInterfaces(namespace Namespace) iter.Seq[Namespace]
- func IncludeMixin(target, includedNamespace Namespace)
- func IncludeMixinForMacro(target Namespace, mixin *Mixin)
- func IncludedMixins(namespace Namespace) iter.Seq[Namespace]
- func Inspect(typ Type) string
- func InspectInheritance(namespace Namespace) string
- func InspectInstanceVariable(name string) string
- func InspectInstanceVariableDeclaration(name string, typ Type) string
- func InspectInstanceVariableDeclarationWithColor(name string, typ Type) string
- func InspectInstanceVariableWithColor(name string) string
- func InspectModifier(abstract, sealed, primitive, noinit bool) string
- func InspectWithColor(typ Type) string
- func IsAny(t Type) bool
- func IsBool(t Type) bool
- func IsCallable(namespace Namespace) bool
- func IsClosure(namespace Namespace) bool
- func IsConstantPlaceholder(typ Type) bool
- func IsFalse(t Type, env *GlobalEnvironment) bool
- func IsFalseLiteral(t Type) bool
- func IsGeneric(typ Type) bool
- func IsInterface(typ Type) bool
- func IsMixin(typ Type) bool
- func IsMixinWithWhere(typ Type) bool
- func IsNever(t Type) bool
- func IsNil(t Type, env *GlobalEnvironment) bool
- func IsNilLiteral(t Type) bool
- func IsNoValue(t Type) bool
- func IsPointerNil(val any) bool
- func IsSelf(t Type) bool
- func IsTrue(t Type, env *GlobalEnvironment) bool
- func IsTrueLiteral(t Type) bool
- func IsUntyped(t Type) bool
- func IsVoid(t Type) bool
- func MakeFullConstantName(containerName, constName string) string
- func NamespaceDeclaresInstanceVariables(namespace Namespace) bool
- func NamespaceHasAnyDefinableMethods(namespace Namespace) bool
- func NamespacesAreEqual(left, right Namespace) bool
- func OwnInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, Type]
- func OwnMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]
- func Parents(namespace Namespace) iter.Seq[Namespace]
- func RequiredTypeParameters(typeParams []*TypeParameter) int
- func SortedConstants(namespace Namespace) iter.Seq2[value.Symbol, Constant]
- func SortedInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, InstanceVariable]
- func SortedMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]
- func SortedOwnInstanceVariables(namespace Namespace) iter.Seq2[value.Symbol, Type]
- func SortedOwnMethods(namespace Namespace) iter.Seq2[value.Symbol, *Method]
- func SortedSubtypes(namespace Namespace) iter.Seq2[value.Symbol, Constant]
- func Traverse(typ Type, enter func(typ, parent Type) TraverseOption, ...)
- type Any
- type AstNode
- type BigFloatLiteral
- func (f *BigFloatLiteral) CopyNumeric() NumericLiteral
- func (*BigFloatLiteral) IsLiteral() bool
- func (f *BigFloatLiteral) IsNegative() bool
- func (f *BigFloatLiteral) SetNegative(val bool)
- func (f *BigFloatLiteral) StringValue() string
- func (*BigFloatLiteral) ToNonLiteral(env *GlobalEnvironment) Type
- type Bool
- type Callable
- func (c *Callable) AppendDocComment(string)
- func (c *Callable) Constant(name value.Symbol) (Constant, bool)
- func (c *Callable) ConstantString(name string) (Constant, bool)
- func (c *Callable) Constants() ConstantMap
- func (c *Callable) Copy() *Callable
- func (c *Callable) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Callable
- func (c *Callable) DefineClass(docComment string, primitive, abstract, sealed, noinit bool, name value.Symbol, ...) *Class
- func (c *Callable) DefineConstant(name value.Symbol, val Type)
- func (c *Callable) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)
- func (c *Callable) DefineInstanceVariable(name value.Symbol, val Type)
- func (c *Callable) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface
- func (c *Callable) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (c *Callable) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin
- func (c *Callable) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module
- func (c *Callable) DefineSubtype(name value.Symbol, val Type)
- func (c *Callable) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)
- func (c *Callable) DocComment() string
- func (c *Callable) InstanceVariable(name value.Symbol) Type
- func (c *Callable) InstanceVariableString(name string) Type
- func (c *Callable) InstanceVariables() TypeMap
- func (c *Callable) IsAbstract() bool
- func (c *Callable) IsDefined() bool
- func (c *Callable) IsGeneric() bool
- func (*Callable) IsLiteral() bool
- func (c *Callable) IsNative() bool
- func (c *Callable) IsPrimitive() bool
- func (c *Callable) IsSealed() bool
- func (c *Callable) Method(name value.Symbol) *Method
- func (c *Callable) MethodString(name string) *Method
- func (c *Callable) Methods() MethodMap
- func (c *Callable) MustSubtype(name value.Symbol) Type
- func (c *Callable) MustSubtypeString(name string) Type
- func (c *Callable) Name() string
- func (c *Callable) Parent() Namespace
- func (c *Callable) SetDefined(bool)
- func (c *Callable) SetDocComment(string)
- func (c *Callable) SetMethod(name value.Symbol, method *Method)
- func (c *Callable) SetParent(Namespace)
- func (c *Callable) SetSingleton(*SingletonClass)
- func (c *Callable) SetTypeParameters(t []*TypeParameter)
- func (c *Callable) Singleton() *SingletonClass
- func (c *Callable) Subtype(name value.Symbol) (Constant, bool)
- func (c *Callable) SubtypeString(name string) (Constant, bool)
- func (c *Callable) Subtypes() ConstantMap
- func (c *Callable) ToNonLiteral(env *GlobalEnvironment) Type
- func (c *Callable) TypeParameters() []*TypeParameter
- type CharLiteral
- type Checker
- type Class
- func (c *Class) AttachedObjectName() string
- func (c *Class) Copy() *Class
- func (c *Class) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Class
- func (c *Class) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (c *Class) IsAbstract() bool
- func (c *Class) IsCompiled() bool
- func (c *Class) IsDefined() bool
- func (c *Class) IsGeneric() bool
- func (*Class) IsLiteral() bool
- func (c *Class) IsNative() bool
- func (c *Class) IsNoInit() bool
- func (c *Class) IsPrimitive() bool
- func (c *Class) IsSealed() bool
- func (c *Class) IvarIndices() *value.IvarIndices
- func (c *Class) Parent() Namespace
- func (c *Class) RemoveTemporaryParents(env *GlobalEnvironment)
- func (c *Class) SetAbstract(abstract bool) *Class
- func (c *Class) SetCompiled(val bool)
- func (c *Class) SetDefined(val bool)
- func (c *Class) SetIvarIndices(in *value.IvarIndices)
- func (c *Class) SetNative(native bool) *Class
- func (c *Class) SetNoInit(noinit bool) *Class
- func (c *Class) SetParent(parent Namespace)
- func (c *Class) SetPrimitive(primitive bool) *Class
- func (c *Class) SetSealed(sealed bool) *Class
- func (c *Class) SetSingleton(singleton *SingletonClass)
- func (c *Class) SetTypeParameters(t []*TypeParameter)
- func (c *Class) Singleton() *SingletonClass
- func (c *Class) Superclass() Namespace
- func (c *Class) ToNonLiteral(env *GlobalEnvironment) Type
- func (c *Class) TypeParameters() []*TypeParameter
- type Constant
- type ConstantMap
- type ConstantPlaceholder
- type False
- type Float32Literal
- type Float64Literal
- type FloatLiteral
- type Generic
- func NewGeneric(typ Namespace, typeArgs *TypeArguments) *Generic
- func NewGenericWithTypeArgs(namespace Namespace, args ...Type) *Generic
- func NewGenericWithUpperBoundTypeArgs(namespace Namespace) *Generic
- func NewGenericWithUpperBoundTypeArgsAndVariance(namespace Namespace, variance Variance) *Generic
- func NewGenericWithVariance(namespace Namespace, variance Variance, args ...Type) *Generic
- type GenericNamedType
- type GlobalEnvironment
- func (g *GlobalEnvironment) ASTSubtype(name value.Symbol) Type
- func (g *GlobalEnvironment) DeepCopyEnv() *GlobalEnvironment
- func (g *GlobalEnvironment) ExpressionNode() *Mixin
- func (g *GlobalEnvironment) PatternNode() *Mixin
- func (g *GlobalEnvironment) Std() *Module
- func (g *GlobalEnvironment) StdConst(name value.Symbol) Type
- func (g *GlobalEnvironment) StdConstString(name string) Type
- func (g *GlobalEnvironment) StdSubtype(name value.Symbol) Type
- func (g *GlobalEnvironment) StdSubtypeClass(name value.Symbol) *Class
- func (g *GlobalEnvironment) StdSubtypeModule(name value.Symbol) *Module
- func (g *GlobalEnvironment) StdSubtypeString(name string) Type
- func (g *GlobalEnvironment) TypeNode() *Mixin
- type InstanceOf
- type InstanceVariable
- type Int8Literal
- type Int16Literal
- type Int32Literal
- type Int64Literal
- type IntLiteral
- type Interface
- func (i *Interface) Copy() *Interface
- func (i *Interface) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Interface
- func (i *Interface) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (*Interface) IsAbstract() bool
- func (i *Interface) IsDefined() bool
- func (i *Interface) IsGeneric() bool
- func (*Interface) IsLiteral() bool
- func (*Interface) IsNative() bool
- func (*Interface) IsPrimitive() bool
- func (*Interface) IsSealed() bool
- func (i *Interface) Parent() Namespace
- func (i *Interface) SetDefined(compiled bool)
- func (i *Interface) SetParent(parent Namespace)
- func (i *Interface) SetSingleton(singleton *SingletonClass)
- func (i *Interface) SetTypeParameters(t []*TypeParameter)
- func (i *Interface) Singleton() *SingletonClass
- func (i *Interface) ToNonLiteral(env *GlobalEnvironment) Type
- func (i *Interface) TypeParameters() []*TypeParameter
- type InterfaceProxy
- type Intersection
- type Method
- func DefMacro(namespace Namespace, docComment string, name string, params []*Parameter, ...) *Method
- func GetMethod(typ Type, name string, env *GlobalEnvironment) *Method
- func NewMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func NewMethodPlaceholder(fullName string, name value.Symbol, definedUnder Namespace, ...) *Method
- func (m *Method) AllOverloads() iter.Seq[*Method]
- func (m *Method) AreInstanceVariablesChecked() bool
- func (m *Method) Copy() *Method
- func (m *Method) CreateAlias(newName value.Symbol) *Method
- func (m *Method) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Method
- func (m *Method) ExpectedParamCountString() string
- func (m *Method) HasNamedRestParam() bool
- func (m *Method) HasPositionalRestParam() bool
- func (m *Method) InspectSignature(showModifiers bool) string
- func (m *Method) InspectSignatureWithColor(showModifiers bool) string
- func (m *Method) IsAbstract() bool
- func (m *Method) IsAsync() bool
- func (m *Method) IsAttribute() bool
- func (m *Method) IsChecked() bool
- func (m *Method) IsCompilable() bool
- func (m *Method) IsCompiled() bool
- func (m *Method) IsDefinable() bool
- func (m *Method) IsGenerator() bool
- func (m *Method) IsGeneric() bool
- func (m *Method) IsInit() bool
- func (*Method) IsLiteral() bool
- func (m *Method) IsMacro() bool
- func (m *Method) IsNative() bool
- func (m *Method) IsOverload() bool
- func (m *Method) IsPlaceholder() bool
- func (m *Method) IsRegisteredOverload() bool
- func (m *Method) IsReplaced() bool
- func (m *Method) IsSealed() bool
- func (m *Method) IsSetter() bool
- func (m *Method) Location() *position.Location
- func (m *Method) NamedRestParam() *Parameter
- func (m *Method) PositionalRestParam() *Parameter
- func (m *Method) PositionalRestParamIndex() int
- func (m *Method) RegisterOverload(overload *Method)
- func (m *Method) RequiredParamCount() int
- func (m *Method) ReverseOverloads() iter.Seq[*Method]
- func (m *Method) SetAbstract(abstract bool) *Method
- func (m *Method) SetAsync(val bool) *Method
- func (m *Method) SetAttribute(val bool) *Method
- func (m *Method) SetChecked(val bool) *Method
- func (m *Method) SetCompiled(compiled bool) *Method
- func (m *Method) SetFlag(flag bitfield.BitFlag16, val bool)
- func (m *Method) SetGenerator(val bool) *Method
- func (m *Method) SetInstanceVariablesChecked(val bool) *Method
- func (m *Method) SetLocation(location *position.Location)
- func (m *Method) SetMacro(val bool) *Method
- func (m *Method) SetNamedRestParam(val bool) *Method
- func (m *Method) SetNative(native bool) *Method
- func (m *Method) SetOverload(val bool) *Method
- func (m *Method) SetPlaceholder(val bool) *Method
- func (m *Method) SetReplaced(val bool) *Method
- func (m *Method) SetSealed(sealed bool) *Method
- func (m *Method) ToNonLiteral(env *GlobalEnvironment) Type
- func (m *Method) WithoutOverloads() *Method
- type MethodMap
- type Mixin
- func (m *Mixin) Copy() *Mixin
- func (m *Mixin) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Mixin
- func (m *Mixin) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (m *Mixin) IsAbstract() bool
- func (m *Mixin) IsDefined() bool
- func (m *Mixin) IsGeneric() bool
- func (*Mixin) IsLiteral() bool
- func (m *Mixin) IsNative() bool
- func (m *Mixin) IsPrimitive() bool
- func (m *Mixin) IsSealed() bool
- func (m *Mixin) Parent() Namespace
- func (m *Mixin) RemoveTemporaryParents(env *GlobalEnvironment)
- func (m *Mixin) SetAbstract(abstract bool) *Mixin
- func (m *Mixin) SetDefined(compiled bool)
- func (m *Mixin) SetNative(native bool)
- func (m *Mixin) SetParent(parent Namespace)
- func (m *Mixin) SetSingleton(singleton *SingletonClass)
- func (m *Mixin) SetTypeParameters(t []*TypeParameter)
- func (m *Mixin) Singleton() *SingletonClass
- func (m *Mixin) ToNonLiteral(env *GlobalEnvironment) Type
- func (m *Mixin) TypeParameters() []*TypeParameter
- type MixinProxy
- type MixinWithWhere
- func (m *MixinWithWhere) Copy() *MixinWithWhere
- func (m *MixinWithWhere) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *MixinWithWhere
- func (m *MixinWithWhere) InspectExtend() string
- func (m *MixinWithWhere) InspectExtendWithColor() string
- func (m *MixinWithWhere) ToNonLiteral(env *GlobalEnvironment) Type
- type Module
- func (m *Module) Copy() *Module
- func (m *Module) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Module
- func (m *Module) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (m *Module) IsAbstract() bool
- func (m *Module) IsDefined() bool
- func (m *Module) IsGeneric() bool
- func (*Module) IsLiteral() bool
- func (m *Module) IsNative() bool
- func (m *Module) IsPrimitive() bool
- func (m *Module) IsSealed() bool
- func (m *Module) IvarIndices() *value.IvarIndices
- func (m *Module) Parent() Namespace
- func (m *Module) RemoveTemporaryParents()
- func (m *Module) SetDefined(defined bool)
- func (m *Module) SetIvarIndices(in *value.IvarIndices)
- func (m *Module) SetNative(native bool)
- func (m *Module) SetParent(parent Namespace)
- func (m *Module) SetSingleton(*SingletonClass)
- func (m *Module) SetTypeParameters(t []*TypeParameter)
- func (*Module) Singleton() *SingletonClass
- func (m *Module) ToNonLiteral(env *GlobalEnvironment) Type
- func (m *Module) TypeParameters() []*TypeParameter
- type ModulePlaceholder
- type NamedType
- type Namespace
- type NamespaceBase
- func (c *NamespaceBase) AppendDocComment(newComment string)
- func (c *NamespaceBase) Constant(name value.Symbol) (Constant, bool)
- func (c *NamespaceBase) ConstantString(name string) (Constant, bool)
- func (c *NamespaceBase) Constants() ConstantMap
- func (c *NamespaceBase) DefineClass(docComment string, abstract, sealed, primitive, noinit bool, name value.Symbol, ...) *Class
- func (c *NamespaceBase) DefineConstant(name value.Symbol, val Type)
- func (c *NamespaceBase) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)
- func (c *NamespaceBase) DefineInstanceVariable(name value.Symbol, val Type)
- func (c *NamespaceBase) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface
- func (c *NamespaceBase) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin
- func (c *NamespaceBase) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module
- func (c *NamespaceBase) DefineSubtype(name value.Symbol, val Type)
- func (c *NamespaceBase) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)
- func (c *NamespaceBase) DocComment() string
- func (c *NamespaceBase) HasInstanceVariables() bool
- func (c *NamespaceBase) InstanceVariable(name value.Symbol) Type
- func (c *NamespaceBase) InstanceVariableString(name string) Type
- func (c *NamespaceBase) InstanceVariables() TypeMap
- func (c *NamespaceBase) Method(name value.Symbol) *Method
- func (c *NamespaceBase) MethodString(name string) *Method
- func (c *NamespaceBase) Methods() MethodMap
- func (c *NamespaceBase) MustSubtype(name value.Symbol) Type
- func (c *NamespaceBase) MustSubtypeString(name string) Type
- func (c *NamespaceBase) Name() string
- func (c *NamespaceBase) SetDocComment(comment string)
- func (c *NamespaceBase) SetInstanceVariables(iv TypeMap)
- func (c *NamespaceBase) SetMethod(name value.Symbol, method *Method)
- func (c *NamespaceBase) SetName(name string)
- func (c *NamespaceBase) Subtype(name value.Symbol) (Constant, bool)
- func (c *NamespaceBase) SubtypeString(name string) (Constant, bool)
- func (c *NamespaceBase) Subtypes() ConstantMap
- func (c *NamespaceBase) TryDefineClass(docComment string, abstract, sealed, primitive, noinit bool, name value.Symbol, ...) *Class
- func (c *NamespaceBase) TryDefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface
- func (c *NamespaceBase) TryDefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin
- func (c *NamespaceBase) TryDefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module
- type NamespacePlaceholder
- type NamespaceWithIvarIndices
- type Never
- type Nil
- type Nilable
- type NoValue
- type Not
- type NumericLiteral
- type Parameter
- func (p *Parameter) Copy() *Parameter
- func (p *Parameter) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Parameter
- func (p *Parameter) HasDefaultValue() bool
- func (*Parameter) IsLiteral() bool
- func (p *Parameter) IsNamedRest() bool
- func (p *Parameter) IsOptional() bool
- func (p *Parameter) IsPositionalRest() bool
- func (p *Parameter) NameWithKind() string
- func (p *Parameter) ToNonLiteral(env *GlobalEnvironment) Type
- type ParameterKind
- type Self
- type SimpleLiteral
- type SingletonClass
- func (s *SingletonClass) Copy() *SingletonClass
- func (s *SingletonClass) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *SingletonClass
- func (c *SingletonClass) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (c *SingletonClass) RemoveTemporaryParents(env *GlobalEnvironment)
- func (c *SingletonClass) SetParent(parent Namespace)
- func (s *SingletonClass) ToNonLiteral(env *GlobalEnvironment) Type
- type SingletonOf
- type StringLiteral
- type SymbolLiteral
- type TemporaryParent
- type TraverseOption
- type True
- type Type
- func DeepCopyEnv(t Type, oldEnv, newEnv *GlobalEnvironment) Type
- func NameToConstantOk(fullSubtypePath string, env *GlobalEnvironment) (result Type, ok bool)
- func NameToType(fullSubtypePath string, env *GlobalEnvironment) Type
- func NameToTypeOk(fullSubtypePath string, env *GlobalEnvironment) (Type, bool)
- func ToTypeInterface[T Type](typ T) Type
- type TypeArgument
- type TypeArgumentMap
- type TypeArguments
- func ConstructTypeArgumentsFromTypeParameterUpperBounds(typeParams []*TypeParameter) *TypeArguments
- func ConstructTypeArgumentsFromTypeParameterUpperBoundsAndVariance(typeParams []*TypeParameter, variance Variance) *TypeArguments
- func NewTypeArguments(m TypeArgumentMap, order []value.Symbol) *TypeArguments
- func (t *TypeArguments) AllArguments() iter.Seq2[value.Symbol, *TypeArgument]
- func (t *TypeArguments) Copy() *TypeArguments
- func (t *TypeArguments) DeepCopy() *TypeArguments
- func (t *TypeArguments) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeArguments
- func (t *TypeArguments) DeleteUnnecessaryArgs()
- func (t *TypeArguments) Get(i int) *TypeArgument
- func (t *TypeArguments) Len() int
- type TypeMap
- type TypeParamNamespace
- func (t *TypeParamNamespace) AppendDocComment(string)
- func (t *TypeParamNamespace) Constant(name value.Symbol) (Constant, bool)
- func (t *TypeParamNamespace) ConstantString(name string) (Constant, bool)
- func (t *TypeParamNamespace) Constants() ConstantMap
- func (t *TypeParamNamespace) Copy() *TypeParamNamespace
- func (t *TypeParamNamespace) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeParamNamespace
- func (t *TypeParamNamespace) DefineClass(docComment string, primitive, abstract, sealed, noinit bool, name value.Symbol, ...) *Class
- func (t *TypeParamNamespace) DefineConstant(name value.Symbol, val Type)
- func (t *TypeParamNamespace) DefineConstantWithFullName(name value.Symbol, fullName string, val Type)
- func (t *TypeParamNamespace) DefineInstanceVariable(name value.Symbol, val Type)
- func (t *TypeParamNamespace) DefineInterface(docComment string, name value.Symbol, env *GlobalEnvironment) *Interface
- func (t *TypeParamNamespace) DefineMethod(docComment string, flags bitfield.BitFlag16, name value.Symbol, ...) *Method
- func (t *TypeParamNamespace) DefineMixin(docComment string, abstract bool, name value.Symbol, env *GlobalEnvironment) *Mixin
- func (t *TypeParamNamespace) DefineModule(docComment string, name value.Symbol, env *GlobalEnvironment) *Module
- func (t *TypeParamNamespace) DefineSubtype(name value.Symbol, val Type)
- func (t *TypeParamNamespace) DefineSubtypeWithFullName(name value.Symbol, fullName string, val Type)
- func (t *TypeParamNamespace) DocComment() string
- func (t *TypeParamNamespace) InstanceVariable(name value.Symbol) Type
- func (t *TypeParamNamespace) InstanceVariableString(name string) Type
- func (t *TypeParamNamespace) InstanceVariables() TypeMap
- func (t *TypeParamNamespace) IsAbstract() bool
- func (t *TypeParamNamespace) IsDefined() bool
- func (t *TypeParamNamespace) IsGeneric() bool
- func (*TypeParamNamespace) IsLiteral() bool
- func (t *TypeParamNamespace) IsNative() bool
- func (t *TypeParamNamespace) IsPrimitive() bool
- func (t *TypeParamNamespace) IsSealed() bool
- func (t *TypeParamNamespace) Method(name value.Symbol) *Method
- func (t *TypeParamNamespace) MethodString(name string) *Method
- func (t *TypeParamNamespace) Methods() MethodMap
- func (t *TypeParamNamespace) MustSubtype(name value.Symbol) Type
- func (t *TypeParamNamespace) MustSubtypeString(name string) Type
- func (t *TypeParamNamespace) Name() string
- func (t *TypeParamNamespace) Parent() Namespace
- func (t *TypeParamNamespace) SetDefined(bool)
- func (t *TypeParamNamespace) SetDocComment(string)
- func (t *TypeParamNamespace) SetMethod(name value.Symbol, method *Method)
- func (t *TypeParamNamespace) SetParent(Namespace)
- func (t *TypeParamNamespace) SetSingleton(*SingletonClass)
- func (t *TypeParamNamespace) SetTypeParameters([]*TypeParameter)
- func (t *TypeParamNamespace) Singleton() *SingletonClass
- func (t *TypeParamNamespace) Subtype(name value.Symbol) (Constant, bool)
- func (t *TypeParamNamespace) SubtypeString(name string) (Constant, bool)
- func (t *TypeParamNamespace) Subtypes() ConstantMap
- func (t *TypeParamNamespace) ToNonLiteral(env *GlobalEnvironment) Type
- func (t *TypeParamNamespace) TypeParameters() []*TypeParameter
- type TypeParameter
- func (t *TypeParameter) Copy() *TypeParameter
- func (t *TypeParameter) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeParameter
- func (t *TypeParameter) InferredType() Type
- func (t *TypeParameter) InspectSignature() string
- func (t *TypeParameter) InspectSignatureWithColor() string
- func (*TypeParameter) IsLiteral() bool
- func (t *TypeParameter) ToNonLiteral(env *GlobalEnvironment) Type
- type UInt8Literal
- type UInt16Literal
- type UInt32Literal
- type UInt64Literal
- type UIntLiteral
- type Union
- type Untyped
- type UsingBufferNamespace
- type Variance
- type Void
Constants ¶
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 METHOD_GENERATOR_FLAG METHOD_ASYNC_FLAG METHOD_OVERLOAD_FLAG METHOD_MACRO_FLAG // used in using expression placeholders METHOD_PLACEHOLDER_FLAG METHOD_CHECKED_FLAG METHOD_REPLACED_FLAG )
Variables ¶
This section is empty.
Functions ¶
func AllConstants ¶
Iterate over every constant that is not a subtype
func AllInstanceVariables ¶
Iterate over every instance variable defined in the given namespace including the inherited ones
func AllMethods ¶
Iterate over every method defined in the given namespace including the inherited ones
func AllSubtypes ¶
Iterate over every subtype
func CreateTypeArgumentOrderFromTypeParams ¶
func CreateTypeArgumentOrderFromTypeParams(typeParams []*TypeParameter) []value.Symbol
func DirectParents ¶
Iterate over direct parents of the given namespace (including itself).
func DirectlyImplementedInterfaces ¶
iterate over every interface that is directly implemented in the given namespace
func DirectlyIncludedAndImplemented ¶
iterate over every mixin that is directly included and every interface that is directly implemented in the given namespace
func DirectlyIncludedMixins ¶
iterate over every mixin that is directly included in the given namespace
func GetConstantName ¶
func GetConstantPath ¶
func ImplementInterface ¶
func ImplementInterface(target, interfaceNamespace Namespace)
func ImplementedInterfaces ¶
iterate over every interface that is implemented in the given namespace
func IncludeMixin ¶
func IncludeMixin(target, includedNamespace Namespace)
func IncludeMixinForMacro ¶
Includes a mixin temporarily in the macro expansion stage
func IncludedMixins ¶
iterate over every mixin that is included in the given namespace
func InspectInheritance ¶
func InspectInstanceVariable ¶
func InspectModifier ¶
func InspectWithColor ¶
func IsCallable ¶
func IsConstantPlaceholder ¶
func IsFalse ¶
func IsFalse(t Type, env *GlobalEnvironment) bool
func IsFalseLiteral ¶
func IsInterface ¶
func IsMixinWithWhere ¶
func IsNil ¶
func IsNil(t Type, env *GlobalEnvironment) bool
func IsNilLiteral ¶
func IsPointerNil ¶
func IsTrue ¶
func IsTrue(t Type, env *GlobalEnvironment) bool
func IsTrueLiteral ¶
func MakeFullConstantName ¶
func NamespacesAreEqual ¶
func OwnInstanceVariables ¶
Iterate over every instance variable defined directly under the given namespace
func OwnMethods ¶
Iterate over every method defined directly under the given namespace
func RequiredTypeParameters ¶
func RequiredTypeParameters(typeParams []*TypeParameter) int
func SortedConstants ¶
Iterate over every constant that is not a subtype, sorted by name
func SortedInstanceVariables ¶
Iterate over every instance variable defined in the given namespace including the inherited ones
func SortedMethods ¶
Iterate over every method defined in the given namespace including the inherited ones, sorted by name
func SortedOwnInstanceVariables ¶
Iterate over every instance variable defined directly under the given namespace, sorted by name
func SortedOwnMethods ¶
Iterate over every method defined directly under the given namespace, sorted by name
func SortedSubtypes ¶
Iterate over every subtype, sorted by name
func Traverse ¶
func Traverse(typ Type, enter func(typ, parent Type) TraverseOption, leave func(typ, parent Type) TraverseOption)
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) 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) ToNonLiteral ¶
func (Bool) ToNonLiteral(env *GlobalEnvironment) Type
type Callable ¶
func NewCallable ¶
func NewCallableWithMethod ¶
func (*Callable) AppendDocComment ¶
func (*Callable) Constants ¶
func (c *Callable) Constants() ConstantMap
func (*Callable) DeepCopyEnv ¶
func (c *Callable) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Callable
func (*Callable) DefineClass ¶
func (*Callable) DefineConstantWithFullName ¶
func (*Callable) DefineInstanceVariable ¶
func (*Callable) DefineInterface ¶
func (*Callable) DefineMethod ¶
func (*Callable) DefineMixin ¶
func (*Callable) DefineModule ¶
func (*Callable) DefineSubtypeWithFullName ¶
func (*Callable) DocComment ¶
func (*Callable) InstanceVariableString ¶
func (*Callable) InstanceVariables ¶
func (*Callable) IsAbstract ¶
func (*Callable) IsPrimitive ¶
func (*Callable) MethodString ¶
func (*Callable) MustSubtypeString ¶
func (*Callable) SetDefined ¶
func (*Callable) SetDocComment ¶
func (*Callable) SetSingleton ¶
func (c *Callable) SetSingleton(*SingletonClass)
func (*Callable) SetTypeParameters ¶
func (c *Callable) SetTypeParameters(t []*TypeParameter)
func (*Callable) Singleton ¶
func (c *Callable) Singleton() *SingletonClass
func (*Callable) Subtypes ¶
func (c *Callable) Subtypes() ConstantMap
func (*Callable) ToNonLiteral ¶
func (c *Callable) ToNonLiteral(env *GlobalEnvironment) Type
func (*Callable) TypeParameters ¶
func (c *Callable) TypeParameters() []*TypeParameter
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
StdValue() *Class
StdInt() *Class
StdFloat() *Class
StdBigFloat() *Class
StdClass() *Class
Std(name value.Symbol) Type
StdString() *Class
StdBool() *Class
StdNil() *Class
StdTrue() *Class
StdFalse() *Class
GetIteratorElementType(Type) (Type, Type)
GetIteratorType(Type) Type
SelfType() Type
}
type Class ¶
type Class struct {
Checked bool
NamespaceBase
// contains filtered or unexported fields
}
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) AttachedObjectName ¶
func (*Class) DeepCopyEnv ¶
func (c *Class) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Class
func (*Class) DefineMethod ¶
func (*Class) IsAbstract ¶
func (*Class) IsCompiled ¶
func (*Class) IsPrimitive ¶
func (*Class) IvarIndices ¶
func (c *Class) IvarIndices() *value.IvarIndices
func (*Class) RemoveTemporaryParents ¶
func (c *Class) RemoveTemporaryParents(env *GlobalEnvironment)
func (*Class) SetAbstract ¶
func (*Class) SetCompiled ¶
func (*Class) SetDefined ¶
func (*Class) SetIvarIndices ¶
func (c *Class) SetIvarIndices(in *value.IvarIndices)
func (*Class) SetPrimitive ¶
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 (*Class) ToNonLiteral ¶
func (c *Class) ToNonLiteral(env *GlobalEnvironment) Type
func (*Class) TypeParameters ¶
func (c *Class) TypeParameters() []*TypeParameter
type ConstantMap ¶
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 (p *ConstantPlaceholder) Copy() *ConstantPlaceholder
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) 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 NewGenericWithVariance ¶
func (*Generic) DeepCopyEnv ¶
func (g *Generic) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Generic
func (*Generic) FixVariance ¶
func (g *Generic) FixVariance()
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 (g *GenericNamedType) Copy() *GenericNamedType
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) ASTSubtype ¶
func (g *GlobalEnvironment) ASTSubtype(name value.Symbol) Type
func (*GlobalEnvironment) DeepCopyEnv ¶
func (g *GlobalEnvironment) DeepCopyEnv() *GlobalEnvironment
func (*GlobalEnvironment) ExpressionNode ¶
func (g *GlobalEnvironment) ExpressionNode() *Mixin
func (*GlobalEnvironment) PatternNode ¶
func (g *GlobalEnvironment) PatternNode() *Mixin
func (*GlobalEnvironment) Std ¶
func (g *GlobalEnvironment) Std() *Module
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
func (*GlobalEnvironment) TypeNode ¶
func (g *GlobalEnvironment) TypeNode() *Mixin
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 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 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 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) DeepCopyEnv ¶
func (i *Interface) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Interface
func (*Interface) DefineMethod ¶
func (*Interface) IsAbstract ¶
func (*Interface) IsPrimitive ¶
func (*Interface) SetDefined ¶
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
OverloadId int
Flags bitfield.BitField16
Params []*Parameter
TypeParameters []*TypeParameter
Overloads []*Method
Base *Method
ReturnType Type
ThrowType Type
DefinedUnder Namespace
Body value.Method
// 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 DefMacro ¶
func DefMacro(namespace Namespace, docComment string, name string, params []*Parameter, returnType Type, fn vm.NativeFunction) *Method
Define a native macro
func NewMethodPlaceholder ¶
func (*Method) AreInstanceVariablesChecked ¶
func (*Method) DeepCopyEnv ¶
func (m *Method) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Method
func (*Method) ExpectedParamCountString ¶
func (*Method) HasNamedRestParam ¶
func (*Method) HasPositionalRestParam ¶
func (*Method) InspectSignature ¶
func (*Method) InspectSignatureWithColor ¶
func (*Method) IsAbstract ¶
func (*Method) IsAttribute ¶
func (*Method) IsCompilable ¶
func (*Method) IsCompiled ¶
func (*Method) IsDefinable ¶
func (*Method) IsGenerator ¶
func (*Method) IsOverload ¶
func (*Method) IsPlaceholder ¶
func (*Method) IsRegisteredOverload ¶
func (*Method) IsReplaced ¶
func (*Method) NamedRestParam ¶
func (*Method) PositionalRestParam ¶
func (*Method) PositionalRestParamIndex ¶
func (*Method) RegisterOverload ¶
func (*Method) RequiredParamCount ¶
func (*Method) SetAbstract ¶
func (*Method) SetAttribute ¶
func (*Method) SetChecked ¶
func (*Method) SetCompiled ¶
func (*Method) SetGenerator ¶
func (*Method) SetInstanceVariablesChecked ¶
func (*Method) SetLocation ¶
func (*Method) SetNamedRestParam ¶
func (*Method) SetOverload ¶
func (*Method) SetPlaceholder ¶
func (*Method) SetReplaced ¶
func (*Method) ToNonLiteral ¶
func (m *Method) ToNonLiteral(env *GlobalEnvironment) Type
func (*Method) WithoutOverloads ¶
type MethodMap ¶
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) DeepCopyEnv ¶
func (m *Mixin) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Mixin
func (*Mixin) DefineMethod ¶
func (*Mixin) IsAbstract ¶
func (*Mixin) IsPrimitive ¶
func (*Mixin) RemoveTemporaryParents ¶
func (m *Mixin) RemoveTemporaryParents(env *GlobalEnvironment)
func (*Mixin) SetAbstract ¶
func (*Mixin) SetDefined ¶
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) DeepCopyEnv ¶
func (m *Module) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Module
func (*Module) DefineMethod ¶
func (*Module) IsAbstract ¶
func (*Module) IsPrimitive ¶
func (*Module) IvarIndices ¶
func (m *Module) IvarIndices() *value.IvarIndices
func (*Module) RemoveTemporaryParents ¶
func (m *Module) RemoveTemporaryParents()
func (*Module) SetDefined ¶
func (*Module) SetIvarIndices ¶
func (m *Module) SetIvarIndices(in *value.IvarIndices)
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 (m *ModulePlaceholder) Copy() *ModulePlaceholder
func (*ModulePlaceholder) DeepCopyEnv ¶
func (m *ModulePlaceholder) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *ModulePlaceholder
type NamedType ¶
func NewNamedType ¶
func (*NamedType) DeepCopyEnv ¶
func (n *NamedType) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *NamedType
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)
IsNative() 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 value.Symbol) Type
MustSubtypeString(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, flags bitfield.BitFlag16, 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)
DefineClass(docComment string, primitive, abstract, sealed, noinit 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 ¶
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, noinit 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) HasInstanceVariables ¶
func (c *NamespaceBase) HasInstanceVariables() bool
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) 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 value.Symbol) Type
func (*NamespaceBase) MustSubtypeString ¶
func (c *NamespaceBase) MustSubtypeString(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) 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, noinit 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 (n *NamespacePlaceholder) Copy() *NamespacePlaceholder
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 NamespaceWithIvarIndices ¶
type NamespaceWithIvarIndices interface {
Namespace
IvarIndices() *value.IvarIndices
SetIvarIndices(*value.IvarIndices)
IsNative() bool
}
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) ToNonLiteral ¶
func (n Never) ToNonLiteral(env *GlobalEnvironment) Type
type Nil ¶
type Nil struct{}
func (Nil) ToNonLiteral ¶
func (v Nil) ToNonLiteral(env *GlobalEnvironment) Type
type Nilable ¶
type Nilable struct {
Type Type
}
func NewNilable ¶
func (*Nilable) DeepCopyEnv ¶
func (n *Nilable) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Nilable
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) ToNonLiteral ¶
func (n NoValue) ToNonLiteral(env *GlobalEnvironment) Type
type Not ¶
type Not struct {
Type Type
}
func (*Not) DeepCopyEnv ¶
func (n *Not) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Not
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 (*Parameter) DeepCopyEnv ¶
func (p *Parameter) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Parameter
func (*Parameter) HasDefaultValue ¶
func (*Parameter) IsNamedRest ¶
func (*Parameter) IsOptional ¶
func (*Parameter) IsPositionalRest ¶
func (*Parameter) NameWithKind ¶
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) ToNonLiteral ¶
func (s Self) ToNonLiteral(env *GlobalEnvironment) Type
type SimpleLiteral ¶
type SingletonClass ¶
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, flags bitfield.BitFlag16, name value.Symbol, typeParams []*TypeParameter, params []*Parameter, returnType, throwType Type) *Method
func (*SingletonClass) RemoveTemporaryParents ¶
func (c *SingletonClass) RemoveTemporaryParents(env *GlobalEnvironment)
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 TemporaryParent ¶
type TemporaryParent struct {
Namespace
}
A temporary wrapper around a namespace parent used in the macro expansion phase before all namespaces are known.
func NewTemporaryParent ¶
func NewTemporaryParent(namespace Namespace) *TemporaryParent
func (*TemporaryParent) DeepCopyEnv ¶
func (t *TemporaryParent) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TemporaryParent
type TraverseOption ¶
type TraverseOption uint8
Value used to decide what whether to skip the subtypes of a type, break the traversal or continue in the type Traverse method. The zero value continues the traversal.
const ( TraverseContinue TraverseOption = iota TraverseSkip TraverseBreak )
type True ¶
type True struct{}
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 ¶
type TypeArgument ¶
func NewTypeArgument ¶
func NewTypeArgument(typ Type, variance Variance) *TypeArgument
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) 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 ¶
func TypesDeepCopyEnv ¶
func TypesDeepCopyEnv(types TypeMap, oldEnv, newEnv *GlobalEnvironment) TypeMap
type TypeParamNamespace ¶
type TypeParamNamespace struct {
ForMethod bool
// contains filtered or unexported fields
}
func NewTypeParamNamespace ¶
func NewTypeParamNamespace(docComment string, forMethod bool) *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 (t *TypeParamNamespace) Copy() *TypeParamNamespace
func (*TypeParamNamespace) DeepCopyEnv ¶
func (t *TypeParamNamespace) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *TypeParamNamespace
func (*TypeParamNamespace) DefineClass ¶
func (t *TypeParamNamespace) DefineClass(docComment string, primitive, abstract, sealed, noinit 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, flags bitfield.BitFlag16, 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) IsNative ¶
func (t *TypeParamNamespace) IsNative() bool
func (*TypeParamNamespace) IsPrimitive ¶
func (t *TypeParamNamespace) IsPrimitive() bool
func (*TypeParamNamespace) IsSealed ¶
func (t *TypeParamNamespace) IsSealed() bool
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 value.Symbol) Type
func (*TypeParamNamespace) MustSubtypeString ¶
func (t *TypeParamNamespace) MustSubtypeString(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) 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
Default Type
Variance Variance
}
func NewTypeParameter ¶
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) InferredType ¶
func (t *TypeParameter) InferredType() Type
Returns the default inferred type for the type parameter
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 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 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 UIntLiteral ¶
type UIntLiteral struct {
Value string
// contains filtered or unexported fields
}
func NewUIntLiteral ¶
func NewUIntLiteral(value string) *UIntLiteral
func (*UIntLiteral) CopyNumeric ¶
func (i *UIntLiteral) CopyNumeric() NumericLiteral
func (*UIntLiteral) IsLiteral ¶
func (*UIntLiteral) IsLiteral() bool
func (*UIntLiteral) IsNegative ¶
func (i *UIntLiteral) IsNegative() bool
func (*UIntLiteral) SetNegative ¶
func (i *UIntLiteral) SetNegative(val bool)
func (*UIntLiteral) StringValue ¶
func (i *UIntLiteral) StringValue() string
func (*UIntLiteral) ToNonLiteral ¶
func (i *UIntLiteral) 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 (*Union) DeepCopyEnv ¶
func (u *Union) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *Union
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) ToNonLiteral ¶
func (n Untyped) ToNonLiteral(env *GlobalEnvironment) Type
type UsingBufferNamespace ¶
type UsingBufferNamespace struct {
Module
}
func NewUsingBufferNamespace ¶
func NewUsingBufferNamespace() *UsingBufferNamespace
func (*UsingBufferNamespace) Copy ¶
func (u *UsingBufferNamespace) Copy() *UsingBufferNamespace
func (*UsingBufferNamespace) DeepCopyEnv ¶
func (u *UsingBufferNamespace) DeepCopyEnv(oldEnv, newEnv *GlobalEnvironment) *UsingBufferNamespace
Source Files
¶
- any.go
- bool.go
- callable.go
- char_literal.go
- checker.go
- class.go
- constant_placeholder.go
- false.go
- float_literal.go
- generic.go
- generic_named_type.go
- global_environment.go
- headers.go
- instance_of.go
- int_literal.go
- interface.go
- interface_proxy.go
- intersection.go
- method.go
- mixin.go
- mixin_proxy.go
- mixin_with_where.go
- module.go
- named_type.go
- namespace.go
- namespace_base.go
- namespace_placeholder.go
- never.go
- nil.go
- nilable.go
- no_value.go
- not.go
- numeric_literal.go
- self.go
- simple_literal.go
- singleton_class.go
- singleton_of.go
- string_literal.go
- symbol_literal.go
- temporary_parent.go
- true.go
- type.go
- type_param_namespace.go
- type_parameter.go
- types.go
- union.go
- untyped.go
- using_buffer_namespace.go
- void.go