v.types #
Type checking
Compiler stages can retain a checked expression's semantic identity with TypeChecker.checked_expr_type_id(node). The returned TypeId belongs to that checker's interner; a different worker can assign the same number to a different type. Use type_by_id(id) for the canonical semantic value and type_name_by_id(id) for its interned source spelling. c_type_by_id(id) reads the C layout cache by identity without hashing the semantic type again. Rewriting or retyping a node invalidates its cached identity. parse_type_id(source_id) resolves an interned source spelling; its scalar cache keeps both the semantic ID and compatibility value across source contexts. Source annotations and dynamically resolved call types remain separate.
TypeChecker.expr_type_reference(node) follows expr_type's call resolution and cache visibility. Dense cache entries retain their canonical references. Sparse cache and function return entries receive stable descriptor copies whose nested metadata stays shared. Keep either reference only while its owning checker arena remains live; use clone_owned_type across arena boundaries.
TypeChecker.resolve_type_reference(node) returns resolve_type's result as a canonical reference. It observes the same checked-cache visibility and mixed-integer widening rules. The reference remains valid while its owning checker arena is live; use clone_owned_type when retaining the result beyond that arena.
Transform stages register generated return signatures with TypeChecker.register_generated_fn_return_type(name, ret) and remove them with TypeChecker.unregister_generated_fn_return_type(name). Both increment the return-signature revision so transform return-name memos reject stale entries, even when the map size is unchanged.
Inside a closure that captures a @[heap] struct receiver with [mut receiver], assigning the captured receiver to a new variable retains its reference, including when the receiver is enclosed in parentheses or is the final value of an unsafe block. Mutations through that variable reach the same heap object. Attributes are resolved on the receiver's own declaration, including through aliases and generic instantiations; importing a heap struct with the same short name does not change a non-heap receiver's value-copy behavior.
TypeChecker.semantic_type_id(value) interns a semantic descriptor in the same table. Markused retains declared sum receivers by this identity and keys checked receiver-method lookups by numeric type and method indexes. Unresolved source spellings use their own indexes, so a semantic ID must not be substituted for a source-spelling ID. Markused passes source IDs through local type queries and binding accessors. Its receiver cache keeps source and semantic IDs in separate maps; method names remain strings. The C backend retains source IDs through struct-field lookup and source qualification. C type encodings and generated identifiers remain strings. SSA type queries and source bindings also carry spelling IDs. SSA TypeID belongs to its TypeStore and identifies a lowered layout; it is separate from both spelling IDs and checker semantic TypeId. Resolve spelling bytes when lowering to that layout or looking up declarations.
Nominal Struct, Interface, Enum, SumType, and Alias descriptors store their source identity in name_id, a u32 assigned by flat.source_type_id. Use name() to resolve a spelling at an integration boundary. Equality, hashing, and owned copies retain the numeric identity. This spelling identity is shared across workers; semantic TypeId values still belong to a particular checker's interner.
Type keeps a 16-byte descriptor on 64-bit targets. Small variants stay inline; Unknown, ArrayFixed, Channel, Map, FnType, Alias, and MultiReturn embed references to immutable payloads. Promoted fields and their constructor syntax remain available. Descriptor copies share these payloads; value equality and semantic hashing inspect their fields. Do not mutate a shared payload. Use clone_owned_type when it must outlive the arena that owns any part of its graph.
ScopeBindingOwner.bound_type() reads the current type of an already resolved binding by value. The owner remains valid while its scope is live and has not been reset. Updating a binding keeps its identity in normal mode; ownership mode replaces its generation and invalidates the old owner. A missing or invalid owner returns none. The returned descriptor shares nested type metadata.
new_type_reference(value) retains a shallow descriptor copy in stable reference storage. Its nested metadata stays borrowed. Use clone_owned_type(value) first when that metadata belongs to an arena that will end. Checker parsing and interning retain canonical recursive descriptor edges; use those APIs when a reference should share the checker's type identity.
Pass-2 worker publication checks the descriptor's referenced storage before releasing its arena. Indirect payloads, lists, strings and recursive descriptors are copied when they depend on it; graphs already outside it retain their references.
A mut value ?T parameter keeps the &?&T calling convention while its body reads ?T, including struct payloads and aliases of structs. Mutable payload guards and smartcasts still refer to the caller's payload. An explicit pointer payload keeps its declared pointer view.
parse_type, parse_type_ref, parse_canonical_type, parse_canonical_type_cached, parse_resolution_type, and parse_resolution_type_in_file accept these source spelling IDs. Intern new source text with flat.source_type_id(text) at a parsing boundary. An AST annotation already carries that ID in node.typ. Parsing still observes imports, generic bindings, and the declaration context; identical spelling IDs can resolve to different semantic types. Imported generic signatures retain caller-owned types inside callback signatures, channel payloads, and nested generic arguments. A same-named type declared by the imported module does not replace those caller types. Type.source_type_id(), TypeChecker.type_name(value), and type_name_by_id(id) return spelling IDs. Resolve bytes with flat.source_type_name(id) for diagnostics, spelling syntax, or emission. Builtin spelling constants in v.flat avoid repeated interning of scalar names. Field and interface queries accept source spelling IDs as well, including struct_fields_for_type, struct_field_type, interface_field_list, interface_metadata_name, and method-signature lookup by concrete or interface type. The field cache uses those IDs for owners and keeps field names as declaration strings. Its frozen declaration tables remain shared; private worker entries and misses merge by owner and field without retaining a worker's mutable table. generic_type_name_matches accepts source IDs and retains recursive spelling grammar internally. sum_variant_type_for_pattern accepts source IDs for the sum and pattern and returns an optional source ID. Its cache retains the writing file and module when matching a spelling. fn_signature_type(name, source_id) resolves an interned annotation in its declaration context. Source qualification (qualify_type_text, qualify_resolution_type_text, and qualify_type_name) and imported-type resolution pass spelling IDs. qualify_type_name shares the file, module, resolution-mode, and declaration-growth cache used by qualify_name; declaration-name callers can retain the string interface. Private recursive spelling parsers work with bytes inside these boundaries. C ABI encodings and emitted declaration names remain strings.
Alias targets, generic binding values, and original return annotations use flat.TypeTextBindings. Parameter annotations, sum variants, implemented interfaces, and interface embeddings use flat.TypeTextListBindings. Binding keys retain declaration names; values carry source IDs. InterfaceImplIndex retains its ordered implementation names in a TypeTextList; names_text() resolves them for diagnostics and emission while preserving interface tag order. interface_impl_names, pre_transform_interface_impl_names, and ierror_impl_names return caller-owned spelling ID arrays. Interface query cache owners, frozen snapshots, and ordered satisfaction-proof pairs use source IDs. InterfaceImplIndex.ids, interface_type_ids, and the stable dispatch allocators map source spelling IDs to runtime integer tags. Those tags retain the same spelling hash, collision probing, and lexical ordering; they are not source spelling IDs. Recursive struct declaration queries also accept spelling IDs while field paths and diagnostic messages retain their rendered text. Canonical name caches, recursive-alias stacks, and deferred return annotations also retain IDs. TypeTextBindings.value_id(name) and NodeTypeTextBindings.value_id(node) read a stored ID directly, returning zero for an absent or empty spelling. Use type_id or contains when the distinction between an absent binding and a present empty binding matters.
Generic constraints, frozen interface implementation lists, and cached C type representations also retain numeric spelling identities. AST and worker publication copy these indexes and their list storage directly; only ordinary declaration payloads require string promotion.
Transformer builders, expected-type coercion, and deferred AST type writes also carry spelling IDs. Callback, tuple-branch, iterator, and local type queries return source IDs, including optional and list results. Comptime sum variants retain those IDs when constructing reflection metadata. Option/result queries also return numeric wrapper and payload pairs through coercion and lowering. Signature preparation and deferred return registration retain source IDs across workers; parameter and variant lists use numeric binding accessors and copy IDs into owned storage. Generic substitution and explicit call arguments also use numeric lists. C generation retains inferred generic arguments in maps of source IDs; private recursive spelling parsers resolve bytes when matching nested types, and emitted specialization names remain strings. Receiver pattern caches encode ordered source IDs with their file, module, and generic context; receiver promotion and factory substitution retain those IDs through recursive lookups. Sum-constraint traversal also stores source IDs in its visited and active recursion state. Constrained generic-body checks retain IDs through type choices, branch groups, combinations, and worker bindings. Allocation analysis also keeps parameter and local annotations as IDs. The driver's implicit-import type scan and WebAssembly fallback annotations use the same source IDs; their declaration indexes and dependency-recording keys retain names. Numeric APIs retain identities across stages. Text APIs resolve spellings when parsing source, reporting diagnostics, or integrating with an emitter that consumes names. Sum candidates and variants, map component tuples, and alias-equivalence caches retain source IDs. Cached lists return independent numeric copies. Module and file changes invalidate contextual caches.
The builtin error constructors require a string message. To propagate an error from an or block, use return err. To add context, use return error('context: ${err}'). Passing the error value directly as error(err) is rejected before C generation and includes a hint to use err; error_with_code(err, code) is also rejected.
Enum values must be declared by their enum, including qualified values such as Color.blue and shorthand values such as .blue in match branches. Unknown values are rejected before C generation.
Compiler integrations can use Scope.contains(name) to check whether a binding is visible in a scope or its parents without copying the binding's type. It includes unresolved type bindings and follows the same shadowing and scope-reuse rules as Scope.lookup(name).
An inline anonymous struct parameter accepts a matching anonymous literal from another module. Anonymous types declared as fields or aliases keep their declared field visibility.
Empty C typedef declarations can represent scalar types defined by a C header, such as wchar_t. Explicit casts from those values to numbers or runes are validated by the C compiler. Declared C structs with fields still cannot be cast to numbers or runes.
Interface method calls use the interface's method declarations, including inherited declarations, for access checks, even when a concrete receiver in another module has the same name. Private concrete methods remain private.
An explicit unsafe { nil } interface field initializer creates an empty interface, including inside parentheses or a collapsed struct literal. Bare nil still requires an unsafe block.
Calls inferred inside a comptime sum-type branch use that branch's concrete variant type. Explicit generic arguments retain the types written at the call site.
Concrete generic instances report incompatible returned names and fields during checking and building, including generic closures and methods. For example, fn flag[T](value T) bool cannot return an int instance's value. Returns narrowed by type tests retain their normal smartcast behavior. Returned locals initialized by calls, match expressions, or fn literals retain their normal checking and lowering behavior.
Concrete generic instances also report incompatible plain call arguments during checking and building. For example, passing a concrete bool field to a string parameter reports the argument mismatch at the call. Spread arguments, embedded struct conversions, and values narrowed by type tests or comptime field iteration retain their existing lowering and checking behavior. Loop bindings also retain the inferred types of their iterables, including local containers initialized from expressions whose types are resolved during lowering.
Compiler integrations can prepare a LibraryBodyFrontier after the initial semantic check and pass reached declaration IDs to TypeChecker.check_library_body_frontier_nodes. The snapshot preserves declaration order, source context, and checking ranges. A changed AST or an unindexed declaration returns none, so integrations can fall back to check_reached_library_bodies with the complete used-function map. TypeChecker.reached_library_body_nodes(used) returns the remaining declarations accepted by the convergence check, including ambiguous short names. After markused completes that check, library_body_convergence_complete certifies its returned reachability set. The driver can omit a duplicate scan until another path adds roots, such as profiling. Reachability can complete their semantic checks without revisiting already-checked bodies when the declaration arena is unchanged.
Verbose builds include bodies checked by reachability frontiers in the checked late count. The initial pass also checks the library methods that a generic body names in a member access, and what their bodies name. A call on a value of a type parameter has no receiver type for reachability to resolve before the generic instances exist.
An or block in a struct field initializer must provide the unwrapped payload type. For a ?bool field, use input.value or { false }; an optional fallback value is rejected. Direct option values can still initialize optional fields without an or block.
Variadic function types keep their variadic tail when used as parameters or fields. For fn (int, ...string) bool, a call must supply the fixed int argument and may supply zero or more strings. A fn (int, []string) bool still requires an explicit array argument. Restoring transformed function values and reconstructing callback signatures also keep this tail.
An interface narrowed by if mut value is T can be passed to a function accepting mut T. The function mutates the same concrete object stored in the interface. A mut &T parameter still needs a mutable pointer variable; narrowing an interface does not create a pointer slot that the function can reassign.
Each _test.v file must contain at least one active test_ function. A file whose tests are all excluded by conditional compilation reports a missing-test error. When the file has no active function declarations, this diagnostic points to the start of the file; a helper-only file points to its helper function.
Map literals cannot use postfix !: they are ordinary map values and do not return a Result. This rule also applies to map literals in constant declarations.
Generic specialization requests, signature argument lists, and inferred type bindings carry source IDs. Generic parameter names remain declaration strings. Numeric list queries preserve caller-owned array storage; the specialization miss cache invalidates when local or parent bindings grow or its parent changes. Substitution and generated-name rendering resolve spelling bytes at those boundaries.
Generic struct initializers validate concrete values before coercing numeric fields, including captured values and handled fallible calls. Incompatible values report the field name and types at the initializer. Matching reference values keep the normal implicit dereference into a value field; references to a different value type remain incompatible. Compiler integrations can use TypeChecker.expr_compatible(node, actual, expected) to apply the same source-specific conversion rules, including translated C conversions. An invalid initializer expression keeps its primary diagnostic without a second field-type error. TypeChecker.expr_subtree_has_node_error(node) checks diagnostic node identities, so errors from another generic instantiation at the same source position do not suppress field validation. Concurrent generic-instance checks finish before a build returns lowering errors, preserving the primary instance diagnostics.
When a later struct field or call argument contains an or expression, earlier values are evaluated first. Specialized mutable method receivers keep their original storage, and indexed callbacks are selected before a later fallible argument can replace them. Declared function references remain inline so their expected callback adapter type is preserved.
Reference parameters such as &Value require storage of that same sum type. A reference to one of its variants cannot be reinterpreted as a reference to the sum. Wrap a getter result explicitly, for example read(Value(dict['a'])), to materialize a sum value for the call. Existing sum bindings can be passed directly.
Pointer sum variants preserve the referenced object's identity. A smartcast can mutate the referenced object, but it does not supply a pointer variable for a mutable pointer parameter. This applies to nominal pointer aliases as well as explicit reference types. To replace an owned pointer variant, assign the enclosing sum so its previous payload is released and the replacement retains its own cleanup policy. Explicit unsafe access to the pointer slot remains a low-level operation; the caller must preserve the enclosing sum's ownership metadata. Explicit drop_owned on a named owned sum destroys its complete storage even after a smartcast. Borrowed projections retain the usual copy policy. Lowering can query the checker's validated node decision with TypeChecker.ownership_sum_drop_consumes_storage(node).
Returning a mutable array parameter in a value-array sum variant creates an independent owner. A selected pointer-array variant keeps borrowing the caller's storage. Option and Result wrappers preserve the successful payload's ownership and their existing none or error cleanup.
The following sum lifetime and cleanup checks apply with -ownership and -autofree, using checker_sum_escape_d_ownership.v. Autofree shares the escape analysis with ownership mode, but retains its compatibility copy policy instead of ownership's move policy. These are current analysis restrictions in addition to the ordinary finite-layout and reference-type rules. Default GC builds without either flag do not enable these additional checks.
Returning a wrapper of a local promotes that local and transfers its cleanup to the returned sum. Storing an inner local's pointer in an outer sum similarly transfers cleanup at the store, including through named sum wrappers. An outer store with an ambiguous local pointer source is rejected; store each pointer alternative separately so the checker can identify which allocation supplies its cleanup obligation. This also applies to outer stores whose local source is hidden behind a borrowed-return call. Returning an existing local through a known borrowed-return call retains its allocation, while calls borrowing caller-owned storage remain non-owning. A local declared inside a returned if or match expression cannot supply a sum pointer; declare it before that expression. These lifetime checks also apply inside functions returning void and when a sum constructor wraps the conditional expression. The checker records heap promotion before validating a local pointer return. Return and assignment lowering preserve the original transfer decision through their generated nodes, and only the matching runtime pointer acquires the cleanup obligation. An outer sum assigned inside a loop keeps its cleanup at the outer binding's scope. Replacing its payload releases the previous owner; values declared inside each iteration still clean up there. Iteration-local loans end there too; loans held by outer bindings remain active across the loop. Replacing a pointer sum field or element releases its previous owned payload. A wrapper of the same pointer retains that cleanup obligation, and the destination expression is evaluated once. Loop return ownership is summarized before checking callers, including callers checked in parallel or declared before the factory. Statements within a loop share their lexical declaration context. Wrapping an existing local's address preserves its identity and borrows its storage. Moving an owned sum field transfers its runtime cleanup flag; ownership checking rejects later reads of that field. Aggregate fields and elements cannot retain a pointer to a local from a shorter scope. Returning a sum field or element that borrows local storage is also rejected, including through a named alias or an enclosing aggregate. Keep an escaping allocation in a separately owned outer sum before borrowing it into an aggregate in the same scope. The same lifetime check applies when replacing the enclosing struct or array literal. Borrowed sum fields keep their source loans through named aggregate aliases, including nested storage. Conditional aggregate expressions cannot retain a sum pointer to a local declared inside them. Moving a sum field or element transfers its cleanup while the remaining aggregate still cleans up. A function returning either a fresh or borrowed pointer preserves its conditional cleanup and source loans. Moving that sum transfers both obligations; borrowed-only return values remain copyable. Wrapping a result in the same sum type preserves those loans and move obligations, including conditional results and named aliases. Aggregate fields and elements retain conditional ownership when their initializer may return either fresh storage or a borrowed pointer. Unwrapping a Result or Option with or, !, or ? preserves the successful sum's ownership and source loans. An or fallback also retains its source loans, including named local wrappers. These return lifetime checks reject a pointer to a local declared inside an or fallback. Fallback aliases keep possible source loans across branches and loop iterations. A later unconditional replacement clears the prior loan, and inner declarations keep their own scope. Same-sum wrappers preserve conditional cleanup even when their sources are borrowed parameters. Loop exits preserve the source loans held at break or continue, including labeled exits. Only paths that continue within the body reach a later replacement; replacements after the loop apply to its exited paths too.
Constants #
const interface_dispatch_id_marker = 0xff << 16
interface_dispatch_id_marker is the byte that runtime type indexes reserve for pointer indirections (see stable_type_index). A value type's index leaves it zero.
const incremental_min_left_out = 2048
incremental_min_left_out is the fewest nodes that the bodies a check leaves out hold by default (see start_incremental_check): leaving out less saves less than putting back what they reported and checking them later costs.
const empty_type = &builtin_void_type
const portable_int_c_type = '__v_int'
portable_int_c_type is the C spelling of V's int in portable C (-os cross). The generated C defines it as i64 or i32 from the width of the C compiler's target, so one portable file serves 64-bit and 32-bit hosts. Being a name of its own, it also keeps int apart from both i64 and i32 in the C type names derived from it (Array_fixed___v_int_4, multi_return___v_int_string).
const bool_ = Primitive{
props: .boolean
}
const int_ = Primitive{
props: .integer
}
const i8_ = Primitive{
props: .integer
size: 8
}
const i16_ = Primitive{
props: .integer
size: 16
}
const i32_ = Primitive{
props: .integer
size: 32
}
const i64_ = Primitive{
props: .integer
size: 64
}
const u8_ = Primitive{
props: .integer | .unsigned
size: 8
}
const u16_ = Primitive{
props: .integer | .unsigned
size: 16
}
const u32_ = Primitive{
props: .integer | .unsigned
size: 32
}
const u64_ = Primitive{
props: .integer | .unsigned
size: 64
}
const i128_ = Primitive{
props: .integer
size: 128
}
const u128_ = Primitive{
props: .integer | .unsigned
size: 128
}
const f32_ = Primitive{
props: .float
size: 32
}
const f64_ = Primitive{
props: .float
size: 64
}
const string_ = String{}
const char_ = Char{}
const rune_ = Rune{}
const isize_ = ISize{}
const uint_ = USize{}
const usize_ = USize{}
const void_ = Void{}
const nil_ = Nil{}
const none_ = None{}
const voidptr_ = Pointer{
base_type: &builtin_void_type
}
const charptr_ = Pointer{
base_type: &builtin_char_type
}
const byteptr_ = Pointer{
base_type: &builtin_u8_type
}
fn builtin_type #
fn builtin_type(name string) ?Type
builtin_type returns the Type for a builtin type name, or none otherwise.
fn builtin_type_index #
fn builtin_type_index(name_id u32) int
builtin_type_index returns V's stable runtime index for an interned builtin spelling.
fn builtin_type_value #
fn builtin_type_value(name string) Type
builtin_type_value returns the Type for a known builtin type name.
fn builtin_type_value_id #
fn builtin_type_value_id(name_id u32) Type
builtin_type_value_id returns the Type for an exact interned builtin source spelling. Source spelling IDs are distinct from checker-local semantic TypeId values.
fn cached_name #
fn cached_name(value string) &CachedName
cached_name boxes an immutable name in the current allocation arena.
fn clone_owned_type #
fn clone_owned_type(value &Type) Type
clone_owned_type clones a type and all nested owned metadata.
fn clone_owned_types #
fn clone_owned_types(values []Type) []Type
clone_owned_types clones a list of types and all nested owned metadata.
fn comptime_enum_integer_cast #
fn comptime_enum_integer_cast(value i64, typ_id u32) i64
comptime_enum_integer_cast applies the conversion used at integer parameter/return boundaries. typ_id is a process-wide source-spelling ID.
fn comptime_enum_integer_division #
fn comptime_enum_integer_division(left i64, right i64, typ_id u32, remainder bool) i64
comptime_enum_integer_division uses unsigned arithmetic for unsigned 64-bit operands. typ_id is a process-wide source-spelling ID.
fn comptime_enum_integer_literal #
fn comptime_enum_integer_literal(value string) ?i64
comptime_enum_integer_literal keeps all 64 bits of an integer literal used by enum evaluation.
fn comptime_enum_unsigned_right_shift #
fn comptime_enum_unsigned_right_shift(value i64, shift i64, typ_id u32) i64
comptime_enum_unsigned_right_shift shifts the bit pattern at the operand's storage width. typ_id is a process-wide source-spelling ID.
fn defer_result_index #
fn defer_result_index(node flat.Node) ?int
defer_result_index returns -1 for an unindexed $res() node and the non-negative index for a $res(index) node.
fn extend_stable_type_indexes #
fn extend_stable_type_indexes(mut indexes map[u32]int, type_names []u32)
extend_stable_type_indexes assigns deterministic, collision-free runtime indexes to new source spelling IDs without changing indexes already used during lowering.
fn extend_stable_type_indexes_ref #
fn extend_stable_type_indexes_ref(mut indexes map[u32]int, type_names []u32)
extend_stable_type_indexes_ref updates the detached index table through the native pointer ABI.
fn fn_compatible_param_type #
fn fn_compatible_param_type(f FnType, idx int) Type
fn_compatible_param_type returns the pointer representation of a mutable parameter.
fn fn_param_modes_compatible #
fn fn_param_modes_compatible(actual FnType, expected FnType, idx int) bool
fn_param_modes_compatible checks whether callback parameter passing modes agree.
fn generic_base_name #
fn generic_base_name(name string) string
generic_base_name returns the declaration part of a concrete generic type name.
fn generic_base_type_id #
fn generic_base_type_id(name_id u32) u32
generic_base_type_id returns the declaration spelling of a concrete generic type. Array spellings and names without generic arguments retain their original ID.
fn generic_param_ids #
fn generic_param_ids(names []string) []u32
generic_param_ids interns the generic parameter names a declaration spells (node.generic_params()), in their declared order. The checker stores type parameters as spelling IDs from this AST boundary on.
fn generic_param_texts #
fn generic_param_texts(ids []u32) []string
generic_param_texts decodes type parameter spelling IDs for a consumer that still works on parameter names as text.
fn implicit_integer_to_float_compatible #
fn implicit_integer_to_float_compatible(actual &Type, expected &Type) bool
implicit_integer_to_float_compatible reports whether an actual integer converts to an expected float without a cast: every integer but i64 and u64 does.
fn is_builtin_type_name #
fn is_builtin_type_name(name string) bool
is_builtin_type_name reports whether name is one of V's builtin type names.
fn is_builtin_type_name_id #
fn is_builtin_type_name_id(name_id u32) bool
is_builtin_type_name_id reports whether an interned source spelling names a builtin type. Source spelling IDs are distinct from checker-local semantic TypeId values.
fn is_module_cache_header #
fn is_module_cache_header(path string) bool
is_module_cache_header reports whether path is a declaration header in the V3 module cache, parsed in place of a module's sources on a warm build.
fn mut_param_semantic_type #
fn mut_param_semantic_type(typ Type) Type
mut_param_semantic_type returns the type of a mut parameter declared as typ (&T). A mut a ?T is &?&T, whatever its payload: the option the callee gets refers to the caller's value, so changes made through it reach the caller, as in V 0.5.2. The call site builds that option (transform_mut_optional_value_call_arg for an option argument, transform_mut_plain_value_optional_call_arg for a plain value). Every other type is returned unchanged, including an option payload that is already a pointer.
fn named_variant_pattern_binding #
fn named_variant_pattern_binding(a &flat.FlatAst, cond &flat.Node) ?flat.NodeId
named_variant_pattern_binding returns the payload binding of a match branch pattern such as Expr.Count(n). The parser stores it as a .param child of the pattern node.
fn new_scope #
fn new_scope(parent &Scope) &Scope
new_scope returns a reusable type-checker scope with an optional parent.
fn new_shadow_file_resolver #
fn new_shadow_file_resolver() ShadowFileResolver
new_shadow_file_resolver returns a resolver bound to the current working directory.
fn new_type_reference #
fn new_type_reference(value Type) &Type
new_type_reference allocates a shallow copy of value with stable reference storage. Nested metadata remains borrowed; clone_owned_type copies it when its arena will end.
fn parse_vls_line_info #
fn parse_vls_line_info(spec string) !VlsQuery
parse_vls_line_info parses the value of -line-info. The line is 1-based and the column is the 0-based byte column of the cursor. The code before the column selects the query: hv^ hover, gd^ definition, fn^ signature help, ih^ inlay hints of the whole file, and a bare column completion.
fn parse_vls_line_infos #
fn parse_vls_line_infos(spec string, target string) ![]VlsQuery
parse_vls_line_infos parses a -line-info value that asks one question, or several separated by tabs: a client that verifies many positions, as a rename does, asks them all from one check. target is what the command line checks.
fn platform_int_bits #
fn platform_int_bits() int
platform_int_bits returns the bit width of V's platform int (64 or 32), used for literal-overflow and range checks so they match the emitted width.
fn platform_int_c_spelling #
fn platform_int_c_spelling() string
platform_int_c_spelling returns the C spelling that int lowers to.
fn promote_cached_name #
fn promote_cached_name(name &CachedName, scope voidptr) &CachedName
promote_cached_name moves a cached header and its bytes out of a scope that has been left but not yet freed. Either allocation may belong to that scope.
fn semantic_type_hash #
fn semantic_type_hash(t &Type) u64
semantic_type_hash hashes the semantic fields of a type, including borrowed descriptors.
fn semantic_types_equal #
fn semantic_types_equal(a &Type, b &Type) bool
semantic_types_equal compares semantic type values, including borrowed descriptors.
fn set_platform_int_bits #
fn set_platform_int_bits(bits int)
set_platform_int_bits selects the C spelling for the platform int from the target pointer width. The driver calls this once, before checking or code generation, so every c_type lowering agrees on the width.
fn set_portable_platform_int #
fn set_portable_platform_int()
set_portable_platform_int makes int lower to portable_int_c_type, for portable C whose consumer decides the width. Call it after set_platform_int_bits, which still sets the width that checking uses.
fn shadow_roots_own_file #
fn shadow_roots_own_file(file string, diagnostic_root string, explicit_roots []string, dependency_roots []string) bool
shadow_roots_own_file reports whether file belongs to an explicit project root after nested installed-module roots have been excluded.
fn source_field_decl_is_volatile #
fn source_field_decl_is_volatile(field flat.Node) bool
source_field_decl_is_volatile reports whether a field_decl node was declared volatile (the v flag the parser packs into its payload).
fn stable_interface_type_ids #
fn stable_interface_type_ids(impl_names []u32) map[u32]int
stable_interface_type_ids maps source spelling IDs to deterministic nonzero _typ dispatch IDs for interface implementers in caller-supplied order. Hash collisions are resolved with linear probing after earlier names keep their IDs, so late generic implementers appended after transform cannot shift IDs already emitted for existing interface values/checks.
fn stable_interface_type_ids_preserving_prefix #
fn stable_interface_type_ids_preserving_prefix(prefix []u32, impl_names []u32) map[u32]int
stable_interface_type_ids_preserving_prefix assigns runtime IDs for implementer spelling IDs while keeping all prefix IDs exactly as they would be when assigned alone.
fn stable_type_index #
fn stable_type_index(name_id u32) int
stable_type_index returns the byte-hashed runtime-index seed for a source spelling ID. Use stable_type_indexes when assigning indexes across a complete program type set.
fn stable_type_indexes #
fn stable_type_indexes(type_names []u32) map[u32]int
stable_type_indexes assigns deterministic, collision-free runtime indexes to the complete caller-supplied source spelling ID set.
fn subst_generic_text #
fn subst_generic_text(type_id u32, args []u32, params []u32) u32
subst_generic_text textually substitutes the generic parameter names params with the source spelling IDs args inside type_id, preserving the generic application form so a method signature mentioning the receiver type (Box[T]) becomes the concrete instance (Box[int]) when re-parsed, instead of collapsing to the bare base. Prefix and container forms (&, mut, ?, !, ..., shared, atomic, chan, thread, [], map[, [N]) recurse into the element type; a bare parameter name is replaced with its argument.
fn type_text_contains_typeof #
fn type_text_contains_typeof(s string) bool
type_text_contains_typeof is a fast substring probe for typeof(: type texts are overwhelmingly short scalar/container names, so the length early-out plus a first-byte scan beats string.contains (KMP table build and call overhead) on hot paths that must screen every text.
fn unalias_type #
fn unalias_type(t &Type) &Type
unalias_type follows an alias chain to its underlying type, unwrapping each Alias to its base type until a non-alias type is reached and returned.
fn unsigned_shift_result_type #
fn unsigned_shift_result_type(t Type) Type
unsigned_shift_result_type returns the unsigned counterpart used as the result of >>>.
fn unwrap_all_pointers #
fn unwrap_all_pointers(t &Type) Type
unwrap_all_pointers removes every pointer layer from t.
fn unwrap_pointer #
fn unwrap_pointer(t &Type) Type
unwrap_pointer transforms unwrap pointer data for types.
fn AllocationLayout.from #
fn AllocationLayout.from[W](input W) !AllocationLayout
from returns the AllocationLayout value of an integer or of a field name, or an error if there is none.
fn AllocationLayout.zero #
fn AllocationLayout.zero() AllocationLayout
zero returns a AllocationLayout value with no flags set.
fn Properties.from #
fn Properties.from[W](input W) !Properties
from returns the Properties value of an integer or of a field name, or an error if there is none.
fn Properties.zero #
fn Properties.zero() Properties
zero returns a Properties value with no flags set.
fn TypeChecker.new #
fn TypeChecker.new(a &flat.FlatAst) TypeChecker
TypeChecker.new creates a TypeChecker value for types.
fn TypeErrorKind.from #
fn TypeErrorKind.from[W](input W) !TypeErrorKind
from returns the TypeErrorKind value of an integer or of a field name, or an error if there is none.
fn VlsMethod.from #
fn VlsMethod.from[W](input W) !VlsMethod
from returns the VlsMethod value of an integer or of a field name, or an error if there is none.
type AliasDataRef #
type AliasDataRef = &AliasData
AliasDataRef references the immutable payload of Alias.
type ArrayFixedDataRef #
type ArrayFixedDataRef = &ArrayFixedData
ArrayFixedDataRef references the immutable payload of ArrayFixed.
type ChannelDataRef #
type ChannelDataRef = &ChannelData
ChannelDataRef references the immutable payload of Channel.
type FnTypeDataRef #
type FnTypeDataRef = &FnTypeData
FnTypeDataRef references the immutable payload of FnType.
type MapDataRef #
type MapDataRef = &MapData
MapDataRef references the immutable payload of Map.
type MultiReturnDataRef #
type MultiReturnDataRef = &MultiReturnData
MultiReturnDataRef references the immutable payload of MultiReturn.
type SymbolId #
type SymbolId = u32
SymbolId is the stable identity of a resolved declaration name in one compilation. Zero denotes no symbol.
type Type #
type Type = Void
| Unknown
| Primitive
| String
| Char
| Rune
| ISize
| USize
| Nil
| None
| Array
| ArrayFixed
| Channel
| Map
| Pointer
| FnType
| OptionType
| ResultType
| Struct
| Interface
| Enum
| SumType
| Alias
| MultiReturn
Type aliases type values used by types.
fn (Type) is_pointer #
fn (t &Type) is_pointer() bool
is_pointer reports whether is pointer applies in types.
fn (Type) is_string #
fn (t &Type) is_string() bool
is_string reports whether is string applies in types.
fn (Type) is_integer #
fn (t &Type) is_integer() bool
is_integer reports whether is integer applies in types.
fn (Type) is_float #
fn (t &Type) is_float() bool
is_float reports whether is float applies in types.
fn (Type) name #
fn (t &Type) name() string
name returns name data for Type.
fn (Type) == #
fn (a Type) == (b Type) bool
fn (Type) source_type_id #
fn (t &Type) source_type_id() u32
source_type_id returns an interned spelling, reusing nominal type identities directly.
fn (TypeCache) lexical_smartcast_miss #
fn (cache &TypeCache) lexical_smartcast_miss(idx int) bool
lexical_smartcast_miss reports whether the node idx is cached as having no lexical narrowing.
type TypeId #
type TypeId = u32
TypeId is the stable identity of a canonical semantic type in one compilation. Type values remain the public compatibility representation; caches and equality-heavy internals can use this compact identity.
type UnknownDataRef #
type UnknownDataRef = &UnknownData
UnknownDataRef references the immutable payload of Unknown.
enum AllocationLayout #
enum AllocationLayout {
aligned
scanned
}
fn (AllocationLayout) is_empty #
fn (e &AllocationLayout) is_empty() bool
is_empty returns true if no flags are set.
fn (AllocationLayout) has #
fn (e &AllocationLayout) has(flag AllocationLayout) bool
has returns true if any of the flags in flag are set.
fn (AllocationLayout) all #
fn (e &AllocationLayout) all(flag AllocationLayout) bool
all returns true if all the flags in flag are set.
fn (AllocationLayout) set #
fn (mut e AllocationLayout) set(flag AllocationLayout)
set sets the flags in flag.
fn (AllocationLayout) set_all #
fn (mut e AllocationLayout) set_all()
set_all sets all the flags.
fn (AllocationLayout) clear #
fn (mut e AllocationLayout) clear(flag AllocationLayout)
clear clears the flags in flag.
fn (AllocationLayout) clear_all #
fn (mut e AllocationLayout) clear_all()
clear_all clears all the flags.
fn (AllocationLayout) toggle #
fn (mut e AllocationLayout) toggle(flag AllocationLayout)
toggle flips the flags in flag.
enum Properties #
enum Properties {
boolean
float
integer
unsigned
untyped
}
Properties lists properties values used by types.
fn (Properties) is_empty #
fn (e &Properties) is_empty() bool
is_empty returns true if no flags are set.
fn (Properties) has #
fn (e &Properties) has(flag Properties) bool
has returns true if any of the flags in flag are set.
fn (Properties) all #
fn (e &Properties) all(flag Properties) bool
all returns true if all the flags in flag are set.
fn (Properties) set #
fn (mut e Properties) set(flag Properties)
set sets the flags in flag.
fn (Properties) set_all #
fn (mut e Properties) set_all()
set_all sets all the flags.
fn (Properties) clear #
fn (mut e Properties) clear(flag Properties)
clear clears the flags in flag.
fn (Properties) clear_all #
fn (mut e Properties) clear_all()
clear_all clears all the flags.
fn (Properties) toggle #
fn (mut e Properties) toggle(flag Properties)
toggle flips the flags in flag.
enum TypeErrorKind #
enum TypeErrorKind {
unknown_ident
unknown_type
unknown_fn
unknown_field
cannot_index
if_branch_mismatch
assignment_mismatch
return_mismatch
call_arg_mismatch
condition_mismatch
duplicate_decl
unhandled_node
unsupported_generic
compile_error
}
TypeErrorKind lists type error kind values used by types.
enum VlsMethod #
enum VlsMethod {
hover
definition
signature_help
completion
inlay_hints
}
VlsMethod is what a -line-info request of the mini-VLS protocol asks for.
struct Alias #
struct Alias {
AliasDataRef = empty_alias_data
}
Alias represents alias data used by types.
fn (Alias) == #
fn (a Alias) == (b Alias) bool
== compares Alias payloads by value.
fn (Alias) name #
fn (value Alias) name() string
name returns the canonical spelling of this nominal type.
fn (Alias) source_type_id #
fn (value Alias) source_type_id() u32
source_type_id returns this nominal type's interned spelling.
struct AliasData #
struct AliasData {
pub:
name_id u32
base_type &Type = empty_type
}
AliasData stores the immutable fields of Alias.
struct Array #
struct Array {
pub:
elem_type &Type = empty_type
}
Array represents array data used by types.
struct ArrayFixed #
struct ArrayFixed {
ArrayFixedDataRef = empty_array_fixed_data
}
ArrayFixed represents array fixed data used by types.
fn (ArrayFixed) == #
fn (a ArrayFixed) == (b ArrayFixed) bool
== compares ArrayFixed payloads by value.
struct ArrayFixedData #
struct ArrayFixedData {
pub:
elem_type &Type = empty_type
len int
len_expr string
}
ArrayFixedData stores the immutable fields of ArrayFixed.
struct CachedName #
struct CachedName {
pub:
value string
}
CachedName keeps a resolved name behind one pointer in the dense node caches. Most AST nodes have no resolved name, so empty slots need no string header.
struct CallInfo #
struct CallInfo {
pub:
name string
params []Type
shared_params []bool
return_type Type
has_receiver bool
is_variadic bool
is_c_variadic bool
params_known bool
has_implicit_veb_ctx bool
arg_offset int
}
CallInfo stores call info metadata used by types.
struct Channel #
struct Channel {
ChannelDataRef = empty_channel_data
}
Channel represents channel data used by types.
fn (Channel) == #
fn (a Channel) == (b Channel) bool
== compares Channel payloads by value.
struct ChannelData #
struct ChannelData {
pub:
elem_type &Type = empty_type
is_mut bool
}
ChannelData stores the immutable fields of Channel.
struct Char #
struct Char {
dummy_ u8
}
Char represents char data used by types.
struct Enum #
struct Enum {
pub:
name_id u32
is_flag bool
}
Enum represents enum data used by types.
fn (Enum) name #
fn (value Enum) name() string
name returns the canonical spelling of this nominal type.
fn (Enum) source_type_id #
fn (value Enum) source_type_id() u32
source_type_id returns this nominal type's interned spelling.
struct FileImportInfo #
struct FileImportInfo {
pub mut:
// selective_imports maps the spelling ID of a name selected by
// `import mod { name }` to the spelling IDs of the declarations it can name
// (by module path and by alias); an empty list marks an ambiguous selection.
selective_imports map[u32][]u32
mut:
imports map[string]string
imports_name_mask u64
imports_mask_ready bool
}
FileImportInfo holds the imports of one source file.
struct FnParam #
struct FnParam {
pub:
typ &Type = empty_type
is_mut bool
}
struct FnType #
struct FnType {
FnTypeDataRef = empty_fn_type_data
}
FnType represents fn type data used by types.
fn (FnType) == #
fn (a FnType) == (b FnType) bool
== compares FnType payloads by value.
struct FnTypeData #
struct FnTypeData {
pub:
params []FnParam
return_type &Type = empty_type
is_variadic bool // The final array parameter accepts zero or more values.
}
FnTypeData stores the immutable fields of FnType.
struct ISize #
struct ISize {
dummy_ u8
}
ISize represents isize data used by types.
struct IncrementalCheck #
struct IncrementalCheck {
mut:
own_files map[string]bool // the files the child parsed, not the server
verify bool // a completion compares what it finds with what was put back
min_left_out int // the fewest nodes the bodies left out hold
earlier IncrementalRecord
has_earlier bool
declarations u64
files string
file_index map[string]int // the place of each of its files in `files`
selected bool // incremental_select ran
functions []IncrementalFunction // every body of the check, in its order
skipped []int // the indexes in functions of the bodies left out
completed bool // they were checked since (see complete_incremental_check)
completing bool // that check began
to_complete []int // the indexes in functions of the bodies it checks
next int // the first of them it did not check yet
// What that check changes, and puts back as it was.
saved_errors int
saved_notices int
saved_pending int
saved_file string
saved_module string
saved_capture bool
saved_trusted bool
captured map[int]IncrementalCaptured // what each checked body reported, by fn_idx
call_names map[int]string // the calls of the bodies left out, by node
fn_values []int // the nodes of those bodies named as functions, put back
// Where the errors of the instances start in tc.errors, once their check
// begins (see put_back_incremental_instances), and with `verify`, what was
// to be put back for them.
instances_start int = -1
instances_verified bool
instances_put_back []TypeError
trace []string
}
IncrementalCheck is what an incremental check keeps (see start_incremental_check).
struct Interface #
struct Interface {
pub:
name_id u32
}
Interface represents interface data used by types.
fn (Interface) name #
fn (value Interface) name() string
name returns the canonical spelling of this nominal type.
fn (Interface) source_type_id #
fn (value Interface) source_type_id() u32
source_type_id returns this nominal type's interned spelling.
struct InterfaceImplIndex #
struct InterfaceImplIndex {
pub:
names flat.TypeTextList
ids map[u32]int
}
InterfaceImplIndex maps source spelling IDs to stable runtime dispatch IDs.
fn (InterfaceImplIndex) names_text #
fn (index &InterfaceImplIndex) names_text() []string
names_text resolves ordered implementation identities for a text consumer.
struct LibraryBodyFrontier #
struct LibraryBodyFrontier {
items []CheckWorkItem
by_node map[int]int
node_count int
top_level_size int
}
LibraryBodyFrontier holds unchanged declaration ranges for one reachability pass.
struct Map #
struct Map {
MapDataRef = empty_map_data
}
Map represents map data used by types.
fn (Map) == #
fn (a Map) == (b Map) bool
== compares Map payloads by value.
struct MapData #
struct MapData {
pub:
key_type &Type = empty_type
value_type &Type = empty_type
}
MapData stores the immutable fields of Map.
struct MultiReturn #
struct MultiReturn {
MultiReturnDataRef = empty_multi_return_data
}
MultiReturn represents multi return data used by types.
fn (MultiReturn) == #
fn (a MultiReturn) == (b MultiReturn) bool
== compares MultiReturn payloads by value.
struct MultiReturnData #
struct MultiReturnData {
pub:
types []types.Type
}
MultiReturnData stores the immutable fields of MultiReturn.
struct Nil #
struct Nil {
dummy_ u8
}
Nil represents nil data used by types.
struct None #
struct None {
dummy_ u8
}
None represents none data used by types.
struct OptionType #
struct OptionType {
pub:
base_type &Type = empty_type
}
OptionType represents option type data used by types.
struct OwnershipCallResultSource #
struct OwnershipCallResultSource {
pub:
arg_id flat.NodeId
source_suffix string
target_suffix string
// source_is_prefix reports that the result aliases storage at or below `source_suffix`
// of the argument, but not a known exact path (a path widened through recursion).
source_is_prefix bool
}
OwnershipCallResultSource records how a call argument can flow into a result projection.
struct OwnershipDropEntry #
struct OwnershipDropEntry {
pub:
name string
type_name u32
optional_wrapper bool
}
fn (OwnershipDropEntry) type_name_text #
fn (entry &OwnershipDropEntry) type_name_text() string
type_name_text resolves the indexed type spelling of a cleanup entry.
struct Pointer #
struct Pointer {
pub:
base_type &Type = empty_type
}
Pointer represents pointer data used by types.
struct PreparedCollect #
struct PreparedCollect {
mut:
// How much of the AST the preparation covered.
nodes_len int
top_level_len int
file_ids_len int
const_count int
// The last file pair of the prepared top-level index, and its module.
last_trailing int = -1
last_file string
last_module string
// The state of the collection steps that carry what they saw to the next
// declaration.
// Whether a check continued from the preparation, so that its nodes are
// the prepared ones followed by its own.
continued bool
c_structs CStructRedeclarations
c_fns CFnRedeclarations
public_c_structs map[u32]bool
// The names the prepared declarations use as keys that code of another
// module can use as well, where the order of the two decides the entry,
// each with the `.file` markers of the prepared files that use it; the
// import aliases of the prepared files; the modules they declare.
keys map[string][]int
import_aliases map[string][]AliasUse
modules map[string]bool
// What the scans for unused declarations look for in the prepared nodes,
// which each check would otherwise walk again: the identifiers and
// selectors (their names and last segments), the callees (the same), and
// the functions the prepared nodes name as values.
named map[string]bool
called map[string]bool
function_named map[string]bool
}
PreparedCollect is what a checker keeps of the declarations it collected before the rest of a program was parsed: a diagnostics server collects builtin and the modules builtin imports once, and each of its checks continues from there with the user's code (collect_continue).
struct Primitive #
struct Primitive {
pub:
props Properties
size u8
}
Primitive represents primitive data used by types.
struct QualifyNameCache #
struct QualifyNameCache {
pub mut:
module string
file string
resolution_type_mode bool
fingerprint int = -1
entries map[u32]u32
texts flat.TypeTextTable
last_name u32
last_value u32
last_valid bool
// The interned `file\x01module` context of current_scope_type_key, for the
// file and module it was taken in.
scope_key_file string
scope_key_module string
scope_key_context u32
scope_key_valid bool
// Identifiers that static_assoc_type_candidates found no type for, with the
// context and table sizes that answer was computed against.
no_static_type_module string
no_static_type_file string
no_static_type_mode bool
no_static_type_fingerprint int = -1
no_static_type_generics int
no_static_type_ids [64]u32
}
qualify_name supports qualify name handling for TypeChecker. QualifyNameCache memoizes both qualification interfaces per source and type-resolution context. Its table fingerprint invalidates entries while collection is still growing the declared-type tables; every checker fork gets its own instance.
struct ResultType #
struct ResultType {
pub:
base_type &Type = empty_type
}
ResultType represents result type data used by types.
struct Rune #
struct Rune {
dummy_ u8
}
Rune represents rune data used by types.
struct Scope #
struct Scope {
pub mut:
parent &Scope = unsafe { nil }
names []string
types []Type
name_indexes map[string]int
// name_mask is a conservative bloom filter over this scope's own binding
// names: a cleared bit proves the name is absent, letting chain walks skip
// the per-level map probe (most lookups walk many levels that do not bind
// the name at all). False positives only cost the probe they would have
// paid anyway.
name_mask u64
fast_lookup bool
fast_generation u32
fast_name_ptrs [32]voidptr
fast_name_lens [32]u16
fast_indexes [32]u32
fast_generations [32]u32
generations []i32
storage_keys []string
next_generation int
lifetime int
}
Scope represents scope data used by types.
fn (Scope) reset #
fn (mut s Scope) reset(parent &Scope)
reset retargets a pooled scope, clearing its bindings while keeping the backing storage capacity so reuse does not reallocate. Without this clear a pooled scope's arrays accumulate every binding ever inserted across all generations, turning lookup/insert into an O(n) scan over dead entries.
fn (Scope) contains #
fn (s &Scope) contains(name string) bool
contains reports whether this scope or a parent has a binding for name, without copying its type or constructing a binding owner.
fn (Scope) lookup #
fn (s &Scope) lookup(name string) ?Type
lookup returns the nearest visible type binding for name.
fn (Scope) lookup_before #
fn (s &Scope) lookup_before(name string, stop &Scope) ?Type
lookup_before returns the nearest binding for name in the scopes from this one up to, but not including, stop (the whole chain when stop is nil).
fn (Scope) binds_own #
fn (s &Scope) binds_own(name string) bool
binds_own reports whether this scope itself, not a parent, binds name.
fn (Scope) lookup_owner #
fn (s &Scope) lookup_owner(name string) ?ScopeBindingOwner
lookup_owner returns the nearest scope that owns a visible binding for name.
fn (Scope) nearest_binding_owned_by #
fn (s &Scope) nearest_binding_owned_by(name string, owner ScopeBindingOwner) bool
nearest_binding_owned_by reports whether the nearest visible binding for name belongs to owner.
fn (Scope) insert #
fn (mut s Scope) insert(name string, typ Type)
insert records or updates a type binding in this scope.
fn (Scope) insert_with_owner #
fn (mut s Scope) insert_with_owner(name string, typ Type) ScopeBindingOwner
insert_with_owner records or updates a type binding and returns the exact binding identity now visible for name.
struct ScopeBindingOwner #
struct ScopeBindingOwner {
scope &Scope = unsafe { nil }
index int = -1
generation int
lifetime int
name string
storage_key string
}
fn (ScopeBindingOwner) bound_type #
fn (owner &ScopeBindingOwner) bound_type() ?Type
bound_type returns the current type of this binding while its scope is live. It returns none after scope reuse or replacement of an ownership-mode binding.
fn (ScopeBindingOwner) storage_key #
fn (owner ScopeBindingOwner) storage_key() string
storage_key returns a stable key for this binding owner while its scope is live.
fn (ScopeBindingOwner) belongs_to_scope #
fn (owner ScopeBindingOwner) belongs_to_scope(scope &Scope) bool
belongs_to_scope reports whether this binding owner was declared directly in scope.
fn (ScopeBindingOwner) belongs_to_scope_chain_until #
fn (owner ScopeBindingOwner) belongs_to_scope_chain_until(scope &Scope, stop &Scope) bool
belongs_to_scope_chain_until reports whether this binding owner was declared between scope and stop, inclusive.
struct ShadowFileResolver #
struct ShadowFileResolver {
wd string
mut:
real_dirs map[string]string
}
ShadowFileResolver resolves many source paths for shadow_roots_own_file with one working-directory lookup and one realpath per directory instead of per file.
fn (ShadowFileResolver) owns_file #
fn (mut r ShadowFileResolver) owns_file(file string, diagnostic_root string, explicit_roots []string, dependency_roots []string) bool
owns_file is shadow_roots_own_file with cached path resolution.
fn (ShadowFileResolver) owns_resolved_file #
fn (r &ShadowFileResolver) owns_resolved_file(file string, real_file string, diagnostic_root string, explicit_roots []string, dependency_roots []string) bool
owns_resolved_file is owns_file for a file whose resolved path (os.real_path) the caller already has.
struct String #
struct String {
dummy_ u8
}
String represents string data used by types.
struct Struct #
struct Struct {
pub:
name_id u32
}
Struct represents struct data used by types.
fn (Struct) name #
fn (value Struct) name() string
name returns the canonical spelling of this nominal type.
fn (Struct) source_type_id #
fn (value Struct) source_type_id() u32
source_type_id returns this nominal type's interned spelling.
struct StructField #
struct StructField {
pub:
name string
typ Type
has_default bool
is_embed bool
is_mut bool
is_volatile bool
}
StructField represents struct field data used by types.
struct SumType #
struct SumType {
pub:
name_id u32
}
SumType represents sum type data used by types.
fn (SumType) name #
fn (value SumType) name() string
name returns the canonical spelling of this nominal type.
fn (SumType) source_type_id #
fn (value SumType) source_type_id() u32
source_type_id returns this nominal type's interned spelling.
struct TransformForkOverlay #
struct TransformForkOverlay {
pub mut:
resolved_call_names map[int]string
resolved_fn_values map[int]string
// Transform forks write overlay entries only for nodes appended after the
// fork. IDs below this boundary are guaranteed to live in the shared dense
// checker arrays, so reads can avoid probing two sparse maps per expression.
base_node_count int
}
TransformForkOverlay holds the call/fn-value resolutions a parallel-transform worker records for its transform-created (cloned) nodes. It lives on the heap (like TypeCache) so a worker's &TypeChecker fork can write through the pointer without mutating the shared node-indexed arrays; reads consult the overlay before those arrays, and merge_worker replays the entries into the master under the shifted node ids.
struct TypeCacheStats #
struct TypeCacheStats {
pub:
parse_hits i64
parse_misses i64
c_hits i64
c_misses i64
}
TypeCacheStats reports semantic cache effectiveness for compiler telemetry.
struct TypeChecker #
struct TypeChecker {
pub mut:
runtime_type_indexes map[u32]int
a &flat.FlatAst = unsafe { nil }
compiler_vroot string
module_search_paths []string
fs_memo &CheckerFsMemo = unsafe { nil } // see check_import_diagnostics
verbose bool
fast_parse_recent bool
fast_type_text_refs bool
fast_c_type_recent bool
memo_call_info bool
method_suffix_prescreen bool
prefix_param_scan bool
building_v_fast bool
parallel_check_min_items int = min_parallel_check_items // the fewest function bodies a check splits among the worker pool
logical_file_order []int // the `.file` markers in the order to collect them, when not the node order
prepared_collect &PreparedCollect = unsafe { nil } // what collect_continue continues from
vls_prefs &pref.Preferences = unsafe { nil } // what a question parses a file again with (see vls_add_skipped_branches)
vls_reparsed_files map[int]bool // the files whose left-out branches have nodes
vls_twins map[int]flat.NodeId // a node added for a left-out branch's file, to the checked node it parses again
vls_added_start int = max_int // the first of the nodes that questions added
vls_body_types map[int]Type // the types that a generic body gives its nodes in every instance (see vls_type_generic_body)
vls_open_types map[int]Type // the types, with its type parameters, that a generic body gives the nodes that depend on them (see vls_type_generic_body)
vls_typed_bodies map[int]bool // the generic functions whose bodies were typed so
keep_placeholder_types bool // a fork keeps the types that are a type parameter itself, which the cache of types leaves out
placeholder_types map[int]Type // those types
incremental &IncrementalCheck = unsafe { nil } // what an incremental check keeps (see start_incremental_check)
capture_items bool // each body checked notes where its diagnostics end (see incremental_capture)
item_marks []IncrementalItemMark // those notes
valid_diagnostic_fast bool
valid_resolution_fast bool
defer_fn_ancillary bool
fn_ancillary_registrations []FnAncillaryRegistration
fn_c_variadic_registrations []FnNamePairRegistration
fn_mut_receiver_registrations []FnNamePairRegistration
fn_ret_text_registrations []FnTextRegistration
visible_mutation_registrations []VisibleMutationRegistration
enable_globals bool
disable_explicit_mutability bool
fn_ret_types map[string]Type
fn_ret_types_revision u64
fn_param_types map[string][]Type
v_fn_semantic_names map[string]bool
c_fn_module_ret_types map[string]Type
c_fn_module_param_types map[string][]Type
c_fn_referenced_types map[u32]bool
c_fn_module_variadic map[string]bool
c_fn_abi_variadic_prefixes map[string]int
fn_shared_params map[string][]bool
mut_receiver_methods map[string]bool
source_no_body_fns map[string]bool
source_no_body_fn_suffixes map[string]bool
source_no_body_method_names map[string]bool
unsafe_fn_modules map[string][]string
unsafe_fn_bloom NameBloom // of its names, while count is its size
unsafe_c_fns map[string]bool
fn_ret_type_texts flat.TypeTextBindings // generic struct method key -> original return type text (e.g. `Box[T].clone` -> `Box[T]`)
fn_param_type_texts flat.TypeTextListBindings // generic struct method key -> original param type texts (receiver first)
fn_type_files map[string]string
fn_type_modules map[string]string
transform_signature_maps_shared bool
transform_signature_maps_changed bool
// transform_signature_keys_borrowed marks a transform fork whose shared
// signature maps belong to a checker that outlives it, so a detached copy
// can borrow their keys instead of cloning every name.
transform_signature_keys_borrowed bool
transform_signature_names_log []string
transform_struct_maps_shared bool
fn_generic_params map[string][]u32
fn_generic_params_bloom NameBloom
constraints_scanned bool // program_declares_constraints has looked
declares_constraints bool
specialized_generic_fns map[string]bool
fn_variadic map[string]bool
c_variadic_fns map[string]bool
fn_implicit_veb_ctx map[string]bool
receiver_method_suffix_index map[string]string
receiver_method_short_names map[string]bool
collection_method_short_names map[string]bool // short names of `[]T.m` and `map[K]V.m` methods
generic_receiver_method_index map[string][]string
structs map[u32][]StructField
c_struct_scoped_fields map[u64][]StructField
struct_modules map[u32]string
struct_files map[u32]string
soa_structs map[u32]bool
// Packed source-context ID and type spelling ID keys for every source-level
// struct/type/interface/enum declaration, built once in `collect`. Replaces
// the former full-node scan in `source_declares_type_in_scope`, which was
// O(nodes) per call and dominated check/transform/cgen (called via qualify_name).
declared_type_scope_keys map[u64]bool
concrete_type_scope_keys map[u64]bool
struct_error_embeds_shadow_builtin map[u32]bool
struct_generic_params map[u32][]u32 // generic struct base name -> type-param spelling IDs (e.g. Vec4 -> [T])
struct_implements flat.SourceTypeListBindings
struct_shared_fields map[u32]map[string]bool
struct_shared_element_fields map[u32]map[string]bool
struct_field_c_abi_fns map[u32]map[string]string
// Concrete receiver spelling ID and method name -> substituted CallInfo for a method *value* on a
// generic receiver. The open `Box[T].method` registration is gone by cgen time, so
// the checker stashes the resolved signature here for gen_method_value_closure.
generic_method_value_info map[u32]map[string]CallInfo
params_structs map[u32]bool
c_typedef_structs map[u32]bool
unions map[u32]bool
type_aliases flat.SourceTypeBindings
type_alias_modules map[u32]string
type_alias_generic_params map[u32][]u32 // generic alias base name -> type-param spelling IDs
type_alias_c_abi_fns map[u32]string
recursive_alias_names map[u32]bool
sum_types flat.SourceTypeListBindings
sum_generic_params map[u32][]u32 // generic sum type base name -> type-param spelling IDs (e.g. Tree -> [T])
enum_names map[u32]bool
enum_fields map[u32][]string
flag_enums map[u32]bool
interface_names map[u32]bool
interface_generic_params map[u32][]u32
interface_fields map[u32][]StructField
interface_embeds flat.SourceTypeListBindings
interface_abstract_methods map[u32][]string // iface -> abstract (declared) method names
interface_impl_name_snapshots map[u32]flat.TypeTextList
interface_impl_candidates_at_snapshot map[u32]bool
interface_impl_candidates_at_index map[u32]bool
interface_method_names_index map[u32][]string
interface_abstract_index map[u32][]string
interface_field_list_index map[u32][]StructField
interface_impl_indexes map[u32]&InterfaceImplIndex
interface_query_indexes_ready bool
c_globals map[string]Type
inferred_c_globals []InferredCGlobal // the entries of c_globals that this checker added, for its merge
global_names map[string]bool
shared_global_names map[string]bool
const_types map[string]Type
const_exprs map[string]flat.NodeId
const_modules map[string]string
const_files map[string]string
const_suffixes map[string]string // dot-suffix -> full const key (O(1) lookup; '' if ambiguous)
declaration_visibility map[string]DeclarationVisibility
private_decl_bloom NameBloom // of the last name segments of its non-pub entries, while count is its size
checked_const_names map[string]bool
imports map[string]string // alias -> short module name
file_imports map[string]string
file_imports_by_file map[string]&FileImportInfo
selective_import_files map[string]&FileImportInfo // files with `import mod { name }`; shared entries of file_imports_by_file
const_import_modules map[string][]string
const_import_files_count int = -1
// Whether the source of a file (by id) has an `@[if ` attribute.
if_attribute_files map[int]bool
// The leading names of the root scope `root_scope_globals` (of `lifetime`)
// that global_names holds (see root_scope_global_name_prefix).
root_scope_globals voidptr
root_scope_global_lifetime int
root_scope_global_prefix int
// Field attributes remain immutable after collection; a growing AST invalidates this filter.
required_fields_ast_nodes int = -1
has_required_fields bool = true
file_modules map[string]string
translated_files map[string]bool
generated_files map[string]bool // files of `@[generated]` modules: relaxed naming rules
has_globals_files map[string]bool
deprecated_symbols map[string]DeprecationInfo
deprecated_modules map[string]DeprecationInfo
file_scope &Scope = unsafe { nil }
cur_scope &Scope = unsafe { nil }
scope_pool []&Scope
scope_pool_index int
has_builtins bool
cur_module string
cur_file string
generic_decl_file string // declaring file of the generic param text being inferred ('' = cur_file)
unsafe_depth int
defer_unsafe_depth int // `unsafe_depth` at the start of the innermost `defer` body
sort_comparator_depth int
lock_depth int
autolocked_map string // the `shared` map locked by the operation being checked, see SharedMapAutolock
comptime_static_depth int
enum_field_value_depth int // > 0 while an enum field initializer is checked
errors []TypeError
notices []TypeError
resolved_call_names []&CachedName // node_id -> resolved function name
resolved_call_set []bool
statement_nodes []bool
// Exact call/function-value dependencies recorded while each function is
// checked. Consumers such as markused can walk these resolved Symbol-like
// names instead of reconstructing import and receiver resolution from syntax.
direct_dependencies_by_fn map[int][]SymbolId // enclosing fn node id -> resolved function identities
// The dependency record_direct_dependency last added or found: the calls
// of a body repeat the same callee, which the list then already holds.
last_dependency_fn int = -1
last_dependency_id SymbolId
// Read-only post-check call graph for transform forks (see
// fork_for_parallel_transform); nil in the checker that owns the graph.
post_check_dependencies &DependencyGraphView = unsafe { nil }
global_store_cache &FnGlobalStoreCache = unsafe { nil }
// call_param_flows_to_callback results computed before transform lowers the
// bodies they read (see prepare_callback_param_flows); shared with forks.
callback_param_flows &CallbackParamFlows = unsafe { nil }
// The interface boxes the transform stage collected from the tree before
// lowering, the node count it scanned and the library bodies it skipped, for
// the monomorphization stage to start from. transform_boxed_node_count is -1
// until the transform stage sets them.
transform_boxed_types []u64
transform_boxed_values []bool
transform_boxed_skipped []bool
transform_boxed_node_count int = -1
// Parameter storage and call provenance summaries computed before
// lowering, keyed by fn_decl node, and the node count they cover, for the
// monomorphization stage to start from.
transform_borrow_params map[int][]bool
transform_call_provenance_borrow_params map[int][]bool
transform_borrow_node_count int
// transform_borrow_handover_unused says that no monomorphization stage follows
// the transform stage, so the summaries above have no reader.
transform_borrow_handover_unused bool
// Methods used as *values* (`recv.method` passed as a callback), recorded per enclosing
// function during semantic checking — which has full scope/type info, runs before
// markused, and (unlike a call) routes a value-context selector through check_selector.
// markused seeds these (keeping the wrapper-only method out of the dead-code pruner)
// only when their enclosing function is reachable.
method_values_by_fn map[int][]string // enclosing fn node id -> method-value `Type.method` keys
// Local variables bound to a method value (`cb := c.report`) in the current function.
// Escape checks use these aliases to retain the lifetime hazard of mutable methods
// borrowing addressable stack receivers. Reset per function.
method_value_locals map[string]bool
// Scope depth at which each method-value local was marked, so a reassignment to a
// non-method value only clears the marker when it dominates later uses (same-or-shallower
// scope); a reassignment in a deeper conditional/loop scope keeps the maybe-method marker.
method_value_local_depth map[string]int
capturing_fn_literal_locals map[string]bool
capturing_fn_literal_local_depth map[string]int
capturing_fn_literal_return_unsupported map[string]bool
cur_fn_node_id int = -1
cur_fn_mut_param_base_types map[string]Type
cur_fn_mut_param_binding_owners map[string]ScopeBindingOwner
cur_fn_mut_local_binding_owners map[string]ScopeBindingOwner
cur_fn_shared_binding_owners map[string]ScopeBindingOwner
cur_comptime_variant_loop_vars []string
comptime_attr_narrow_state &ComptimeAttributeNarrowState = unsafe { nil }
expr_type_values []&Type // node_id -> complex/contextual resolved type
expr_type_set []bool
lexical_smartcast_misses []bool
checking_nodes []bool
parallel_check_sparse bool
scope_parallel_check_workers bool
// A pool worker's batch arena, kept between its batches and rewound for the
// next one (see check_scoped_batches); nil unless the worker opted in.
reuse_check_batch_scope bool
check_batch_scope voidptr
// Node id range [check_range_lo, check_range_hi] of the fn item currently
// being checked. Fn subtrees are disjoint contiguous ranges (each fn_decl at
// index i owns (prev_top_level_idx, i]), so while parallel_check_sparse is
// set, cache entries for in-range ids are written straight into the shared
// node-indexed arrays (this checker is the range's only writer) and only
// out-of-range ids (consts, other decls' nodes) go through the private
// sparse maps that are merged after join.
check_range_lo int = -1
check_range_hi int = -1
sparse_resolved_call_names map[int]string
sparse_resolved_fn_values map[int]string // the only fn-value name store: a few dozen entries, a node-indexed array cost ~12 MB
// Only private transform/codegen snapshots enable this conservative filter.
// Mutable masters and storage probes keep supporting direct map writes.
sparse_fn_value_filter [64]u64
sparse_fn_value_filter_ready bool
fork_fn_value_writes map[int]string // a transform fork's own fn-value writes ('' = cleared); its sparse map stays a read-only snapshot and only these are merged
sparse_statement_nodes map[int]bool
sparse_expr_type_values map[int]Type
sparse_checking_nodes map[int]bool
diagnose_unknown_calls bool
reject_unlowered_map_mutation bool
reject_unsupported_generics bool
checker_fixture_mode bool
is_test bool
checked_comptime_method_calls map[u64][]ComptimeMethodCallInstance
comptime_method_calls_by_decl map[int]map[int]bool
check_concrete_generic_bodies bool // `-check` checks the concrete clones of the program's generics for fields and methods their types lack, and for arrays and maps with the wrong element layout
check_program_lib_instances bool // such a check also checks the instances of library generics that the program's own code asks for (see transform.LibraryBodies)
library_instances int // the instances of library generics that such a check cloned
library_headers int // how many of them it cloned without their bodies (see transform.LibraryBodies)
library_bodies_kept_for string // why every one of them kept its body, when one had to
check_generic_bodies bool // the bodies of generic functions whose type parameters all have a constraint are checked
type_param_texts map[u32]u32 // in a fork that checks a generic body with its type parameters as types their constraints admit, the text of each (check_generic_fn_body_as)
type_params_expanding map[u32]bool // the type parameters of type_param_texts whose own text is being parsed: `T` of `[T Comparable[T]]` stays open inside it
concrete_parents_indexed int // nodes the parent index covered when the last concrete clone was checked
concrete_guard_options map[flat.NodeId]bool // in check_concrete_instance_members, the `if x := a` operands declared as an option or result, smartcast to their payload
checking_concrete_members bool // check_concrete_instance_members is checking a clone
module_diagnostic_root string
autofree_mode bool
no_main bool
nofloat bool
is_js_backend bool
warn_about_allocs bool
warns_are_errors bool
explicit_warns_are_errors bool
notes_are_errors bool
is_prod bool
cross_target_prefs &pref.Preferences = unsafe { nil }
suppress_dump_output bool
diagnostic_files map[string]bool
sel_decl_memo_callee int = -1 // selector of the active check_call
sel_decl_memo_id int = -1 // see selector_declared_value_type_at
sel_decl_memo_scope voidptr
sel_decl_memo_names int
sel_decl_memo_lifetime int
sel_decl_memo_errors int
sel_decl_memo_smartcasts int
sel_decl_memo_fn int
sel_decl_memo_base_cached bool
sel_decl_memo_found bool
sel_decl_memo_type Type = Type(Void{})
skips_library_bodies bool // see skip_unreachable_library_bodies
// The short names of the globals, constants, sum types and type aliases, and how
// many entries the tables had when they were taken (see prepare_check_name_filters), so that a
// selector or callee can be rejected without hashing its qualified spellings.
// const_suffix_key_count is the size of const_types that const_suffixes covers.
global_short_names map[string]bool
global_short_names_count int = -1
sum_type_short_names map[u32]bool
sum_type_short_names_count int = -1
alias_short_names map[u32]bool
alias_short_names_count int = -1
const_suffix_key_count int = -1
const_selector_bloom &ConstSelectorBloom = unsafe { nil } // of const_types and const_suffixes
const_selector_suffix_count int = -1
const_expr_short_names map[string]bool
const_expr_short_names_count int = -1
global_name_bloom NameBloom // of global_names
call_flag_bloom NameBloom // of the set call_info flags, see call_flag_tables_count
call_flag_lens [4]int // call_flag_table_lens when call_flag_bloom was built
// The last call whose callee generic_compile_error_instantiation found to be
// no generic function: its children start, callee name and module.
nongeneric_call_start int = -1
nongeneric_call_name string
nongeneric_call_module string
// Whether the receiver parameter of fn_decl node receiver_memo_fn, checked in
// file and module receiver_memo_file / receiver_memo_module, has the type of
// the receiver its name declares (current_receiver_param_method_call_info).
receiver_memo_fn int = -1
receiver_memo_file string
receiver_memo_module string
receiver_memo_ok bool
// Set by markused only after convergence for its returned reachability set.
// Adding roots requires the ordinary late-body convergence check again.
library_body_convergence_complete bool
library_files map[string]bool // the files whose unreachable bodies the check leaves out
reachable_library_fns map[string]bool // the functions of those files that it checks
shadow_diagnostic_root string
shadow_explicit_roots []string
shadow_dependency_roots []string
multiple_module_import_lines map[u64]bool
import_line_indexed_files map[int]bool
source_texts_by_file map[string]string
source_texts_by_id map[int]string
// Scans the index preparation ran ahead of index_module_import_lines_of_new_files.
import_line_prescans []ImportLineScan
// Zero means unindexed; one rules out the exceptional `cosnt` diagnostic.
malformed_const_source_states []u8
ct_update_pos map[int]token.Pos
ct_update_indexed bool
insert_include_dirs_by_file map[string][]string
has_spawn_expr int = -1
inactive_top_level_node_ids []i32
selected_file_called_fns map[string]bool
// Names newly inserted into selected_file_called_fns and not yet chased by
// the transitive closure in collect_selected_file_called_fns_transitively.
selected_file_worklist []string
// The last path segment of every function signature key, armed for the
// duration of a reachability walk (see walk_fn_value_decl_key).
walk_fn_short_names &WalkFnShortNames = unsafe { nil }
// During a scoped check, sites that would gate on the called-fns closure park
// their candidate error here. Successful builds skip the closure entirely;
// the master computes it after checking only when a candidate needs filtering.
defer_ierror_gating bool
pending_ierror_errors []PendingIerrorError
// Node indices of every top-level declaration node (file markers, module/import
// decls, type-level decls, consts, globals, fn/c-fn decls), in AST order. These
// kinds only occur at the top level, so a pass iterating this index visits the
// same nodes in the same order as a full `a.nodes` scan that matches on them —
// without streaming the ~100x larger node array each time. Built once in
// `collect`; no later phase of the check step appends declarations. Phases
// after the check (transform) may grow the AST: top_level_idx_nodes_len
// records the node count the index covers.
top_level_idx []i32
top_level_idx_nodes_len int
// mut_binding_value_id is the value of the `mut` binding (`mut x := v`, or
// `x = v` for a mutable `x`) being checked. Like V1, only a struct literal
// that is that value (or one of its branch tails) rejects `&immutable` in its
// `mut:` fields.
mut_binding_value_id int = -1
// Anonymous and function-local struct declarations are synthesized below
// the file's top-level declaration tree. The direct-parent pass records their
// sorted node ids so collect_top_level_idx_fast can merge them without
// rescanning every gap between parser-recorded declarations.
synthetic_top_level_type_ids []i32
expected_expr_id int = -1
expected_expr_type Type = builtin_void_type
cur_fn_ret_type Type = builtin_void_type
channel_send_or_expr_id int = -1
smartcasts map[string]Type
ownership &OwnershipState = unsafe { nil }
ownership_return_item_by_name map[string]int
ownership_return_edges []u64
ownership_return_current_item int = -1
ownership_return_record_calls bool
ownership_return_item_changed bool
ownership_param_item_by_name map[string]int
ownership_param_changed_items []bool
ownership_param_current_item int = -1
ownership_param_track_changes bool
// See QualifyNameCache: nil unless armed for a phase whose allocations
// outlive every prealloc scope arena; forks must replace it with their own
// instance. A long-lived armed cache written during a scoped driver stage
// (markused/transform/cgen under -prealloc) stores map buckets and result
// strings in the disposable scope arena, and later reads crash.
qualify_name_cache &QualifyNameCache = unsafe { nil }
// Per-fork resolve_type memo for the current check work item's node range;
// nil until check_fn_items_serial arms it (see BodyResolveMemo).
body_resolve_memo &BodyResolveMemo = unsafe { nil }
import_info_cache &ImportInfoCache = unsafe { nil }
// The smartcast keys of the body being checked (see SmartcastKeyFilter);
// nil outside check_fn_items_serial.
smartcast_key_filter &SmartcastKeyFilter = unsafe { nil }
// Nanoseconds spent in the ownership checker's per-fn boundary passes.
// Only `-d ownership` builds ever write it (every writer lives in
// checker_ownership_d_ownership.v), so plain builds report exactly 0.
ownership_time_ns i64
selfhost bool
// resolution_type_mode is enabled only after semantic checking, while transform
// and codegen read synthesized generic-specialization type text. Source annotations
// must keep normal module scoping and never enable this fallback.
resolution_type_mode bool
// trust_checked_expr_types serves resolve_type straight from the checker's
// dense per-node type cache. Armed by the driver only after checking
// completes; transform's node-write helpers invalidate rewritten ids, and
// nodes appended after checking fall outside the cache and resolve normally.
trust_checked_expr_types bool
// fork_overlay is non-nil only on parallel-transform worker forks; see
// TransformForkOverlay and fork_for_parallel_transform.
fork_overlay &TransformForkOverlay = unsafe { nil }
// Immutable declaration indexes shared by checker workers. They are public, so
// the tests of other compiler modules can register declarations directly.
declaration_attributes map[int][]string
type_declaration_ids map[u32][]int
// attribute_schemas indexes custom attribute schemas by short name
// (vlang/rfcs#35). Several modules may declare the same short name;
// uses resolve V-strict, see check_custom_attribute_uses.
attribute_schemas map[string][]AttributeSchema
mut:
checked_library_body_count int
// Successful reachability frontiers only append notices. Keep their last
// sorted size; error-producing batches retain the full sorting path.
library_sorted_notice_count int = -1
cache_lexical_parents bool = true
// Source-validated bodies consisting solely of a known terminating call.
// Their lowered temporaries belong to the exempt argument expression.
noalloc_terminal_functions map[string]bool
// Dropped with phase caches before a disposable arena is released. Forks
// start with nil so their mutable topology slots are never shared.
lexical_parent_memo &LexicalParentMemo = unsafe { nil }
// Only set during check_semantics_opt; forks and views share the immutable
// indexes (see CheckDeclIndexes).
check_decl_indexes &CheckDeclIndexes = unsafe { nil }
// Private to one checking checker: views do not inherit it.
source_type_keyword_memo &SourceTypeKeywordMemo = unsafe { nil }
// Only set on the checker that runs the serial interface index loop.
interface_impl_memo &InterfaceImplMemo = unsafe { nil }
// Includes method-value aliases and binding-owner maps; all backing maps are
// replaced together at every function/worker boundary.
fn_context FunctionCheckContext
selective_import_index &SelectiveImportIndex = &SelectiveImportIndex{}
type_cache &TypeCache = unsafe { nil }
pre_transform_type_cache &TypeCache = unsafe { nil }
resolution_type_views &ResolutionTypeViewCache = unsafe { nil }
visible_mutation_cache &VisibleMutationCache = unsafe { nil }
storage_query_probe &StorageQueryProbe = unsafe { nil }
storage_query_probe_scopes []voidptr
type_interner &TypeInterner = unsafe { nil }
symbols &SymbolInterner = unsafe { nil }
// direct_parent_ids maps a parsed node to the first AST node that references
// it as a child. It is immutable during semantic checking and shared by
// checker workers. Transformed or appended nodes use the scan fallback in
// direct_parent_id.
direct_parent_ids []flat.NodeId
preflight_node_ids []i32
preflight_index_nodes_len int = -1
rewritten_parent_ids []flat.NodeId
value_used_nodes []bool
fn_check_costs []i32
direct_parent_index_trusted bool
has_goto_nodes bool
// Memo of comptime_methods_loop_exists for the AST at comptime_methods_scan_ast.
comptime_methods_scan_ast voidptr
comptime_methods_scan_len int
comptime_methods_loop_found bool
// Immutable declaration indexes shared by checker workers.
strings_builder_bindings map[string]bool
strings_builder_candidates []i32
static_associated_fn_keys map[string]bool
static_associated_method_names map[string]bool
static_associated_signature_count int = -1
declaration_param_mutability map[string][]bool
strict_map_index_files map[string]bool
// transform_static_method_names is static_associated_method_names taken again from
// the signatures a batch of function bodies starts with: transform registers
// signatures as it goes, which leaves the checked index behind for good.
// transform_static_method_count is the number of signatures it lists, -1 for none.
transform_static_method_names map[string]bool
transform_static_method_count int = -1
// short fn name -> first declaring top-level node index, in declaration
// order (mirrors the expr_raw_fn_type_id scan's first-match rule).
fn_decl_short_name_ids map[string]int
// Raw and qualified names use the first matching declaration, including the
// main-prefixed raw aliases accepted by recursive-str helper lookup.
recursive_str_fn_decl_ids map[string]int
recursive_str_fn_decl_index_size int = -1
recursive_str_fn_decl_index_complete bool
// '${file id}\x00${fn name}' for every top-level fn_decl, so a per-call
// "does this file declare a bare fn of this name" lookup does not walk the
// whole top-level index.
file_bare_fn_names map[string]bool
// '${file}\x00${alias}' -> dotted import path, and '${file}\x00${last
// segment}' -> dotted import path (first import wins), replacing per-call
// scans over every top-level declaration.
file_import_alias_paths map[string]string
file_import_suffix_paths map[string]string
// struct name -> embedded receiver type names (empty entry when the struct
// has no embeds). Structs added after collect (monomorphization) miss this
// index and fall back to the field walk.
struct_embed_receivers flat.SourceTypeListBindings
// Immutable node -> generic parameter index shared by checker workers.
enclosing_generic_params_by_node map[int][]u32
enclosing_generic_param_masks []u32
first_type_declaration_ids map[u32]int
// Immutable attribute-kind sidecars collected with declaration_attributes.
declaration_attribute_kinds map[int]u32
}
TypeChecker represents type checker data used by types.
fn (TypeChecker) requires_aligned_allocation #
fn (tc &TypeChecker) requires_aligned_allocation(typ &Type) bool
requires_aligned_allocation reports whether a value needs over-aligned storage.
fn (TypeChecker) allocation_layout #
fn (tc &TypeChecker) allocation_layout(typ &Type) AllocationLayout
allocation_layout describes alignment and scanning requirements of a canonical value.
fn (TypeChecker) enable_scoped_parallel_workers #
fn (mut tc TypeChecker) enable_scoped_parallel_workers()
enable_scoped_parallel_workers uses disposable prealloc arenas for parallel checker helpers, including ownership snapshots and inferred metadata.
fn (TypeChecker) scoped_parallel_workers_enabled #
fn (tc &TypeChecker) scoped_parallel_workers_enabled() bool
scoped_parallel_workers_enabled reports whether compiler stages should use short-lived worker arenas with this checker.
fn (TypeChecker) reset_codegen_smartcasts #
fn (mut tc TypeChecker) reset_codegen_smartcasts()
reset_codegen_smartcasts discards function-local bindings before backend type queries. A scoped transform can leave even an empty map in its disposable arena.
fn (TypeChecker) fork_for_parallel_codegen #
fn (tc &TypeChecker) fork_for_parallel_codegen() &TypeChecker
fork_for_parallel_codegen returns a complete read-only semantic view with private scope and memoization state for one C-generation worker.
fn (TypeChecker) fork_for_parallel_transform #
fn (tc &TypeChecker) fork_for_parallel_transform(ast &flat.FlatAst) &TypeChecker
fork_for_parallel_transform returns a TypeChecker that shares all of tc's read-only data (semantic maps and node-indexed cache arrays, which the transform pass only reads) but owns a fresh, private type_cache and a private AST view. During transform the only hidden mutation a TypeChecker performs through its & receiver is memoization into type_cache (parse_type / c_type); giving each worker its own cache makes concurrent use race-free without cloning the large semantic maps. ast must be the worker's own (cloned) FlatAst so that any expr_type lookup on a freshly-created node id indexes a valid array.
fn (TypeChecker) ensure_private_transform_signatures #
fn (mut tc TypeChecker) ensure_private_transform_signatures()
ensure_private_transform_signatures detaches the signature tables before a transform worker writes them. The worker's private maps are merged while its disposable arena is still alive.
fn (TypeChecker) clone_transform_metadata_owned #
fn (mut tc TypeChecker) clone_transform_metadata_owned()
clone_transform_metadata_owned detaches every transform-mutated metadata map and its string payloads from a disposable worker or stage arena.
fn (TypeChecker) transform_signatures_changed #
fn (tc &TypeChecker) transform_signatures_changed() bool
transform_signatures_changed reports whether a transform fork detached and added signature state that its parent must merge.
fn (TypeChecker) discard_transform_signature_changes #
fn (mut tc TypeChecker) discard_transform_signature_changes()
discard_transform_signature_changes makes a fork's private signature tables disposable when its parent has already registered the same generated signatures. Other worker results can then be merged without publishing pointers owned by the worker's temporary arena.
fn (TypeChecker) ensure_private_transform_structs #
fn (mut tc TypeChecker) ensure_private_transform_structs()
ensure_private_transform_structs detaches struct metadata before a transform worker publishes a generated capture context into its private result.
fn (TypeChecker) freeze_type_cache_for_forks #
fn (tc &TypeChecker) freeze_type_cache_for_forks()
freeze_type_cache_for_forks freezes this checker's warm type cache as the shared read-only base for parallel forks (fork_for_parallel_transform picks it up) and switches the checker itself to a private overlay so its own memoization writes cannot race fork reads. Callable on a shared reference: the transformer holds the checker as &TypeChecker.
fn (TypeChecker) unfreeze_type_cache_after_forks #
fn (tc &TypeChecker) unfreeze_type_cache_after_forks()
unfreeze_type_cache_after_forks folds the private overlay back into the frozen base once every fork has been joined, and reattaches the base as the live cache.
fn (TypeChecker) discard_type_cache_overlay_after_forks #
fn (tc &TypeChecker) discard_type_cache_overlay_after_forks()
discard_type_cache_overlay_after_forks reattaches the frozen cache without publishing memoized entries from parallel work. C generation uses this after its workers join because the driver replaces the cache at the end of the stage, and worker-arena values must not escape into the persistent base.
fn (TypeChecker) set_fresh_type_cache #
fn (mut tc TypeChecker) set_fresh_type_cache(parse_enabled bool)
set_fresh_type_cache attaches a new empty TypeCache. Parallel-cgen worker checkers use this so the lazily-built lookup indexes and memoizations work per worker instead of falling back to their uncached full scans.
fn (TypeChecker) reset_type_interners #
fn (mut tc TypeChecker) reset_type_interners()
reset_type_interners replaces semantic interners whose backing storage may have grown inside a disposable compiler-stage arena.
fn (TypeChecker) set_fresh_type_cache_based_on #
fn (mut tc TypeChecker) set_fresh_type_cache_based_on(src &TypeChecker, parse_enabled bool)
set_fresh_type_cache_based_on attaches a new empty TypeCache that falls back read-only to src's frozen base cache (see freeze_type_cache_for_forks), so parallel-cgen workers start with every type memoized by the check/transform phases instead of re-deriving them from a cold cache.
fn (TypeChecker) type_cache_parse_enabled #
fn (tc &TypeChecker) type_cache_parse_enabled() bool
type_cache_parse_enabled reports whether parse_type memoization is enabled on this checker's type cache.
fn (TypeChecker) clear_field_lookup_cache #
fn (tc &TypeChecker) clear_field_lookup_cache()
clear_field_lookup_cache invalidates field types after declaration metadata changes.
fn (TypeChecker) clear_c_type_cache #
fn (tc &TypeChecker) clear_c_type_cache()
clear_c_type_cache invalidates C spellings after monomorphization changes concrete type identities and adds materialized generic types.
fn (TypeChecker) clear_interface_impl_cache #
fn (tc &TypeChecker) clear_interface_impl_cache()
clear_interface_impl_cache invalidates memoized implementer lists after a type-table change.
fn (TypeChecker) free_parallel_transform_caches #
fn (mut tc TypeChecker) free_parallel_transform_caches()
free_parallel_transform_caches releases private memoization maps owned by a forked transform checker and leaves it valid if it is accidentally read again.
fn (TypeChecker) refresh_direct_parent_index #
fn (mut tc TypeChecker) refresh_direct_parent_index(a &flat.FlatAst)
refresh_direct_parent_index rebuilds parent metadata after source-tree pruning.
fn (TypeChecker) reuse_direct_parent_index_for_unchanged_ast #
fn (mut tc TypeChecker) reuse_direct_parent_index_for_unchanged_ast(a &flat.FlatAst) bool
reuse_direct_parent_index_for_unchanged_ast restores the parsed-tree index's trusted status when an internal valid-build path has not structurally rewritten the AST.
fn (TypeChecker) invalidate_direct_parent_index #
fn (mut tc TypeChecker) invalidate_direct_parent_index()
invalidate_direct_parent_index makes generated-node lookups validate parent metadata.
fn (TypeChecker) refresh_rewritten_parent_index #
fn (mut tc TypeChecker) refresh_rewritten_parent_index(a &flat.FlatAst)
refresh_rewritten_parent_index rebuilds the node-parent edges after transform without resetting declaration metadata collected during semantic checking. Rewritten trees can contain hundreds of thousands of new nodes; leaving those nodes outside direct_parent_ids makes every parent query scan the whole AST.
fn (TypeChecker) index_rewritten_parents_after #
fn (mut tc TypeChecker) index_rewritten_parents_after(start int)
index_rewritten_parents_after adds to that index the nodes appended from start on. A clone of a generic function is a new subtree, so its edges are all among those nodes.
fn (TypeChecker) declaration_param_mutability_for #
fn (tc &TypeChecker) declaration_param_mutability_for(key string) []bool
declaration_param_mutability_for returns which parameters of the declaration key are mut, with the receiver first for a method, or an empty array when unknown. The returned array is shared with the index; clone it before changing it.
fn (TypeChecker) has_fn_decl_short_name #
fn (tc &TypeChecker) has_fn_decl_short_name(name string) bool
has_fn_decl_short_name reports whether collection indexed a function declaration with the given unqualified name.
fn (TypeChecker) reserve_transform_node_caches #
fn (mut tc TypeChecker) reserve_transform_node_caches(n int)
reserve_transform_node_caches reserves node-indexed semantic storage before a scoped transform starts, keeping the escaping slabs in the compilation arena.
fn (TypeChecker) materialize_sparse_transform_node_caches #
fn (mut tc TypeChecker) materialize_sparse_transform_node_caches(n int, capacity int)
materialize_sparse_transform_node_caches compacts transform-created semantic entries into dense node-indexed arrays and reserves their expected final capacity before monomorphization appends more nodes.
fn (TypeChecker) reserve_scoped_transform_metadata #
fn (mut tc TypeChecker) reserve_scoped_transform_metadata(signature_headroom int)
reserve_scoped_transform_metadata keeps tables that receive escaping transform additions in the compilation arena in the common case while scratch allocations use a disposable arena. The signature maps are rebuilt after promotion, so this headroom is an optimization rather than an ownership requirement.
fn (TypeChecker) rebuild_scoped_transform_signature_maps #
fn (mut tc TypeChecker) rebuild_scoped_transform_signature_maps()
rebuild_scoped_transform_signature_maps moves signature maps, keys, and nested type metadata into the current arena after a disposable transform scope has been left.
fn (TypeChecker) promote_scoped_declaration_visibility #
fn (mut tc TypeChecker) promote_scoped_declaration_visibility()
promote_scoped_declaration_visibility moves declaration ownership into the current arena before the scoped transform metadata is released.
fn (TypeChecker) begin_sparse_transform_node_caches #
fn (mut tc TypeChecker) begin_sparse_transform_node_caches(base_nodes int)
begin_sparse_transform_node_caches keeps source-node entries in their dense checked arrays and records transform-created node metadata sparsely.
fn (TypeChecker) promote_scoped_transform_interners #
fn (mut tc TypeChecker) promote_scoped_transform_interners(type_start int, symbol_start int, scope voidptr)
promote_scoped_transform_interners moves additions made by a scoped transform into the current compilation arena before that scope is freed.
fn (TypeChecker) push_scope #
fn (mut tc TypeChecker) push_scope()
push_scope updates push scope state for TypeChecker.
fn (TypeChecker) pop_scope #
fn (mut tc TypeChecker) pop_scope()
pop_scope updates pop scope state for TypeChecker.
fn (TypeChecker) record_cgen_error_at #
fn (mut tc TypeChecker) record_cgen_error_at(msg string, node flat.NodeId, source_id flat.NodeId, marker string)
record_cgen_error_at records a post-transform validation error with cgen severity.
fn (TypeChecker) record_transform_alloc_warning #
fn (mut tc TypeChecker) record_transform_alloc_warning(id flat.NodeId, pos token.Pos, description string)
record_transform_alloc_warning reports an allocation the transform adds where the source shows none, such as a local moved to the heap because its address escapes. Only project code is reported. The transform has already left out assignments marked @[freed]: the node may be one it made, which has no parents here to look for the attribute on.
fn (TypeChecker) record_transform_error #
fn (mut tc TypeChecker) record_transform_error(id flat.NodeId, pos token.Pos, msg string)
record_transform_error reports an error that the transform finds after checking, such as a $if in a $for body whose condition cannot be decided. It is not limited to the project's own files: the transform only lowers code the program uses, and leaving it out would compile a library wrong.
fn (TypeChecker) collect #
fn (mut tc TypeChecker) collect(a &flat.FlatAst)
collect indexes source declarations and resolves their types before body checking.
fn (TypeChecker) rebind_ast #
fn (mut tc TypeChecker) rebind_ast(a &flat.FlatAst)
rebind_ast updates the AST view after the driver clones transformed storage. All collected declaration/type metadata remains valid because cloning preserves node ids.
fn (TypeChecker) shadowed_builtin_const_key #
fn (tc &TypeChecker) shadowed_builtin_const_key(name string) ?string
shadowed_builtin_const_key returns the key of the builtin const name, when the current module is builtin and a main const of the same name holds the bare key.
fn (TypeChecker) shadowed_builtin_const_key_in_module #
fn (tc &TypeChecker) shadowed_builtin_const_key_in_module(name string, module_name string) ?string
shadowed_builtin_const_key_in_module is shadowed_builtin_const_key for code in module_name. Only main code sees the main const under the bare key, so the code of every other module gets the builtin const.
fn (TypeChecker) bare_const_key_is_visible_in_module #
fn (tc &TypeChecker) bare_const_key_is_visible_in_module(key string, module_name string) bool
bare_const_key_is_visible_in_module reports whether code in module_name sees the const with the bare key key unqualified. The consts of main and builtin share bare keys (see const_decl_key); the main ones are main's own, so other modules do not see them, as V 0.5.2 reports undefined ident for them. A qualified key is always visible.
fn (TypeChecker) selector_const_type #
fn (tc &TypeChecker) selector_const_type(node flat.Node) ?Type
selector_const_type returns the declared type for a selector const expression.
fn (TypeChecker) selector_value_type #
fn (tc &TypeChecker) selector_value_type(node flat.Node) ?Type
selector_value_type returns the declared type for a selector value expression.
fn (TypeChecker) const_owner_module #
fn (tc &TypeChecker) const_owner_module(name string) string
const_owner_module returns the declaration module for a checker-resolved constant key.
fn (TypeChecker) qualify_fn_name #
fn (tc &TypeChecker) qualify_fn_name(name string) string
qualify_fn_name supports qualify fn name handling for TypeChecker.
fn (TypeChecker) ownership_time_spent_us #
fn (tc &TypeChecker) ownership_time_spent_us() i64
ownership_time_spent_us reports the accumulated ownership-analysis time for the dedicated benchmark stage. Compiled-out ownership (no -d ownership) cannot spend time, so this returns 0 by construction in plain builds.
fn (TypeChecker) qualify_name #
fn (tc &TypeChecker) qualify_name(name string) string
qualify_name resolves a name to its module-qualified form in the current checker context.
fn (TypeChecker) qualify_type_name #
fn (tc &TypeChecker) qualify_type_name(name_id u32) u32
qualify_type_name resolves a source spelling ID in the current file, module, and resolution context. Its cache is shared with qualify_name; spelling IDs remain distinct from checker-local semantic TypeId values.
fn (TypeChecker) parse_resolution_type #
fn (tc &TypeChecker) parse_resolution_type(source_id u32) Type
parse_resolution_type parses type text that can mix declaration-local names with concrete generic arguments from another module.
fn (TypeChecker) parse_resolution_type_in_file #
fn (tc &TypeChecker) parse_resolution_type_in_file(source_id u32, file string) Type
parse_resolution_type_in_file resolves type text using the imports and module of file without mutating the checker's current traversal cursor.
fn (TypeChecker) reset_resolution_type_view_cache #
fn (mut tc TypeChecker) reset_resolution_type_view_cache()
reset_resolution_type_view_cache discards lookup views that may have been created inside a completed scoped parallel phase.
fn (TypeChecker) disable_resolution_type_view_cache #
fn (mut tc TypeChecker) disable_resolution_type_view_cache()
disable_resolution_type_view_cache prevents a scoped cache from escaping the phase that allocated it.
fn (TypeChecker) resolve_any_selective_import_fn #
fn (tc &TypeChecker) resolve_any_selective_import_fn(name string) ?string
resolve_any_selective_import_fn resolves an unqualified selected function when every source file that selects the name agrees on the same declaration.
fn (TypeChecker) file_selective_import_ids #
fn (tc &TypeChecker) file_selective_import_ids(file string, name_id u32) ?[]u32
file_selective_import_ids returns the spelling IDs of the declarations that file can name with the selected name_id; an empty list marks an ambiguous selection.
fn (TypeChecker) file_selective_import_ids_by_name #
fn (tc &TypeChecker) file_selective_import_ids_by_name(file string, name string) ?[]u32
file_selective_import_ids_by_name is file_selective_import_ids for symbol text from the AST.
fn (TypeChecker) register_generated_fn_return_type #
fn (mut tc TypeChecker) register_generated_fn_return_type(name string, ret Type)
register_generated_fn_return_type records a return signature and invalidates its transform memos.
fn (TypeChecker) unregister_generated_fn_return_type #
fn (mut tc TypeChecker) unregister_generated_fn_return_type(name string)
unregister_generated_fn_return_type removes a return signature and invalidates its transform memos.
fn (TypeChecker) register_generated_fn_param_types #
fn (mut tc TypeChecker) register_generated_fn_param_types(name string, params []Type)
register_generated_fn_param_types records a synthesized function signature and keeps the receiver/method suffix index complete for post-check phases.
fn (TypeChecker) rebuild_fn_param_suffix_index #
fn (mut tc TypeChecker) rebuild_fn_param_suffix_index()
rebuild_fn_param_suffix_index refreshes the suffix index after a batch replaces or removes synthesized signatures.
fn (TypeChecker) annotate_types #
fn (mut tc TypeChecker) annotate_types()
annotate_types performs a scope-aware walk over every function body, tracking local variable types as they are declared, and records complex/contextual expression types. This mirrors what the v2 transformer relies on: the type checker runs BEFORE the transformer and publishes per-expression types, so the transformer can own type-dependent lowering (string ops, in membership, ...) instead of the backend.
It uses a single flat scope per function (an over-approximation: a local stays visible after its block ends), which is harmless for type lookup since variable names are effectively unique within a function.
fn (TypeChecker) annotate_types_with_used #
fn (mut tc TypeChecker) annotate_types_with_used(used_fns map[string]bool)
annotate_types_with_used annotates only functions that can be emitted when used_fns is non-empty. This mirrors transform/cgen pruning and avoids resolving types in dead, untransformed function bodies after markused.
fn (TypeChecker) annotate_types_with_used_missing_calls #
fn (mut tc TypeChecker) annotate_types_with_used_missing_calls(used_fns map[string]bool, source_node_count int)
annotate_types_with_used_missing_calls revisits only reachable functions containing calls whose checked binding was invalidated by lowering, plus functions synthesized after the source AST. Unchanged calls retain the binding recorded by semantic checking and copied by the transformer.
fn (TypeChecker) diagnose_unused_private_declarations #
fn (mut tc TypeChecker) diagnose_unused_private_declarations(used_fns map[string]bool)
diagnose_unused_private_declarations reports private declarations that are not reachable from used code.
fn (TypeChecker) diagnose_unused_library_private_declarations #
fn (mut tc TypeChecker) diagnose_unused_library_private_declarations() bool
diagnose_unused_library_private_declarations reports the unused private declarations of a library, a module checked on its own, as an editor checks a module that no program imports, and tells whether the check is one. Its public declarations are what other programs use, and what a private one serves cannot be told without a program: one that is named at all counts as used, as one exported to C or kept with @[markused] does.
fn (TypeChecker) diagnose_unused_private_declarations_with_errors #
fn (mut tc TypeChecker) diagnose_unused_private_declarations_with_errors()
diagnose_unused_private_declarations_with_errors reports, in a program with errors, the private functions and constants that nothing names. What is reachable cannot be told there: a call the checker could not resolve would leave its function looking unused. So a function that is called or named at all counts as used, and no notice is one that fixing the errors takes back.
fn (TypeChecker) used_fns_without_markused #
fn (mut tc TypeChecker) used_fns_without_markused() ?map[string]bool
used_fns_without_markused returns what a check can take as the used functions without running markused: the private functions that are never called but are named as values, such as callbacks. It returns none when a private function is not named at all, since only markused can tell whether that one is used (an exported one is). A function named only by unused code counts as used here, where a build, which knows what is reachable, can report it.
fn (TypeChecker) diagnosed_files_declare_generics #
fn (mut tc TypeChecker) diagnosed_files_declare_generics() bool
diagnosed_files_declare_generics reports whether a file whose diagnostics are reported declares a generic function or method: only then can a concrete instance of the program's own code fail where the generic one did not.
fn (TypeChecker) diagnosed_files_call_library_generics #
fn (tc &TypeChecker) diagnosed_files_call_library_generics() bool
diagnosed_files_call_library_generics reports whether a function of a file whose diagnostics are reported calls a generic function that a file outside of them declares, as arrays.sum(foos) does: the check of the instances that the program asks for checks that instance too (see check_program_lib_instances).
fn (TypeChecker) diagnosed_fn_keys #
fn (mut tc TypeChecker) diagnosed_fn_keys() map[string]bool
diagnosed_fn_keys returns every name that a function of a diagnosed file goes by in a set of used functions. A check monomorphizes from them alone: walking the rest of the program to find what is reachable would check the library bodies that the diagnostics server leaves out.
fn (TypeChecker) check_main_module_requirement #
fn (mut tc TypeChecker) check_main_module_requirement(is_shared bool)
check_main_module_requirement rejects ordinary programs that contain no selected source file in the main module.
fn (TypeChecker) iterator_for_in_elem_type #
fn (tc &TypeChecker) iterator_for_in_elem_type(typ Type) ?Type
iterator_for_in_elem_type returns the element type yielded by an iterator-style for in value.
fn (TypeChecker) iterator_for_in_next_call_info #
fn (tc &TypeChecker) iterator_for_in_next_call_info(typ Type) ?CallInfo
iterator_for_in_next_call_info returns call metadata for a compatible iterator next method, including visible methods on C structs declared in directly imported modules.
fn (TypeChecker) iterator_for_in_next_call_info_text #
fn (tc &TypeChecker) iterator_for_in_next_call_info_text(type_text_id u32) ?CallInfo
iterator_for_in_next_call_info_text returns specialized next call metadata for a source spelling ID.
fn (TypeChecker) index_overload_call_info #
fn (tc &TypeChecker) index_overload_call_info(typ Type, setter bool) ?CallInfo
index_overload_call_info returns call metadata for the [] or []= overload of typ.
fn (TypeChecker) expr_type #
fn (tc &TypeChecker) expr_type(id flat.NodeId) ?Type
expr_type returns the resolved type recorded for a node during annotate_types.
fn (TypeChecker) expr_type_reference #
fn (tc &TypeChecker) expr_type_reference(id flat.NodeId) ?&Type
expr_type_reference returns a stable reference to the recorded expression type. It follows expr_type's call resolution and cache visibility; dense values keep their canonical pointers, while sparse map values receive independent wrappers.
fn (TypeChecker) invalidate_checked_expr_type #
fn (tc &TypeChecker) invalidate_checked_expr_type(idx int)
cached_expr_type supports cached expr type handling for TypeChecker. invalidate_checked_expr_type drops the cached checked type for one node the transformer rewrote in place, so a trust_checked_expr_types resolve cannot return the pre-rewrite type (see resolve_type). Rewrites target ids inside the writer's own disjoint region, so the shared dense flag array sees no concurrent writes to the same slot.
fn (TypeChecker) resolved_call_name #
fn (tc &TypeChecker) resolved_call_name(id flat.NodeId) ?string
resolved_call_name returns the checker-resolved function name for a call node.
fn (TypeChecker) resolved_call_may_store_globally #
fn (tc &TypeChecker) resolved_call_may_store_globally(id flat.NodeId) bool
resolved_call_may_store_globally reports whether the resolved callee or one of its transitive callees belongs to a source file annotated with @[has_globals] or @[translated].
fn (TypeChecker) fn_value_may_store_globally #
fn (tc &TypeChecker) fn_value_may_store_globally(id flat.NodeId) bool
fn_value_may_store_globally reports whether invoking a function value can reach a declaration from a source file annotated with @[has_globals] or @[translated]. An unresolved function value is conservative because its body is opaque at this call site.
fn (TypeChecker) resolved_call_is_builtin #
fn (tc &TypeChecker) resolved_call_is_builtin(id flat.NodeId, name string) bool
resolved_call_is_builtin reports whether id resolved to the named builtin function.
fn (TypeChecker) reset_resolved_calls_for_reannotation #
fn (mut tc TypeChecker) reset_resolved_calls_for_reannotation()
reset_resolved_calls_for_reannotation discards pre-transform call-name bindings before the transformed AST is annotated again. The annotation walk resolves and records every reachable call against the final AST/signatures.
fn (TypeChecker) fn_param_types_for_name #
fn (tc &TypeChecker) fn_param_types_for_name(name string) []Type
fn_param_types_for_name returns the collected parameter types for a resolved call name.
fn (TypeChecker) resolved_call_never_returns #
fn (tc &TypeChecker) resolved_call_never_returns(id flat.NodeId) bool
resolved_call_never_returns reports whether a call node resolved to a known no-return function.
fn (TypeChecker) resolved_fn_value_name #
fn (tc &TypeChecker) resolved_fn_value_name(id flat.NodeId) ?string
resolved_fn_value_name returns the checker-resolved function name for a function value node.
fn (TypeChecker) set_resolved_fn_value #
fn (mut tc TypeChecker) set_resolved_fn_value(idx int, name string)
set_resolved_fn_value records the resolved function-value target of a node. A transform fork keeps the write private (its snapshot of the parent stays read-only) until the merge replays it.
fn (TypeChecker) clear_resolved_fn_value #
fn (mut tc TypeChecker) clear_resolved_fn_value(id flat.NodeId)
clear_resolved_fn_value removes stale function-value metadata after a later transform proves that an identifier refers to a value declaration. A transform fork records a tombstone in its private writes instead, so the snapshot entry stays hidden and the merge replays the clear.
fn (TypeChecker) fn_value_snapshot #
fn (tc &TypeChecker) fn_value_snapshot() map[int]string
fn_value_snapshot returns this checker's effective source-node fn-value entries: the shared store, with a transform fork's own writes and tombstones applied. New forks read from such a snapshot.
fn (TypeChecker) fork_fn_value_replays_source #
fn (tc &TypeChecker) fork_fn_value_replays_source(idx int) bool
fork_fn_value_replays_source reports whether a transform fork's private fn-value write at idx must be replayed into its parent on merge: only source nodes below the overlay boundary keep their ids. Transform-created nodes are published through the overlay under shifted ids; an unbounded overlay keeps every write private.
fn (TypeChecker) apply_forked_fn_value #
fn (mut tc TypeChecker) apply_forked_fn_value(idx int, name string)
apply_forked_fn_value replays one source-node fn-value write from a transform fork: an empty name is a tombstone (the fork cleared the entry), anything else replaces the entry. name must already be owned by an arena that outlives this checker.
fn (TypeChecker) direct_dependency_ids #
fn (tc &TypeChecker) direct_dependency_ids(fn_node_id int) []SymbolId
direct_dependency_ids returns the checker-resolved function dependency identities of a function declaration node. The slice is read-only.
fn (TypeChecker) direct_dependencies #
fn (tc &TypeChecker) direct_dependencies(fn_node_id int) []string
direct_dependencies returns canonical dependency names for compatibility.
fn (TypeChecker) symbol_name #
fn (tc &TypeChecker) symbol_name(id SymbolId) string
symbol_name resolves a checker symbol identity to its canonical name.
fn (TypeChecker) frozen_symbol_name #
fn (tc &TypeChecker) frozen_symbol_name(id SymbolId) string
frozen_symbol_name resolves an id after semantic checking has frozen the compilation's symbol table. Post-check reachability runs concurrently only with read-only transform preparation, so it does not need the interner lock.
fn (TypeChecker) lookup_canonical_symbol_unlocked #
fn (tc &TypeChecker) lookup_canonical_symbol_unlocked(name string) ?string
lookup_canonical_symbol_unlocked returns the canonical spelling of an already interned name without taking the interner lock. It is only valid while no thread interns, e.g. across a pool phase that only reads the symbol table.
fn (TypeChecker) canonical_symbol #
fn (tc &TypeChecker) canonical_symbol(name string) string
canonical_symbol returns the compilation-owned canonical spelling of name.
fn (TypeChecker) symbol_count #
fn (tc &TypeChecker) symbol_count() int
symbol_count returns the number of resolved names interned by the checker.
fn (TypeChecker) copy_cloned_resolution #
fn (mut tc TypeChecker) copy_cloned_resolution(src_id flat.NodeId, dst_id flat.NodeId)
copy_cloned_resolution copies checker-owned call/function-value resolution metadata from an original node to a transform-created clone.
fn (TypeChecker) remember_method_value_call #
fn (mut tc TypeChecker) remember_method_value_call(id flat.NodeId, name string)
remember_method_value_call records that the method value id names the function name: the transform names so the instance of the generic method that h.first[int] names (see check_generic_method_value), which the value binds to its receiver.
fn (TypeChecker) register_synth_type #
fn (mut tc TypeChecker) register_synth_type(id flat.NodeId, typ Type)
register_synth_type records the type of a generated or transformed node.
fn (TypeChecker) check_semantics #
fn (mut tc TypeChecker) check_semantics()
check_semantics validates check semantics state for types.
fn (TypeChecker) is_veb_context_type #
fn (tc &TypeChecker) is_veb_context_type(typ &Type) bool
is_veb_context_type reports whether typ is veb.Context or embeds it.
fn (TypeChecker) declaration_has_attribute #
fn (tc &TypeChecker) declaration_has_attribute(node_id flat.NodeId, name string) bool
declaration_has_attribute reports whether a declaration has the named attribute.
fn (TypeChecker) autofree_enabled #
fn (tc &TypeChecker) autofree_enabled() bool
autofree_enabled reports whether compatibility autofree lowering is active.
fn (TypeChecker) struct_module_for_type #
fn (tc &TypeChecker) struct_module_for_type(name_id u32) string
struct_module_for_type returns the module that declared the named struct.
fn (TypeChecker) type_has_declaration_attribute #
fn (tc &TypeChecker) type_has_declaration_attribute(typ &Type, name string) bool
type_has_declaration_attribute reports whether the declaration of typ has an attribute named name.
fn (TypeChecker) fn_body_definitely_returns #
fn (tc &TypeChecker) fn_body_definitely_returns(node flat.Node) bool
fn_body_definitely_returns supports fn body definitely returns handling for TypeChecker.
fn (TypeChecker) module_declares_fn #
fn (tc &TypeChecker) module_declares_fn(module_name string, name string) bool
fn (TypeChecker) comptime_enum_decl_field_value #
fn (tc &TypeChecker) comptime_enum_decl_field_value(enum_name u32, field_name string) ?i64
comptime_enum_decl_field_value returns a field's value when its initializer is known in V.
fn (TypeChecker) comptime_enum_decl_field_values #
fn (tc &TypeChecker) comptime_enum_decl_field_values(enum_name u32) map[string]i64
comptime_enum_decl_field_values returns enum field values known in V, excluding C expressions.
fn (TypeChecker) comptime_enum_decl_first_value #
fn (tc &TypeChecker) comptime_enum_decl_first_value(enum_name u32) ?i64
comptime_enum_decl_first_value returns the value of an enum's first member, which is its default value, or 0 for an enum that has no members. It is none when V does not know that value, because it comes from C (a = C.FOO).
fn (TypeChecker) comptime_enum_call_value #
fn (tc &TypeChecker) comptime_enum_call_value(id flat.NodeId, enum_module string, enum_name u32, mut field_values map[string]i64, field_exprs map[string]flat.NodeId, mut resolving map[string]bool) ?i64
comptime_enum_call_value folds an enum helper using its checked declaration context. Arguments retain the enum initializer's source context.
fn (TypeChecker) check_interface_embedding_limits #
fn (mut tc TypeChecker) check_interface_embedding_limits() bool
check_interface_embedding_limits rejects deep interface casts before requirement indexes recursively expand the embedding chain.
fn (TypeChecker) sizeof_arg_is_type #
fn (tc &TypeChecker) sizeof_arg_is_type(node flat.Node) bool
sizeof_arg_is_type resolves the type candidate of an ambiguous sizeof argument.
fn (TypeChecker) sizeof_value_declaration #
fn (tc &TypeChecker) sizeof_value_declaration(name string) ?flat.NodeId
sizeof_value_declaration finds a qualified constant's initializer or value declaration.
fn (TypeChecker) sizeof_value_conditions #
fn (tc &TypeChecker) sizeof_value_conditions(declaration flat.NodeId) []string
sizeof_value_conditions returns the original branch guards for a value declaration.
fn (TypeChecker) prune_inactive_top_level_comptime #
fn (tc &TypeChecker) prune_inactive_top_level_comptime(mut a flat.FlatAst)
prune_inactive_top_level_comptime removes declarations and expressions from inactive top-level compile-time branches after semantic checking and before later compiler stages.
fn (TypeChecker) prepare_threads_condition #
fn (mut tc TypeChecker) prepare_threads_condition()
prepare_threads_condition caches whether selected inputs or their reachable imports use spawn.
fn (TypeChecker) threads_condition_value #
fn (tc &TypeChecker) threads_condition_value() bool
threads_condition_value reports the cached $if threads condition, scanning lazily for direct TypeChecker users that do not run the regular compiler setup.
fn (TypeChecker) type_text_implements_interface #
fn (mut tc TypeChecker) type_text_implements_interface(actual_id u32, iface_id u32) bool
type_text_implements_interface reports whether a concrete type expression satisfies an interface type expression in the current checker module context.
fn (TypeChecker) note_generated_parent #
fn (tc &TypeChecker) note_generated_parent(child flat.NodeId, parent flat.NodeId)
note_generated_parent seeds the worker-private parent cache for a freshly generated node whose only parent is parent, so parent queries on it skip the arena scan. An edge found by an earlier query is kept.
fn (TypeChecker) sql_orm_method_is_private #
fn (tc &TypeChecker) sql_orm_method_is_private(name string, file string, module_name string) bool
sql_orm_method_is_private applies ordinary declaration visibility in the SQL source context.
fn (TypeChecker) multi_expr_tail_types_for_transform #
fn (tc &TypeChecker) multi_expr_tail_types_for_transform(expr_id flat.NodeId, count int) ?[]Type
multi_expr_tail_types_for_transform returns promoted multi-expression tail types for transform lowering without duplicating checker compatibility rules.
fn (TypeChecker) generic_instance_satisfies_constraints #
fn (tc &TypeChecker) generic_instance_satisfies_constraints(decl flat.Node, names []u32, args_ids []u32) bool
record_generic_constraint_error reports that actual, the type argument of the type parameter param, does not satisfy its constraint. generic_instance_satisfies_constraints reports whether the concrete types args, given to the type parameters names of the generic function decl, satisfy their constraints. The call that asks for an instance that does not has an error of its own: the errors of the instance's body would repeat it.
fn (TypeChecker) infer_type_params_from_constraints #
fn (mut tc TypeChecker) infer_type_params_from_constraints(decl flat.Node, mut inferred map[u32]u32)
infer_type_params_from_constraints binds in inferred each type parameter of the generic function decl to a source-spelling ID when no call argument decides it, from the constraint of a bound one that names it: T of [C Container[T], T Named] is what Container[T] makes of the type of C, User for Box[User], whose get() returns a User.
fn (TypeChecker) infer_type_params_from_interface #
fn (mut tc TypeChecker) infer_type_params_from_interface(param_id u32, actual_id u32, names []u32, mut inferred map[u32]u32)
infer_type_params_from_interface binds in inferred the type parameters names to source-spelling IDs, as named by the generic interface param_text, Shelf[T], names and nothing bound yet, from actual_text, the type of what a call passes there: the types of its methods and fields against those of the members of the interface, User for a get() User against get() T.
fn (TypeChecker) skip_unreachable_library_bodies #
fn (mut tc TypeChecker) skip_unreachable_library_bodies(library_files map[string]bool, seeded_fns []string, follow_names bool) int
skip_unreachable_library_bodies leaves the bodies of the functions in library_files that the program cannot name unchecked, and returns how many library functions it can. seeded_fns are the functions that markused keeps without a call that leads to them. Without follow_names it leaves out every body that is not checked whatever the program names, except those that a generic body names, which leaves the others to check_reached_library_bodies: a test of that path.
fn (TypeChecker) skip_library_bodies_for_reachability #
fn (mut tc TypeChecker) skip_library_bodies_for_reachability(library_files map[string]bool, seeded_fns []string, follow_names bool) int
skip_library_bodies_for_reachability defers concrete implicit methods until the reachability frontier checks them, keeping generic and declaration roots intact.
fn (TypeChecker) skips_library_body_in_file #
fn (tc &TypeChecker) skips_library_body_in_file(node flat.Node, file string, module_name string) bool
skips_library_body_in_file reports the body-skipping policy in an explicit declaration context without changing the checker context used by reachability.
fn (TypeChecker) library_bodies_checked_late #
fn (tc &TypeChecker) library_bodies_checked_late() int
library_bodies_checked_late returns the number of bodies checked after the initial check, including both reachability frontiers and the convergence fallback.
fn (TypeChecker) skipped_library_bodies #
fn (mut tc TypeChecker) skipped_library_bodies() int
skipped_library_bodies returns how many bodies the check left out so far.
fn (TypeChecker) check_reached_library_bodies #
fn (mut tc TypeChecker) check_reached_library_bodies(used map[string]bool, parallel bool) int
check_reached_library_bodies checks the bodies that the check left out and that used, the functions that markused found since, names. It returns how many there were: their types can lead markused to more functions. parallel is what check_semantics_opt was asked for: a check that had to be serial stays so, and starts no worker.
fn (TypeChecker) reached_library_body_nodes #
fn (mut tc TypeChecker) reached_library_body_nodes(used map[string]bool) []int
reached_library_body_nodes returns still-unchecked declarations named by used, including ambiguous short names retained by the convergence check.
fn (TypeChecker) prepare_library_body_frontier #
fn (mut tc TypeChecker) prepare_library_body_frontier() &LibraryBodyFrontier
prepare_library_body_frontier records the bodies still unchecked after the initial semantic pass. Declaration order and work ranges come from the ordinary scanner.
fn (TypeChecker) check_library_body_frontier_nodes #
fn (mut tc TypeChecker) check_library_body_frontier_nodes(frontier &LibraryBodyFrontier, node_ids []int, parallel bool) ?int
check_library_body_frontier_nodes checks the named declarations in source order. A changed or incomplete snapshot returns none for the caller's ordinary fallback.
fn (TypeChecker) has_noalloc_contracts #
fn (tc &TypeChecker) has_noalloc_contracts() bool
has_noalloc_contracts reports whether allocation contracts need validation. Foreign declarations alone do not require walking the program.
fn (TypeChecker) check_noalloc_contracts #
fn (mut tc TypeChecker) check_noalloc_contracts(lowered bool, unsupported_modes string)
check_noalloc_contracts checks every annotated V function and its reachable callees. Source checks cover operations that lowering erases; the final pass also sees synthesized allocation sites. Unknown operations fail conservatively.
fn (TypeChecker) ownership_drop_entries_at_return #
fn (tc &TypeChecker) ownership_drop_entries_at_return(_ string, _ int) []OwnershipDropEntry
ownership_drop_entries_at_return returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_return_node #
fn (tc &TypeChecker) ownership_drop_entries_at_return_node(_ string, _ flat.NodeId) []OwnershipDropEntry
ownership_drop_entries_at_return_node returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_propagation #
fn (tc &TypeChecker) ownership_drop_entries_at_propagation(_ string, _ int) []OwnershipDropEntry
ownership_drop_entries_at_propagation returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_loop_control #
fn (tc &TypeChecker) ownership_drop_entries_at_loop_control(_ string, _ int) []OwnershipDropEntry
ownership_drop_entries_at_loop_control returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_loop_iteration #
fn (tc &TypeChecker) ownership_drop_entries_at_loop_iteration(_ string, _ int) []OwnershipDropEntry
ownership_drop_entries_at_loop_iteration returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_scope_exit #
fn (tc &TypeChecker) ownership_drop_entries_at_scope_exit(_ string, _ int) []OwnershipDropEntry
ownership_drop_entries_at_scope_exit returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_drop_entries_at_fn_exit #
fn (tc &TypeChecker) ownership_drop_entries_at_fn_exit(_ string) []OwnershipDropEntry
ownership_drop_entries_at_fn_exit returns no destructor entries when ownership checking is disabled.
fn (TypeChecker) ownership_fn_keeps_value_semantics #
fn (tc &TypeChecker) ownership_fn_keeps_value_semantics(_ flat.Node) bool
ownership_fn_keeps_value_semantics reports no library bodies when ownership checking is disabled.
fn (TypeChecker) ownership_drop_type_names #
fn (tc &TypeChecker) ownership_drop_type_names() []u32
ownership_drop_type_names returns no drop receiver source IDs when ownership checking is disabled.
fn (TypeChecker) ownership_drop_value_type_names_by_fn #
fn (tc &TypeChecker) ownership_drop_value_type_names_by_fn() map[string][]u32
ownership_drop_value_type_names_by_fn returns no per-function drop source IDs when ownership checking is disabled.
fn (TypeChecker) ownership_has_return_node #
fn (tc &TypeChecker) ownership_has_return_node(_ string, _ flat.NodeId) bool
ownership_has_return_node reports no recorded return-node cleanup when ownership checking is disabled.
fn (TypeChecker) ownership_type_requires_drop #
fn (tc &TypeChecker) ownership_type_requires_drop(_ Type) bool
ownership_type_requires_drop reports that no type requires ownership drop handling when ownership checking is disabled.
fn (TypeChecker) ownership_type_requires_destruction #
fn (tc &TypeChecker) ownership_type_requires_destruction(_ Type) bool
ownership_type_requires_destruction reports that no type requires ownership destruction when ownership checking is disabled.
fn (TypeChecker) ownership_expr_moves_storage #
fn (tc &TypeChecker) ownership_expr_moves_storage(_ flat.NodeId, _ flat.NodeId) bool
ownership_expr_moves_storage reports no storage moves when ownership checking is disabled.
fn (TypeChecker) ownership_expr_creates_owned_value #
fn (tc &TypeChecker) ownership_expr_creates_owned_value(_ flat.NodeId) bool
ownership_expr_creates_owned_value reports no owned-value creation when ownership checking is disabled.
fn (TypeChecker) ownership_index_read_moves_value #
fn (tc &TypeChecker) ownership_index_read_moves_value(_ flat.NodeId) bool
ownership_index_read_moves_value reports no moving index reads when ownership checking is disabled.
fn (TypeChecker) ownership_sum_read_moves_value #
fn (tc &TypeChecker) ownership_sum_read_moves_value(_ flat.NodeId) bool
ownership_sum_read_moves_value reports no consumed sum reads without ownership checking.
fn (TypeChecker) ownership_sum_drop_consumes_storage #
fn (tc &TypeChecker) ownership_sum_drop_consumes_storage(_ flat.NodeId) bool
ownership_sum_drop_consumes_storage reports no consumed sum owners without ownership checking.
fn (TypeChecker) ownership_receiver_alias_arg_is_cloned #
fn (tc &TypeChecker) ownership_receiver_alias_arg_is_cloned(_ flat.NodeId) bool
ownership_receiver_alias_arg_is_cloned reports no receiver clone metadata when ownership is disabled.
fn (TypeChecker) ownership_expr_is_borrowed_projection #
fn (tc &TypeChecker) ownership_expr_is_borrowed_projection(_ flat.NodeId) bool
ownership_expr_is_borrowed_projection reports no borrowed projections when ownership checking is disabled.
fn (TypeChecker) note_generated_borrowed_projection_copy #
fn (tc &TypeChecker) note_generated_borrowed_projection_copy(_ flat.NodeId, _ flat.NodeId)
note_generated_borrowed_projection_copy needs no clone metadata without ownership checking.
fn (TypeChecker) ownership_expr_clones_borrowed_storage #
fn (tc &TypeChecker) ownership_expr_clones_borrowed_storage(_ flat.NodeId) bool
ownership_expr_clones_borrowed_storage reports no clone metadata when ownership is disabled.
fn (TypeChecker) ownership_guard_read_moves_value #
fn (tc &TypeChecker) ownership_guard_read_moves_value(_ flat.NodeId) bool
ownership_guard_read_moves_value reports no moving guard reads when ownership checking is disabled.
fn (TypeChecker) ownership_assignment_reinitializes_moved_value #
fn (tc &TypeChecker) ownership_assignment_reinitializes_moved_value(_ flat.NodeId) bool
ownership_assignment_reinitializes_moved_value reports no moved-value reinitialization when ownership checking is disabled.
fn (TypeChecker) ownership_fn_value_returns_owned #
fn (tc &TypeChecker) ownership_fn_value_returns_owned(_ flat.NodeId, _ string, _ string) bool
ownership_fn_value_returns_owned reports no owned function-value returns when ownership checking is disabled.
fn (TypeChecker) ownership_call_result_source_args #
fn (mut tc TypeChecker) ownership_call_result_source_args(_ flat.NodeId) []flat.NodeId
ownership_call_result_source_args is empty when ownership analysis is disabled.
fn (TypeChecker) ownership_call_result_sources #
fn (mut tc TypeChecker) ownership_call_result_sources(_ flat.NodeId) []OwnershipCallResultSource
ownership_call_result_sources is empty when ownership analysis is disabled.
fn (TypeChecker) ownership_default_clone_missing_method #
fn (tc &TypeChecker) ownership_default_clone_missing_method(_ Type) ?string
ownership_default_clone_missing_method reports no missing clone method when ownership checking is disabled.
fn (TypeChecker) inherit_ownership_codegen_metadata_from #
fn (mut tc TypeChecker) inherit_ownership_codegen_metadata_from(_ &TypeChecker)
inherit_ownership_codegen_metadata_from is a no-op when ownership checking is disabled.
fn (TypeChecker) ownership_sum_return_sources #
fn (tc &TypeChecker) ownership_sum_return_sources(_ string, _ flat.NodeId) []OwnershipDropEntry
ownership_sum_return_sources returns no transfer sources when ownership checking is disabled.
fn (TypeChecker) ownership_sum_transfer_source #
fn (tc &TypeChecker) ownership_sum_transfer_source(_ flat.NodeId) string
ownership_sum_transfer_source returns no source when ownership checking is disabled.
fn (TypeChecker) ownership_sum_heap_sources #
fn (tc &TypeChecker) ownership_sum_heap_sources(_ string) []OwnershipDropEntry
ownership_sum_heap_sources returns no promoted sum sources when ownership checking is disabled.
fn (TypeChecker) check_semantics_opt #
fn (mut tc TypeChecker) check_semantics_opt(want_parallel bool) bool
check_semantics_opt runs semantic checks, using worker threads for independent function bodies when requested and there is enough work.
fn (TypeChecker) check_semantics_selected #
fn (mut tc TypeChecker) check_semantics_selected(selected map[string]bool)
check_semantics_selected validates declarations and only the named function bodies. It is used by the function-level incremental compiler after it has proven that every top-level declaration is unchanged.
fn (TypeChecker) check_semantics_reachable #
fn (mut tc TypeChecker) check_semantics_reachable(selected map[string]bool)
check_semantics_reachable validates only selected function declarations and bodies, plus top-level statements in the selected input. It is intended for source shapes that have already proven they cannot declare any other items.
fn (TypeChecker) check_concrete_fn_semantics #
fn (mut tc TypeChecker) check_concrete_fn_semantics(fn_idx int, file string, module_name string)
check_concrete_fn_semantics validates a concrete generic function clone before the transformer lowers its body. The clone retains source positions, so errors use the normal checker renderer instead of positionless transform diagnostics.
fn (TypeChecker) check_concrete_instance_members #
fn (mut tc TypeChecker) check_concrete_instance_members(fn_idx int, file string, module_name string, args []u32)
check_concrete_instance_members checks a concrete clone of one of the program's generic functions for what only its concrete types decide: a field, a method or an operator that such a type lacks, as when show(1) reads x.name or add(1) adds a string to a, a returned name or field of another type than the function returns, as when is_set(1) returns x from a fn is_set[T](x T) bool, a passed name or field of another type than its parameter, as when label(mut app) passes a bool app.flag to a string (see call_arg_is_judged_in_clone), an array or map whose elements are stored differently from the one it is used or cast as, as when to_bytes([1, 2]) returns []u8(a) for an a []int (see is_container_layout_error), and an if x := a guard whose a is declared neither as an option nor as a result, as when h(User{}) guards its a T (see is_concrete_if_guard_error). Every other error and warning of the clone is dropped: checked before the clone is lowered, only these are reliable outside checker fixtures, where many valid generic programs would fail. args are source-spelling IDs of the types of the instance: the clone spells an alias among them by its base type, and a member of the alias is none of its base (see member_of_an_alias_argument).
fn (TypeChecker) expr_subtree_has_node_error #
fn (tc &TypeChecker) expr_subtree_has_node_error(id flat.NodeId) bool
expr_subtree_has_node_error reports errors attached to an expression's node IDs. Source positions alone cannot distinguish separate generic instantiations.
fn (TypeChecker) prepare_collect #
fn (mut tc TypeChecker) prepare_collect(a &flat.FlatAst) bool
prepare_collect collects a, the code parsed so far, and keeps what collect_continue needs to collect the code parsed after it. False when the prepared code has diagnostics of its own: a check reports those in order.
fn (TypeChecker) collect_continue #
fn (mut tc TypeChecker) collect_continue(a &flat.FlatAst) bool
collect_continue collects the code parsed after prepare_collect, as collect collects the whole program in logical_file_order. It returns false, and changes nothing, when that code shares a key with the prepared code whose entry the order of collection decides: the program is then collected anew.
fn (TypeChecker) can_continue_collect #
fn (tc &TypeChecker) can_continue_collect(a &flat.FlatAst, logical_file_order []int) bool
can_continue_collect reports whether collect_continue can collect a after the prepared declarations, the files taken in logical_file_order.
fn (TypeChecker) continue_collect_conflict #
fn (tc &TypeChecker) continue_collect_conflict(a &flat.FlatAst, logical_file_order []int) string
continue_collect_conflict returns why collect_continue cannot collect a after the prepared declarations, or ''.
fn (TypeChecker) smartcast_type_name #
fn (tc &TypeChecker) smartcast_type_name(id flat.NodeId) u32
smartcast_type_name returns the source spelling ID of the type id was narrowed to by an enclosing is (or != none) check, or zero when the expression is not smartcast. The transform lowers comparisons after checking, and has to see the same narrowed type the checker validated the expression with: an index or selector node keeps its declared type, so without this a smartcast sum type operand would still be compared with the sum type's equality helper.
fn (TypeChecker) assignment_keeps_narrowing #
fn (tc &TypeChecker) assignment_keeps_narrowing(op flat.Op, lhs_id flat.NodeId, rhs_id flat.NodeId, narrowed Type) bool
assignment_keeps_narrowing reports whether the checked assignment lhs_id = rhs_id (operator op) leaves lhs_id, narrowed to narrowed, narrowed, as checking decided without its dynamic smartcast state. A sum type value keeps the narrowing when it is assigned a value of the narrowed variant: that value is recorded with the variant's type (see narrowed_sum_assignment_expected_type). The lexical smartcast queries and the transform use this to end a narrowing exactly where checking ended it.
fn (TypeChecker) expr_compatible #
fn (tc &TypeChecker) expr_compatible(expr_id flat.NodeId, actual &Type, expected &Type) bool
expr_compatible checks value-slot compatibility, including source-specific rules such as numeric conversions in translated C files.
fn (TypeChecker) c_type_cast_name_known #
fn (tc &TypeChecker) c_type_cast_name_known(name_id u32) bool
c_type_cast_name_known reports whether a C call spelling names an alias or an opaque type referenced by a C declaration, rather than a C function.
fn (TypeChecker) array_accessor_result_is_borrowed #
fn (tc &TypeChecker) array_accessor_result_is_borrowed(id flat.NodeId) bool
array_accessor_result_is_borrowed reports whether a first()/last() call result is consumed as a borrow — read through a chain of field selectors whose final value either does not own heap data (arr.last().size, arr.last().name.len) or is consumed by a comparison/index operation that produces a scalar (arr.last().name == 'x', arr.last().name[0]) or an allocating string consumer ('<${arr.last().name}>') — rather than escaping as an independent value. Such a read keeps the element owned by the array, so the accessor needs no clone() and the transformer can lower it to an in-place arr[..] access. Allocating/comparison consumers also require sibling expressions that cannot mutate the source before consumption. Two shapes are excluded so copying semantics are kept instead:
- a bound method value (
arr.last().method) — closure generation shallow-copies the receiver, so a borrowed element would share heap fields with the array; - a chain whose final value itself owns heap data (
arr.last().name, wherenameis a string) — a borrowed alias of that field could outlive the array element's storage. The transformer calls this too, so the two stay in lock-step.
fn (TypeChecker) comparison_calls_operator_method #
fn (tc &TypeChecker) comparison_calls_operator_method(typ &Type, op flat.Op) bool
comparison_calls_operator_method reports whether comparing values of typ with op calls a user defined operator method, also for their fields, elements or variants.
fn (TypeChecker) check_specialized_fn_global_shadowing #
fn (mut tc TypeChecker) check_specialized_fn_global_shadowing()
check_specialized_fn_global_shadowing inspects the concrete generic bodies after monomorphization has selected specialization-dependent $if branches.
fn (TypeChecker) c_backed_alias_method_name #
fn (tc &TypeChecker) c_backed_alias_method_name(name string) bool
c_backed_alias_method_name reports whether a resolved method belongs to a V alias of a C struct.
fn (TypeChecker) report_receiver_type_arg_mismatch #
fn (mut tc TypeChecker) report_receiver_type_arg_mismatch(file string, call_pos token.Pos, method string, param string, receiver string, expected string, given string)
report_receiver_type_arg_mismatch records that the call at call_pos of the file file, of the method method on a receiver receiver, gives its type parameter param, which the method repeats from its receiver, the type given where the receiver makes it expected (see explicit_receiver_type_args): the monomorphization finds it in the concrete instances of a generic function. Only in a file that the check diagnoses, and once for a place, as each instance and each pass over it finds it again.
fn (TypeChecker) visible_c_fn_module #
fn (tc &TypeChecker) visible_c_fn_module(name string) ?string
visible_c_fn_module finds the declaration used for a C call in the current file.
fn (TypeChecker) call_param_storage_source_params #
fn (tc &TypeChecker) call_param_storage_source_params(id flat.NodeId, target_param_idx int) []int
call_param_storage_source_params returns parameters whose values a source function may assign into the mutable target parameter or one of its descendants.
fn (TypeChecker) call_param_flows_to_callback #
fn (tc &TypeChecker) call_param_flows_to_callback(id flat.NodeId, callback_param_idx int, source_param_idx int) bool
call_param_flows_to_callback reports whether a resolved function passes one source parameter to an invocation of one of its function-valued parameters, including through resolved wrappers.
fn (TypeChecker) prepare_callback_param_flows #
fn (mut tc TypeChecker) prepare_callback_param_flows(used_fns map[string]bool)
prepare_callback_param_flows computes call_param_flows_to_callback for each function-valued parameter of every source function before transform runs. Transform lowers bodies in place, in parallel workers, so a later query can read a callee that is already lowered or being lowered: chosen := match c { true { callback } else { other } } then reads chosen := __match_val_1, and the flow from callback to chosen(value) is lost. Only functions in used_fns are summarized when it is not empty: the queries come from calls in reachable bodies. Queries for other pairs and functions, such as generic specializations created later, still walk the body.
fn (TypeChecker) fn_signature_type #
fn (tc &TypeChecker) fn_signature_type(name string, typ_id u32) Type
fn_signature_type resolves a raw function signature type in its declaration module.
fn (TypeChecker) infer_generic_reachability_type_args #
fn (tc &TypeChecker) infer_generic_reachability_type_args(fn_name string, param_id u32, actual Type, generic_params []u32) map[u32]u32
infer_generic_reachability_type_args infers generic arguments for a call whose checked type cache is unavailable to reachability analysis. Values are source-spelling IDs resolved in the declaration's type context.
fn (TypeChecker) call_binds_implicit_it #
fn (tc &TypeChecker) call_binds_implicit_it(call flat.Node) bool
call_binds_implicit_it reports whether the arguments of call see the implicit it of an array DSL call (arr.filter(it > 0)), as push_array_dsl_scope binds it: a filter, map, any, all or count call on an array receiver. A user-defined method with one of these names does not bind it.
fn (TypeChecker) is_locally_declared_bare_type #
fn (tc &TypeChecker) is_locally_declared_bare_type(name_id u32) bool
is_locally_declared_bare_type reports whether the bare name_id is a type declared in the current program (main module), which is bare-keyed in the type tables. Such a name denotes that local type, not an unqualified spelling of some other module's type.
fn (TypeChecker) translated_integer_literal_type #
fn (tc &TypeChecker) translated_integer_literal_type(id flat.NodeId) ?Type
translated_integer_literal_type returns the C type of an integer literal in a translated file: int, then unsigned int (nondecimal only), then a signed or unsigned 64-bit type.
fn (TypeChecker) translated_promoted_numeric_type #
fn (tc &TypeChecker) translated_promoted_numeric_type(typ Type) Type
translated_promoted_numeric_type applies C integral promotions in translated code.
fn (TypeChecker) translated_promoted_shift_type #
fn (tc &TypeChecker) translated_promoted_shift_type(typ Type) Type
translated_promoted_shift_type applies integral promotion using C's int width.
fn (TypeChecker) translated_common_numeric_type #
fn (tc &TypeChecker) translated_common_numeric_type(lhs Type, rhs Type) Type
translated_common_numeric_type selects the arithmetic type after C numeric promotions.
fn (TypeChecker) expr_is_method_value #
fn (tc &TypeChecker) expr_is_method_value(id flat.NodeId) bool
expr_is_method_value reports whether id is a selector that resolves to a method value — a struct/interface method used as a value (obj.draw), not a field access or a method call. cgen backs such values with per-instance closure contexts.
fn (TypeChecker) c_identifier_is_undeclared #
fn (tc &TypeChecker) c_identifier_is_undeclared(name string) bool
c_identifier_is_undeclared reports whether C.<name> is a C variable that V has no type for: it has no V declaration, and no checked use gave it one (see remember_inferred_c_global). Only a lower case name is a variable: the others are the macros and enum values of C, which V takes for integers.
fn (TypeChecker) index_operator_call_info #
fn (tc &TypeChecker) index_operator_call_info(base_type Type, op string) ?CallInfo
index_operator_call_info resolves a declared index operator for the receiver type.
fn (TypeChecker) refresh_transform_static_method_names #
fn (tc &TypeChecker) refresh_transform_static_method_names()
refresh_transform_static_method_names lists the methods of the static type method signatures registered so far, for the checkers forked from this one. Signatures are only added between two refreshes, so the list is current exactly while their count is unchanged; forget_transform_static_method_names covers a removal. The caller owns this checker: no other thread may be resolving through it.
fn (TypeChecker) refresh_transform_static_method_names_added #
fn (tc &TypeChecker) refresh_transform_static_method_names_added(added []string)
refresh_transform_static_method_names_added is refresh_transform_static_method_names given added, the signatures the caller registered since the last refresh: when they account for every new signature, only they are decoded.
fn (TypeChecker) forget_transform_static_method_names #
fn (tc &TypeChecker) forget_transform_static_method_names()
forget_transform_static_method_names drops the list: a signature was removed, or the arena holding the list is about to be released.
fn (TypeChecker) struct_field_c_abi_fn_ptr_type #
fn (tc &TypeChecker) struct_field_c_abi_fn_ptr_type(struct_name_id u32, field_name string) ?string
struct_field_c_abi_fn_ptr_type returns a field C ABI encoding using its owner spelling ID.
fn (TypeChecker) slot_value_compatible #
fn (tc &TypeChecker) slot_value_compatible(actual &Type, expected &Type) bool
type_compatible returns type compatible data for TypeChecker. slot_value_compatible exposes the checker's assignment-compatibility rule to the transform. The transform lowers value slots long after checking, and a generic specialization is the one case where it sees concrete types the checker never judged, so it has to ask the same question the checker would.
fn (TypeChecker) fn_param_compatible #
fn (tc &TypeChecker) fn_param_compatible(actual &Type, expected &Type) bool
fn_param_compatible compares parameter representations, preserving source-level integer distinctions.
fn (TypeChecker) fixed_array_len_value #
fn (tc &TypeChecker) fixed_array_len_value(arr ArrayFixed) ?int
fixed_array_len_value returns the evaluated fixed-array length when it can be resolved.
fn (TypeChecker) const_int_value #
fn (tc &TypeChecker) const_int_value(name string, seen []string) ?int
const_int_value supports const int value handling for TypeChecker.
fn (TypeChecker) const_int_value_in_module #
fn (tc &TypeChecker) const_int_value_in_module(name string, module_name string, seen []string) ?int
const_int_value_in_module supports const int value handling for a specific module.
fn (TypeChecker) interface_implements_interface #
fn (tc &TypeChecker) interface_implements_interface(actual_name_id u32, expected_name_id u32) bool
interface_implements_interface supports interface implements interface handling for TypeChecker.
fn (TypeChecker) interface_metadata_name #
fn (tc &TypeChecker) interface_metadata_name(name_id u32) u32
interface_metadata_name resolves a source spelling ID to the interface declaration spelling ID.
fn (TypeChecker) named_type_implements_interface #
fn (tc &TypeChecker) named_type_implements_interface(concrete_name_id u32, iface_name_id u32) bool
named_type_implements_interface supports helper handling in types.
fn (TypeChecker) type_has_implicit_str_method #
fn (tc &TypeChecker) type_has_implicit_str_method(name_id u32) bool
type_has_implicit_str_method reports whether a source spelling ID has an implicit string method.
fn (TypeChecker) named_type_implements_marker #
fn (tc &TypeChecker) named_type_implements_marker(concrete_name_id u32, target_id u32) bool
named_type_implements_marker checks the source type and marker spelling IDs.
fn (TypeChecker) interface_impl_names #
fn (tc &TypeChecker) interface_impl_names(iface_name_id u32) []u32
interface_impl_names returns source spelling IDs of concrete types (structs and aliases) that implement the interface spelling ID. Once a snapshot is frozen, its names stay first so transform-emitted interface IDs are preserved; later implementers are appended in deterministic discovery order.
fn (TypeChecker) pre_transform_interface_impl_names #
fn (tc &TypeChecker) pre_transform_interface_impl_names(iface_name_id u32) ?[]u32
pre_transform_interface_impl_names returns the immutable implementer snapshot prepared after semantic checking and before generic monomorphization.
fn (TypeChecker) interface_type_ids #
fn (tc &TypeChecker) interface_type_ids(iface_name_id u32) map[u32]int
interface_type_ids maps implementer spelling IDs to runtime _typ dispatch IDs, preserving any snapshot IDs emitted before late generic implementers were discovered.
fn (TypeChecker) freeze_interface_impl_names #
fn (mut tc TypeChecker) freeze_interface_impl_names()
freeze_interface_impl_names snapshots the interface implementation order used by transform-generated _typ checks before later metadata cleanup can remove unused generic declarations and shift cgen's ids.
fn (TypeChecker) freeze_pre_transform_interface_impl_names #
fn (mut tc TypeChecker) freeze_pre_transform_interface_impl_names()
freeze_pre_transform_interface_impl_names freezes the immutable implementer indexes prepared before transform. Transform does not add declarations; later generic implementers remain discoverable because the matching candidate set is frozen with the indexes.
fn (TypeChecker) interface_impl_set_signature #
fn (tc &TypeChecker) interface_impl_set_signature() string
interface_impl_set_signature returns the complete deterministic interface implementer set that controls collision-resolved dispatch IDs for the current program: a line name=impl,impl for every interface. The module cache keys the object of a module by the interfaces that the code of that module can reach, and needs two more facts for it, which follow as lines of their own: #module name=module for an interface or an implementer whose name has no module prefix (builtin and the program share that spelling), and #reach impl=name,name for the interfaces among the fields of an implementer.
fn (TypeChecker) interface_concrete_method_keys #
fn (tc &TypeChecker) interface_concrete_method_keys() []string
interface_concrete_method_keys returns generated interface dispatch methods and concrete method declarations that can be called by those dispatch functions.
fn (TypeChecker) runtime_type_index_names #
fn (tc &TypeChecker) runtime_type_index_names() []u32
runtime_type_index_names returns canonical program source spelling IDs for runtime interface/sum type_idx() lowering.
fn (TypeChecker) interface_accepts_implicit_str #
fn (tc &TypeChecker) interface_accepts_implicit_str(iface_name_id u32) bool
interface_accepts_implicit_str checks the str requirement of an interface spelling ID.
fn (TypeChecker) ierror_impl_names #
fn (tc &TypeChecker) ierror_impl_names() []u32
ierror_impl_names returns source spelling IDs of concrete structs that can be boxed as IError.
fn (TypeChecker) concrete_method_signature_key #
fn (tc &TypeChecker) concrete_method_signature_key(concrete_name_id u32, method string) ?string
concrete_method_signature_key finds a method declaration key for a source spelling ID.
fn (TypeChecker) concrete_generic_method_signature_candidates #
fn (tc &TypeChecker) concrete_generic_method_signature_candidates(concrete_name_id u32, method string) []string
concrete_generic_method_signature_candidates returns the registered spellings of a specialized method.
fn (TypeChecker) named_type_compatible_with_ierror #
fn (tc &TypeChecker) named_type_compatible_with_ierror(concrete_name_id u32) bool
named_type_compatible_with_ierror checks a source spelling ID against the IError requirements.
fn (TypeChecker) resolve_ierror_payload_name #
fn (tc &TypeChecker) resolve_ierror_payload_name(name_id u32) u32
resolve_ierror_payload_name resolves scoped Error/MessageError names before falling back to the builtin error structs.
fn (TypeChecker) precompute_source_error_embed_index #
fn (tc &TypeChecker) precompute_source_error_embed_index()
precompute_source_error_embed_index builds the immutable source-error embedding index once before parallel consumers fork their private memoization overlays.
fn (TypeChecker) qualify_type_name_at #
fn (tc &TypeChecker) qualify_type_name_at(name_id u32, id flat.NodeId, module_name string) u32
qualify_type_name_at resolves an interned bare type identifier in a source node's caller scope, preserving enclosing generic parameters and consulting only that file's selective imports.
fn (TypeChecker) specialize_generic_factory_return #
fn (tc &TypeChecker) specialize_generic_factory_return(return_type_id u32, name string, receiver_type_id u32, explicit_args_ids []u32) u32
specialize_generic_factory_return substitutes explicit method and receiver arguments in one pass, preserving caller parameters that share a declaration parameter's name.
fn (TypeChecker) resolve_imported_type_text_in_file #
fn (tc &TypeChecker) resolve_imported_type_text_in_file(typ_id u32, file string) u32
resolve_imported_type_text_in_file resolves a source spelling ID through the writing file imports.
fn (TypeChecker) prepare_interface_requirement_indexes #
fn (mut tc TypeChecker) prepare_interface_requirement_indexes()
prepare_interface_query_indexes publishes immutable interface requirements for transform workers. Interface declarations no longer change after semantic checking, so compatibility scans can reuse these lists safely across threads.
fn (TypeChecker) begin_interface_impl_queries #
fn (tc &TypeChecker) begin_interface_impl_queries() bool
begin_interface_impl_queries opens an InterfaceImplMemo for a caller's loop of implementer queries (interface_impl_names, interface_type_ids, ierror_impl_names) during which no declaration of the checker changes and its file and module stay the same. It returns false when one is open already; pass the result to end_interface_impl_queries.
fn (TypeChecker) end_interface_impl_queries #
fn (tc &TypeChecker) end_interface_impl_queries(opened bool)
end_interface_impl_queries closes the memo that begin_interface_impl_queries opened.
fn (TypeChecker) prepare_interface_query_indexes #
fn (mut tc TypeChecker) prepare_interface_query_indexes()
fn (TypeChecker) has_ierror_interface #
fn (tc &TypeChecker) has_ierror_interface() bool
has_ierror_interface reports whether the builtin IError interface is declared. It is absent with -no-builtin: option/result wrappers then carry no err field, and or {} blocks and if-guard else branches bind no implicit err.
fn (TypeChecker) interface_abstract_method_names #
fn (tc &TypeChecker) interface_abstract_method_names(iface_name_id u32) []string
interface_abstract_method_names returns the methods an implementer must provide: the interface's own declared (abstract) methods plus those of any embedded interfaces. Default methods defined directly on the interface are excluded.
fn (TypeChecker) interface_method_signature_key #
fn (tc &TypeChecker) interface_method_signature_key(iface_name_id u32, method string) ?string
interface_method_signature_key finds a method declaration key for an interface spelling ID.
fn (TypeChecker) interface_field_list #
fn (tc &TypeChecker) interface_field_list(iface_name_id u32) []StructField
interface_field_list supports interface field list handling for TypeChecker.
fn (TypeChecker) struct_fields_for_type #
fn (tc &TypeChecker) struct_fields_for_type(struct_name_id u32) []StructField
struct_fields_for_type returns fields for a source spelling ID, substituting concrete generics.
fn (TypeChecker) struct_field_type_name #
fn (tc &TypeChecker) struct_field_type_name(struct_name_id u32, field_name string) ?u32
struct_field_type_name returns the canonical type name for a struct field.
fn (TypeChecker) promoted_method_value_owner #
fn (tc &TypeChecker) promoted_method_value_owner(id flat.NodeId) ?u32
promoted_method_value_owner is promoted_method_owner for the receiver of the selector id, a method named without a call: Base for p.describe.
fn (TypeChecker) method_value_selector_type #
fn (tc &TypeChecker) method_value_selector_type(id flat.NodeId) ?Type
method_value_selector_type is the type of the selector id that names a method without a call, as selector_type gives it: fn () User for s.get with s Shelf[User], the method of an alias before the ones of its struct.
fn (TypeChecker) alias_method_value_receiver #
fn (tc &TypeChecker) alias_method_value_receiver(id flat.NodeId) ?u32
alias_method_value_receiver is the alias whose own method the selector id names without a call: Alias for a.describe with fn (a Alias) describe(), and none when the method is the one of the aliased type.
fn (TypeChecker) specialized_interface_method_signature #
fn (tc &TypeChecker) specialized_interface_method_signature(iface_name_id u32, expected_key string) ([]Type, Type)
specialized_interface_method_signature specializes a method for an interface spelling ID.
fn (TypeChecker) fn_type_callconv_compatible #
fn (tc &TypeChecker) fn_type_callconv_compatible(actual &Type, expected &Type) bool
fn_type_callconv_compatible checks calling conventions recursively for function types.
fn (TypeChecker) generic_type_name_matches #
fn (tc &TypeChecker) generic_type_name_matches(a_id u32, b_id u32) bool
generic_type_name_matches compares source spelling IDs inside the current resolution context.
fn (TypeChecker) sum_variant_type_for_pattern #
fn (tc &TypeChecker) sum_variant_type_for_pattern(sum_name_id u32, variant_name_id u32) ?u32
sum_variant_type_for_pattern resolves a sum pattern using source spelling IDs.
fn (TypeChecker) cached_c_name #
fn (tc &TypeChecker) cached_c_name(name string) string
cached_c_name memoizes naming.c_name results in the type cache (falling back to the frozen base cache read-only, like every other entry kind). c_name is pure and called on hot resolution paths in every phase.
fn (TypeChecker) parse_type #
fn (tc &TypeChecker) parse_type(source_id u32) &Type
parse_type resolves an interned source spelling in the current checker context.
fn (TypeChecker) parse_type_ref #
fn (tc &TypeChecker) parse_type_ref(text_id u32) &Type
parse_type_ref resolves a node annotation through its exact canonical text identity. Context remains part of the key because an unqualified spelling can denote different types in different files/modules.
fn (TypeChecker) parse_canonical_type_cached #
fn (tc &TypeChecker) parse_canonical_type_cached(source_id u32) &Type
parse_canonical_type_cached is parse_canonical_type memoized per parse context, like parse_type's own cache.
fn (TypeChecker) parse_canonical_type #
fn (tc &TypeChecker) parse_canonical_type(source_id u32) Type
parse_canonical_type parses compiler-produced type text while preserving an exact known qualified symbol before consulting the current file's import aliases. Source text must continue to use parse_type, where aliases take precedence; this entry point is for semantic names carried between phases.
fn (TypeChecker) intern_type_reference #
fn (tc &TypeChecker) intern_type_reference(t &Type) &Type
intern_type_reference returns the owned canonical reference for a semantic type.
fn (TypeChecker) type_count #
fn (tc &TypeChecker) type_count() int
type_count reports the number of unique canonical semantic types observed by this compilation.
fn (TypeChecker) type_name #
fn (tc &TypeChecker) type_name(t &Type) u32
type_name returns the interned canonical spelling of a semantic type. Composite spellings are constructed once and memoized by semantic identity.
fn (TypeChecker) type_cache_stats #
fn (tc &TypeChecker) type_cache_stats() TypeCacheStats
type_cache_stats returns cache counters accumulated by this checker.
fn (TypeChecker) resolve_inferred_type_id #
fn (tc &TypeChecker) resolve_inferred_type_id(type_id u32) u32
typeof(expr) annotations can infer array items and nested generic payloads. Resolve the expression before generic specialization records concrete names. resolve_inferred_type_id resolves the expression witnesses in a source type. Components stay interned through replacement and are composed only on change.
fn (TypeChecker) canonical_qualified_type_name #
fn (tc &TypeChecker) canonical_qualified_type_name(name_id u32) ?u32
canonical_qualified_type_name resolves a possibly bare or partially qualified type name (e.g. PoolProcessor or pool.PoolProcessor) to its unique fully qualified spelling ID (sync.pool.PoolProcessor). The input is a source spelling ID. It returns none when the name is unknown or when the short name is ambiguous across modules. Backends use this to rebuild method/type C names when a receiver type carries only the import-local module qualifier instead of the full module path.
fn (TypeChecker) invalidate_short_type_name_index #
fn (tc &TypeChecker) invalidate_short_type_name_index()
invalidate_short_type_name_index drops memoized type-name-derived indexes; callers that add or remove entries in the type-name maps after the checker ran (the monomorphizer specializing generic structs/sum types) must invalidate them.
fn (TypeChecker) register_short_type_name #
fn (tc &TypeChecker) register_short_type_name(name_id u32)
register_short_type_name extends an already-built short-name index with a source spelling ID after monomorphization adds a concrete type. A scoped transform copies the frozen index before extending its private entries.
fn (TypeChecker) unregister_short_type_name #
fn (tc &TypeChecker) unregister_short_type_name(name_id u32)
unregister_short_type_name removes an exact cached source spelling ID when a generic template is erased. Ambiguous entries stay conservative until the next compilation-wide index build.
fn (TypeChecker) c_abi_fn_ptr_type_for_type_text #
fn (tc &TypeChecker) c_abi_fn_ptr_type_for_type_text(typ_id u32) ?string
c_abi_fn_ptr_type_for_type_text returns the C ABI function-pointer encoding retained by a source function type or alias, including const_ pointer parameters.
fn (TypeChecker) arm_body_resolve_memo #
fn (tc &TypeChecker) arm_body_resolve_memo(lo int, hi int)
arm_body_resolve_memo (re)activates the per-item resolve memo for one work item's node range. The transformer arms it per lowered function exactly like the checker does per checked item; node-write helpers invalidate rewritten slots (see invalidate_checked_expr_type).
fn (TypeChecker) disarm_body_resolve_memo #
fn (tc &TypeChecker) disarm_body_resolve_memo()
disarm_body_resolve_memo deactivates the per-item resolve memo.
fn (TypeChecker) reset_body_resolve_memo #
fn (tc &TypeChecker) reset_body_resolve_memo()
reset_body_resolve_memo detaches the memo entirely. The transformer arms it inside a disposable stage arena, so the master checker must drop the pointer before that arena is released — later phases would otherwise dereference a freed allocation just to see that the memo is inactive.
fn (TypeChecker) resolve_type #
fn (tc &TypeChecker) resolve_type(id flat.NodeId) Type
resolve_type returns the type of an expression in the current checker context.
fn (TypeChecker) resolve_type_reference #
fn (tc &TypeChecker) resolve_type_reference(id flat.NodeId) &Type
resolve_type_reference returns the canonical reference for an expression's resolved type. It follows resolve_type's checked-cache visibility and mixed-integer widening. The reference remains valid while the owning checker arena is live.
fn (TypeChecker) c_type #
fn (tc &TypeChecker) c_type(t &Type) string
c_type returns the C representation of a semantic type.
fn (TypeChecker) resolve_generic_struct_method #
fn (tc &TypeChecker) resolve_generic_struct_method(type_name_id u32, method string) ?CallInfo
resolve_generic_struct_method resolves a method call on a generic-struct instance (e.g. Vec4[f32].r_sqrt). The method is registered against the generic form (Vec4[T].r_sqrt); this maps the instance's concrete type arguments onto the generic parameters and substitutes them into the method's signature, so the pre-transform checker accepts the call. The transformer's monomorphize pass later materialises the concrete method body.
fn (TypeChecker) resolve_generic_sum_method #
fn (tc &TypeChecker) resolve_generic_sum_method(type_name_id u32, method string) ?CallInfo
resolve_generic_sum_method looks up a method for a sum identified by its source spelling ID.
fn (TypeChecker) ownership_type_has_clone_method #
fn (tc &TypeChecker) ownership_type_has_clone_method(typ &Type) bool
ownership_type_has_clone_method reports whether typ declares a compatible handwritten clone method. It is kept in the always-built checker surface because ownership transform support is compiled into the V executable even when the executable itself is built without ownership.
fn (TypeChecker) suffix_indexed_method_fits_receiver #
fn (tc &TypeChecker) suffix_indexed_method_fits_receiver(receiver &Type, indexed string) bool
suffix_indexed_method_fits_receiver reports whether indexed, a method found through the short-name receiver_method_suffix_index, can belong to receiver. The index drops module prefixes, so a []toml.Any receiver also reaches json2.[]Any.str; a method of a same-named type from another module must not bind to it.
fn (TypeChecker) c_struct_operator_call_info #
fn (tc &TypeChecker) c_struct_operator_call_info(receiver Type, method string, file string, module_name string) ?CallInfo
c_struct_operator_call_info resolves a visible C receiver operator in its source context.
fn (TypeChecker) warn_unhandled_result_calls #
fn (mut tc TypeChecker) warn_unhandled_result_calls()
warn_unhandled_result_calls warns about the calls that return a Result whose error nothing handles, where the checker reports nothing else: a call made as a statement, the argument of a function that takes any type (as println), a part of a string interpolation, an element of an array literal, or a value assigned to _. The error is lost there: the program runs on, or prints the Result as if it were the value. ! at the end passes it on, and an or {} block handles it, as does if x := call() {.
fn (TypeChecker) start_incremental_check #
fn (mut tc TypeChecker) start_incremental_check(record string, own []string, verify bool, min_left_out int)
start_incremental_check has the check of a diagnostics server's child note what each body reports, for the next check of the program, and leave out the bodies whose regions record, what an earlier check noted, holds unchanged. own are the files the child parsed: those of the program, not those the server prepared for every child. With verify, a check of the bodies left out (see complete_incremental_check) compares what they report with what was put back. The check leaves out no body unless those it would leave out hold min_left_out nodes.
fn (TypeChecker) take_incremental_trace #
fn (mut tc TypeChecker) take_incremental_trace() []string
take_incremental_trace returns what an incremental check decided since it was last asked, a line for each decision.
fn (TypeChecker) put_back_incremental_unhandled #
fn (mut tc TypeChecker) put_back_incremental_unhandled() int
put_back_incremental_unhandled puts in tc.notices the warnings about unhandled Results of the bodies the check left out, which warn_unhandled_result_calls cannot find there without their types, and returns where its warnings start.
fn (TypeChecker) sort_incremental_unhandled #
fn (mut tc TypeChecker) sort_incremental_unhandled(start int)
sort_incremental_unhandled orders the warnings about unhandled Results from start on as warn_unhandled_result_calls finds them, by their calls: those put back come first.
fn (TypeChecker) complete_incremental_check #
fn (mut tc TypeChecker) complete_incremental_check()
complete_incremental_check checks the bodies the check left out, for what needs their types: markused, the instances of generic functions, and the questions of the editor. What they report was put back already: it is left out, and with verify, compared with what was put back.
fn (TypeChecker) complete_incremental_check_step #
fn (mut tc TypeChecker) complete_incremental_check_step(limit int) bool
complete_incremental_check_step checks up to limit more of the bodies the check left out (see complete_incremental_check), and reports whether some remain: a child of a diagnostics server checks them a few at a time while it waits for a question.
fn (TypeChecker) complete_incremental_check_for_instances #
fn (mut tc TypeChecker) complete_incremental_check_for_instances()
complete_incremental_check_for_instances checks, of the bodies the check left out, those that can ask for an instance of a generic function: the generic functions themselves, and the bodies whose last check found something generic in them (see incremental_touches_generics). The instances are found from the types of the bodies that ask for them; a body that touches nothing generic asks for none.
fn (TypeChecker) put_back_incremental_instances #
fn (mut tc TypeChecker) put_back_incremental_instances() bool
put_back_incremental_instances puts in tc.errors the errors that the check before found in the instances of the program's generic functions, and reports whether it did. The check of the instances begins here (see incremental_instances_record). A check that leaves out bodies has the instances of the check before when no body it checks is generic or touches anything generic, now or in its last check (see incremental_touches_generics): the declarations are the same, the generic bodies too, and so is every body that asks for an instance. The errors of the instances, in the regions of the generic bodies, move with them. With verify, the instances are checked all the same, and verify_incremental_instances compares what their check finds with what was put back.
fn (TypeChecker) verify_incremental_instances #
fn (mut tc TypeChecker) verify_incremental_instances()
verify_incremental_instances compares, with verify, the errors that the check of the instances found with those that put_back_incremental_instances was to put back, notes a difference in the trace, and leaves in tc.errors those put back: the check reports what putting them back gives.
fn (TypeChecker) incremental_record #
fn (tc &TypeChecker) incremental_record(unhandled_start int) string
incremental_record returns what the check found in each body, for the next incremental check of the program, or '' when it noted nothing (see incremental_select). unhandled_start is where the warnings of warn_unhandled_result_calls start in tc.notices.
fn (TypeChecker) incremental_instances_record #
fn (tc &TypeChecker) incremental_instances_record(record string) string
incremental_instances_record returns record, what incremental_record returned, with the errors of the instances of the program's generic functions, for the next check to put back (see put_back_incremental_instances): those in tc.errors since their check began, each in the region of the body it is in. It returns '' when their check did not begin, and when an error is in no region of a body.
fn (TypeChecker) semantic_type_id #
fn (tc &TypeChecker) semantic_type_id(value Type) ?TypeId
semantic_type_id interns a semantic value in this checker view's type table. The resulting identity must only be used with this view or a view sharing its table.
fn (TypeChecker) checked_expr_type_id #
fn (tc &TypeChecker) checked_expr_type_id(node flat.NodeId) ?TypeId
checked_expr_type_id returns the interned identity of a recorded expression type. The identity belongs to this checker view's interner; do not pass it to another view. It follows the visibility of checked node metadata, without resolving a new type.
fn (TypeChecker) type_by_id #
fn (tc &TypeChecker) type_by_id(id TypeId) ?Type
type_by_id returns the canonical semantic type for an identity in this checker view.
fn (TypeChecker) type_name_by_id #
fn (tc &TypeChecker) type_name_by_id(id TypeId) u32
type_name_by_id returns the source spelling ID of an interned semantic type.
fn (TypeChecker) c_type_by_id #
fn (tc &TypeChecker) c_type_by_id(id TypeId) ?string
c_type_by_id returns the C representation of an identity in this checker view. Cached representations are read by numeric identity without rehashing a Type value.
fn (TypeChecker) parse_type_id #
fn (tc &TypeChecker) parse_type_id(text u32) ?TypeId
parse_type_id resolves an interned source spelling to a semantic identity in this checker view. Source imports and generic bindings follow parse_type; builtin scalar IDs can be carried across source contexts without repeating contextual cache lookups.
fn (TypeChecker) named_variant_payload_type #
fn (tc &TypeChecker) named_variant_payload_type(variant_type_id u32) ?Type
named_variant_payload_type returns the payload type of a concrete hidden variant struct, or none for a payload-less variant.
fn (TypeChecker) type_index #
fn (tc &TypeChecker) type_index(name_id u32) int
type_index returns the runtime identity for an interned spelling, preserving pointer depth.
fn (TypeChecker) fn_type #
fn (tc &TypeChecker) fn_type(params []Type, result &Type, mutability []bool) FnType
fn_type creates a canonical signature with fixed arity.
fn (TypeChecker) variadic_fn_type #
fn (tc &TypeChecker) variadic_fn_type(params []Type, result &Type, mutability []bool, is_variadic bool) FnType
variadic_fn_type creates a canonical signature while preserving its variadic tail.
fn (TypeChecker) fn_type_for_name #
fn (tc &TypeChecker) fn_type_for_name(name string) ?FnType
fn_type_for_name returns the canonical declared signature, including parameter modes.
fn (TypeChecker) vls_answer #
fn (mut tc TypeChecker) vls_answer(q VlsQuery) string
vls_answer answers q from the checked program: the text a query prints, or '' when the position has nothing to say. It runs after the semantic check, errors or not, as the mini-VLS protocol expects an answer for code that is still being written.
struct TypeError #
struct TypeError {
pub:
msg string
kind TypeErrorKind
node flat.NodeId
file string
node_kind string
node_value string
node_pos string
pos token.Pos
details []string
severity string
diagnostic_order int
}
TypeError represents type error data used by types.
struct USize #
struct USize {
dummy_ u8
}
USize represents uint data used by types.
struct Unknown #
struct Unknown {
UnknownDataRef = empty_unknown_data
}
Unknown represents unknown data used by types.
fn (Unknown) == #
fn (a Unknown) == (b Unknown) bool
== compares Unknown payloads by value. Cast payload references to compare addresses before inspecting their fields.
struct UnknownData #
struct UnknownData {
pub:
// reason is the message text: why the type is unknown.
reason string
// placeholder is the spelling ID of the type parameter (`T`) that the unknown
// stands for, or 0. It is set where the unknown is made, from the name that
// its reason quotes, so nothing has to parse the name back out of `reason`.
placeholder u32
// generic marks the unknown of a generic placeholder, `T` or a qualified `mod.T`,
// that monomorphization can still make concrete.
generic bool
}
UnknownData stores the immutable fields of Unknown.
struct VlsQuery #
struct VlsQuery {
pub:
method VlsMethod
path string
line int // 1-based
col int // 0-based byte column, as VLS sends it
// The file or directory being checked, as the command line wrote it: the
// answers write the paths of its files the same way.
target string
}
VlsQuery is a parsed -line-info <file>:<line>:<code><column> request.
struct Void #
struct Void {
dummy_ u8
}
Void represents void data used by types.
- README
- Constants
- fn builtin_type
- fn builtin_type_index
- fn builtin_type_value
- fn builtin_type_value_id
- fn cached_name
- fn clone_owned_type
- fn clone_owned_types
- fn comptime_enum_integer_cast
- fn comptime_enum_integer_division
- fn comptime_enum_integer_literal
- fn comptime_enum_unsigned_right_shift
- fn defer_result_index
- fn extend_stable_type_indexes
- fn extend_stable_type_indexes_ref
- fn fn_compatible_param_type
- fn fn_param_modes_compatible
- fn generic_base_name
- fn generic_base_type_id
- fn generic_param_ids
- fn generic_param_texts
- fn implicit_integer_to_float_compatible
- fn is_builtin_type_name
- fn is_builtin_type_name_id
- fn is_module_cache_header
- fn mut_param_semantic_type
- fn named_variant_pattern_binding
- fn new_scope
- fn new_shadow_file_resolver
- fn new_type_reference
- fn parse_vls_line_info
- fn parse_vls_line_infos
- fn platform_int_bits
- fn platform_int_c_spelling
- fn promote_cached_name
- fn semantic_type_hash
- fn semantic_types_equal
- fn set_platform_int_bits
- fn set_portable_platform_int
- fn shadow_roots_own_file
- fn source_field_decl_is_volatile
- fn stable_interface_type_ids
- fn stable_interface_type_ids_preserving_prefix
- fn stable_type_index
- fn stable_type_indexes
- fn subst_generic_text
- fn type_text_contains_typeof
- fn unalias_type
- fn unsigned_shift_result_type
- fn unwrap_all_pointers
- fn unwrap_pointer
- fn AllocationLayout.from
- fn AllocationLayout.zero
- fn Properties.from
- fn Properties.zero
- fn TypeChecker.new
- fn TypeErrorKind.from
- fn VlsMethod.from
- type AliasDataRef
- type ArrayFixedDataRef
- type ChannelDataRef
- type FnTypeDataRef
- type MapDataRef
- type MultiReturnDataRef
- type SymbolId
- type Type
- type TypeCache
- type TypeId
- type UnknownDataRef
- enum AllocationLayout
- enum Properties
- enum TypeErrorKind
- enum VlsMethod
- struct Alias
- struct AliasData
- struct Array
- struct ArrayFixed
- struct ArrayFixedData
- struct CachedName
- struct CallInfo
- struct Channel
- struct ChannelData
- struct Char
- struct Enum
- struct FileImportInfo
- struct FnParam
- struct FnType
- struct FnTypeData
- struct ISize
- struct IncrementalCheck
- struct Interface
- struct InterfaceImplIndex
- struct LibraryBodyFrontier
- struct Map
- struct MapData
- struct MultiReturn
- struct MultiReturnData
- struct Nil
- struct None
- struct OptionType
- struct OwnershipCallResultSource
- struct OwnershipDropEntry
- struct Pointer
- struct PreparedCollect
- struct Primitive
- struct QualifyNameCache
- struct ResultType
- struct Rune
- struct Scope
- struct ScopeBindingOwner
- struct ShadowFileResolver
- struct String
- struct Struct
- struct StructField
- struct SumType
- struct TransformForkOverlay
- struct TypeCacheStats
- struct TypeChecker
- fn requires_aligned_allocation
- fn allocation_layout
- fn enable_scoped_parallel_workers
- fn scoped_parallel_workers_enabled
- fn reset_codegen_smartcasts
- fn fork_for_parallel_codegen
- fn fork_for_parallel_transform
- fn ensure_private_transform_signatures
- fn clone_transform_metadata_owned
- fn transform_signatures_changed
- fn discard_transform_signature_changes
- fn ensure_private_transform_structs
- fn freeze_type_cache_for_forks
- fn unfreeze_type_cache_after_forks
- fn discard_type_cache_overlay_after_forks
- fn set_fresh_type_cache
- fn reset_type_interners
- fn set_fresh_type_cache_based_on
- fn type_cache_parse_enabled
- fn clear_field_lookup_cache
- fn clear_c_type_cache
- fn clear_interface_impl_cache
- fn free_parallel_transform_caches
- fn refresh_direct_parent_index
- fn reuse_direct_parent_index_for_unchanged_ast
- fn invalidate_direct_parent_index
- fn refresh_rewritten_parent_index
- fn index_rewritten_parents_after
- fn declaration_param_mutability_for
- fn has_fn_decl_short_name
- fn reserve_transform_node_caches
- fn materialize_sparse_transform_node_caches
- fn reserve_scoped_transform_metadata
- fn rebuild_scoped_transform_signature_maps
- fn promote_scoped_declaration_visibility
- fn begin_sparse_transform_node_caches
- fn promote_scoped_transform_interners
- fn push_scope
- fn pop_scope
- fn record_cgen_error_at
- fn record_transform_alloc_warning
- fn record_transform_error
- fn collect
- fn rebind_ast
- fn shadowed_builtin_const_key
- fn shadowed_builtin_const_key_in_module
- fn bare_const_key_is_visible_in_module
- fn selector_const_type
- fn selector_value_type
- fn const_owner_module
- fn qualify_fn_name
- fn ownership_time_spent_us
- fn qualify_name
- fn qualify_type_name
- fn parse_resolution_type
- fn parse_resolution_type_in_file
- fn reset_resolution_type_view_cache
- fn disable_resolution_type_view_cache
- fn resolve_any_selective_import_fn
- fn file_selective_import_ids
- fn file_selective_import_ids_by_name
- fn register_generated_fn_return_type
- fn unregister_generated_fn_return_type
- fn register_generated_fn_param_types
- fn rebuild_fn_param_suffix_index
- fn annotate_types
- fn annotate_types_with_used
- fn annotate_types_with_used_missing_calls
- fn diagnose_unused_private_declarations
- fn diagnose_unused_library_private_declarations
- fn diagnose_unused_private_declarations_with_errors
- fn used_fns_without_markused
- fn diagnosed_files_declare_generics
- fn diagnosed_files_call_library_generics
- fn diagnosed_fn_keys
- fn check_main_module_requirement
- fn iterator_for_in_elem_type
- fn iterator_for_in_next_call_info
- fn iterator_for_in_next_call_info_text
- fn index_overload_call_info
- fn expr_type
- fn expr_type_reference
- fn invalidate_checked_expr_type
- fn resolved_call_name
- fn resolved_call_may_store_globally
- fn fn_value_may_store_globally
- fn resolved_call_is_builtin
- fn reset_resolved_calls_for_reannotation
- fn fn_param_types_for_name
- fn resolved_call_never_returns
- fn resolved_fn_value_name
- fn set_resolved_fn_value
- fn clear_resolved_fn_value
- fn fn_value_snapshot
- fn fork_fn_value_replays_source
- fn apply_forked_fn_value
- fn direct_dependency_ids
- fn direct_dependencies
- fn share_direct_dependencies_from
- fn symbol_name
- fn frozen_symbol_name
- fn lookup_canonical_symbol_unlocked
- fn canonical_symbol
- fn symbol_count
- fn copy_cloned_resolution
- fn remember_method_value_call
- fn register_synth_type
- fn check_semantics
- fn is_veb_context_type
- fn declaration_has_attribute
- fn autofree_enabled
- fn struct_module_for_type
- fn type_has_declaration_attribute
- fn fn_body_definitely_returns
- fn module_declares_fn
- fn comptime_enum_decl_field_value
- fn comptime_enum_decl_field_values
- fn comptime_enum_decl_first_value
- fn comptime_enum_call_value
- fn check_interface_embedding_limits
- fn sizeof_arg_is_type
- fn sizeof_value_declaration
- fn sizeof_value_conditions
- fn prune_inactive_top_level_comptime
- fn prepare_threads_condition
- fn threads_condition_value
- fn type_text_implements_interface
- fn note_generated_parent
- fn sql_orm_method_is_private
- fn multi_expr_tail_types_for_transform
- fn generic_instance_satisfies_constraints
- fn infer_type_params_from_constraints
- fn infer_type_params_from_interface
- fn skip_unreachable_library_bodies
- fn skip_library_bodies_for_reachability
- fn skips_library_body_in_file
- fn library_bodies_checked_late
- fn skipped_library_bodies
- fn check_reached_library_bodies
- fn reached_library_body_nodes
- fn prepare_library_body_frontier
- fn check_library_body_frontier_nodes
- fn has_noalloc_contracts
- fn check_noalloc_contracts
- fn ownership_drop_entries_at_return
- fn ownership_drop_entries_at_return_node
- fn ownership_drop_entries_at_propagation
- fn ownership_drop_entries_at_loop_control
- fn ownership_drop_entries_at_loop_iteration
- fn ownership_drop_entries_at_scope_exit
- fn ownership_drop_entries_at_fn_exit
- fn ownership_fn_keeps_value_semantics
- fn ownership_drop_type_names
- fn ownership_drop_value_type_names_by_fn
- fn ownership_has_return_node
- fn ownership_type_requires_drop
- fn ownership_type_requires_destruction
- fn ownership_expr_moves_storage
- fn ownership_expr_creates_owned_value
- fn ownership_index_read_moves_value
- fn ownership_sum_read_moves_value
- fn ownership_sum_drop_consumes_storage
- fn ownership_receiver_alias_arg_is_cloned
- fn ownership_expr_is_borrowed_projection
- fn note_generated_borrowed_projection_copy
- fn ownership_expr_clones_borrowed_storage
- fn ownership_guard_read_moves_value
- fn ownership_assignment_reinitializes_moved_value
- fn ownership_fn_value_returns_owned
- fn ownership_call_result_source_args
- fn ownership_call_result_sources
- fn ownership_default_clone_missing_method
- fn inherit_ownership_codegen_metadata_from
- fn ownership_sum_return_sources
- fn ownership_sum_transfer_source
- fn ownership_sum_heap_sources
- fn check_semantics_opt
- fn check_semantics_selected
- fn check_semantics_reachable
- fn check_concrete_fn_semantics
- fn check_concrete_instance_members
- fn expr_subtree_has_node_error
- fn prepare_collect
- fn collect_continue
- fn can_continue_collect
- fn continue_collect_conflict
- fn smartcast_type_name
- fn assignment_keeps_narrowing
- fn expr_compatible
- fn c_type_cast_name_known
- fn array_accessor_result_is_borrowed
- fn comparison_calls_operator_method
- fn check_specialized_fn_global_shadowing
- fn c_backed_alias_method_name
- fn report_receiver_type_arg_mismatch
- fn visible_c_fn_module
- fn call_param_storage_source_params
- fn call_param_flows_to_callback
- fn prepare_callback_param_flows
- fn struct_field_is_shared
- fn fn_signature_type
- fn infer_generic_reachability_type_args
- fn call_binds_implicit_it
- fn is_locally_declared_bare_type
- fn translated_integer_literal_type
- fn translated_promoted_numeric_type
- fn translated_promoted_shift_type
- fn translated_common_numeric_type
- fn expr_is_method_value
- fn c_identifier_is_undeclared
- fn index_operator_call_info
- fn refresh_transform_static_method_names
- fn refresh_transform_static_method_names_added
- fn forget_transform_static_method_names
- fn struct_field_c_abi_fn_ptr_type
- fn slot_value_compatible
- fn fn_param_compatible
- fn fixed_array_len_value
- fn const_int_value
- fn const_int_value_in_module
- fn interface_implements_interface
- fn interface_metadata_name
- fn named_type_implements_interface
- fn type_has_implicit_str_method
- fn named_type_implements_marker
- fn interface_impl_names
- fn pre_transform_interface_impl_names
- fn interface_type_ids
- fn freeze_interface_impl_names
- fn freeze_pre_transform_interface_impl_names
- fn interface_impl_set_signature
- fn interface_concrete_method_keys
- fn runtime_type_index_names
- fn interface_accepts_implicit_str
- fn ierror_impl_names
- fn concrete_method_signature_key
- fn concrete_generic_method_signature_candidates
- fn named_type_compatible_with_ierror
- fn resolve_ierror_payload_name
- fn precompute_source_error_embed_index
- fn qualify_type_name_at
- fn specialize_generic_factory_return
- fn resolve_imported_type_text_in_file
- fn prepare_interface_requirement_indexes
- fn begin_interface_impl_queries
- fn end_interface_impl_queries
- fn prepare_interface_query_indexes
- fn has_ierror_interface
- fn interface_abstract_method_names
- fn interface_method_signature_key
- fn interface_field_list
- fn struct_fields_for_type
- fn struct_field_type_name
- fn promoted_method_value_owner
- fn method_value_selector_type
- fn alias_method_value_receiver
- fn specialized_interface_method_signature
- fn fn_type_callconv_compatible
- fn generic_type_name_matches
- fn sum_variant_type_for_pattern
- fn cached_c_name
- fn parse_type
- fn parse_type_ref
- fn parse_canonical_type_cached
- fn parse_canonical_type
- fn intern_type_reference
- fn type_count
- fn type_name
- fn type_cache_stats
- fn resolve_inferred_type_id
- fn canonical_qualified_type_name
- fn invalidate_short_type_name_index
- fn register_short_type_name
- fn unregister_short_type_name
- fn c_abi_fn_ptr_type_for_type_text
- fn arm_body_resolve_memo
- fn disarm_body_resolve_memo
- fn reset_body_resolve_memo
- fn resolve_type
- fn resolve_type_reference
- fn c_type
- fn resolve_generic_struct_method
- fn resolve_generic_sum_method
- fn ownership_type_has_clone_method
- fn suffix_indexed_method_fits_receiver
- fn c_struct_operator_call_info
- fn warn_unhandled_result_calls
- fn start_incremental_check
- fn take_incremental_trace
- fn put_back_incremental_unhandled
- fn sort_incremental_unhandled
- fn complete_incremental_check
- fn complete_incremental_check_step
- fn complete_incremental_check_for_instances
- fn put_back_incremental_instances
- fn verify_incremental_instances
- fn incremental_record
- fn incremental_instances_record
- fn semantic_type_id
- fn checked_expr_type_id
- fn type_by_id
- fn type_name_by_id
- fn c_type_by_id
- fn parse_type_id
- fn named_variant_payload_type
- fn type_index
- fn fn_type
- fn variadic_fn_type
- fn fn_type_for_name
- fn vls_answer
- struct TypeError
- struct USize
- struct Unknown
- struct UnknownData
- struct VlsQuery
- struct Void