gleamunison/types
Types
pub type ComputedType {
CTTerm(typ: ast.Type)
CTType
CTAbility(operations: List(OperationType))
}
Constructors
-
CTTerm(typ: ast.Type) -
CTType -
CTAbility(operations: List(OperationType))
pub type InferenceError {
UnboundVariable(Int)
TypeMismatch(
expected: ast.Type,
actual: ast.Type,
message: String,
term: option.Option(ast.Term),
)
InfiniteType(variable: Int, typ: ast.Type)
UnhandledAbility(ast.AbilityRef)
ImpureContext(ast.Requirement)
LinearityViolation(term: String, expected: String)
}
Constructors
-
UnboundVariable(Int) -
TypeMismatch( expected: ast.Type, actual: ast.Type, message: String, term: option.Option(ast.Term), )Arguments
- term
-
The elaborated subterm that failed, when the failing site had one in scope. When that term is a
ast.Located, its span is the source location of the error — elab_def lifts it into anAtwrapper.
-
InfiniteType(variable: Int, typ: ast.Type) -
UnhandledAbility(ast.AbilityRef) -
ImpureContext(ast.Requirement) -
LinearityViolation(term: String, expected: String)
pub type OperationType {
OperationType(
name: option.Option(String),
inputs: List(ast.Type),
output: ast.Type,
)
}
Constructors
-
OperationType( name: option.Option(String), inputs: List(ast.Type), output: ast.Type, )
pub type TypeCache {
TypeCache(
entries: dict.Dict(identity.DefinitionRef, ComputedType),
)
}
Constructors
-
TypeCache( entries: dict.Dict(identity.DefinitionRef, ComputedType), )
Values
pub fn describe_inference_error(error: InferenceError) -> String
Render an inference error for the user. Types go through the pretty-printer (the repo’s one type renderer); ability references go through ref_hex; the remaining variants keep their payloads in words. No embedded subterm is rendered — spans are attached by the caller.
pub fn empty_cache() -> TypeCache