Skip to main content

Module type_system

Module type_system 

Source

Structs§

BindingFrame
The type parameters in scope while one body is compiled.
FnTypeExpr
The parameter types and return type a fn(...) annotation was written with.
GenericType
A generic type and the arguments it is applied to. Boxed inside TypeExpr, which every declaration carries by value.
Generics
The generic declarations of a program, the instantiations made from them, and the type parameters bound while a body is being compiled.
GenericsCheckpoint
A checkpoint of the Generics state taken by Generics::checkpoint and undone by Generics::rollback_to.
ImplTemplate
An impl block written against a generic type, kept until the type is instantiated.
StructDefaults
The = value a struct’s fields were declared with, and the file the declaration was written in, which is the scope the values compile in.
TypeCtx
What resolving a TypeExpr needs: the scope the type is written in, and the registries an instantiation adds to.

Enums§

DataType
A resolved candela type. Attached to compiled artifacts (struct field types, dynamic-library / host function signatures) so the VM can marshal values.
TypeExpr

Constants§

ANON_FN_PREFIX
Name prefix for the synthetic top-level function an anonymous function is hoisted to. < is not a legal identifier character, so a hoisted name can never collide with a user-written function.
STRUCT_DEFAULT_METHOD
The name a struct’s own default is declared under in its impl block.

Functions§

arg_types_specialize_equal
Equality for monomorphization and return-type cache keys.
bare_fn_value_type
The type of expr where it is a bare name that means a declared function and the position holds the function rather than calls it.
can_reach
Check if the function src_fn can call target_fn
check_if_returns_void
check_operator_method
Checks a method named by an operator symbol where it is declared.
check_struct_default_fn
Checks the default function an impl block on struct struct_id declares.
collect_direct_fn_calls
Collects the functions the given code calls by name.
declared_fn_value_type
The type a declared function has where a value holds it.
find_template
The generic declaration namespace::name names, as an index into Generics::templates.
fn_bindings
The type parameters bound while a function’s body is compiled: what its enclosing impl block fixed, plus what the call site named.
format_detailed
Renders a DataType the way a program spells it.
indirect_return_type
What a call through a function value hands back.
infer_user_fn_return_type
instantiate
Resolves base<args> to an ordinary struct or enum, registering it the first time it is asked for.
let_type_fits
Whether a value of type value may be written into a variable whose let declares declared.
literal_struct_id
Resolves the struct a literal names.
merge_fn_types
The one function type that holds every type in types, where more than one function can land in the same position.
param_type_matches
Whether an argument of type received satisfies a parameter declared as expected.
path_call_target
The impl function a call written by its path names.
propagation_sides
What a ? reads out of an enum shaped like Option or Result.
push_capture_scope
Infers the return type of a user function specialised for infered_arg_types, caching the result on the function.
qualify_duplicate_type_names
Puts the declaring module in front of every plain struct or enum name that more than one module declares, so a package’s types never collide with a consumer’s types of the same name.
reset_inference_state
Clears inference bookkeeping left behind when a previous compilation on this thread was aborted by an error unwind (see errors::collect_diagnostic).
resolve_call_type_args
Checks the type arguments a call is written with against the parameters the function it resolves to declares, and resolves them to types.
resolve_generic_call
Resolves a call written with type arguments to the function it names and the arguments bound to its type parameters.
resolve_generic_variant
Resolves a variant of a generic enum named with its arguments (Slot<int>::Empty) to the instantiated enum and the variant’s index.
resolve_type_args
Resolves each type argument of a call, struct literal or variant path in the scope it was written in.
resolve_variant_constructor
return_type_fits
Whether a body returning body satisfies a function declared to return declared.
specialization_key
The key one specialisation of a function is found by: the type arguments the call named, then the argument types it passed.
std_primitive_return_type
The type a native primitive of the standard library yields, or None when none takes that name.
struct_default_target
The struct S::default() names.
struct_field_type_matches
Whether a value of type received fits a field declared expected.
struct_literal_id
Resolves the struct a literal names, instantiating the generic type when the literal carries type arguments.
struct_of_default_fn
The struct whose impl block declares the function named fn_name as its default, when it names one.
track_returns
The types a function body hands back.
type_args_name_a_variant
Whether a call path written with type arguments names an enum variant rather than a generic function.
variant_constructor_at
Resolves a variant constructor to the enum it names and the index of the variant, instantiating a generic enum at the types its payload names.

Type Aliases§

ReturnAnnotation
A declared -> Type return annotation with the span it was written at.
TypeParams
The type parameters a declaration introduces (struct Cell<T>), in the order they were written. Empty for a declaration that takes none.