Skip to main content

Crate bock_types

Crate bock_types 

Source
Expand description

Bock types — type system definitions, inference engine, and trait resolution.

This crate defines the internal type representation used by all later compiler passes (type checker, interpreter, code generation). It provides:

  • Type — the main type algebra
  • Substitution — a type-variable-to-type mapping with path compression
  • unify — Hindley-Milner unification with occurs check
  • TypeChecker — bidirectional type inference engine (T-AIR pass)

Re-exports§

pub use checker::TypeChecker;
pub use checker::TypeEnv;
pub use traits::check_supertrait_obligations;
pub use traits::resolve_impl;
pub use traits::resolve_method;
pub use traits::ImplId;
pub use traits::ImplTable;
pub use traits::ResolvedMethod;
pub use traits::TraitRef;
pub use ownership::analyze_ownership;
pub use ownership::AIRModule;
pub use ownership::OwnershipInfo;
pub use ownership::OwnershipState;
pub use effects::infer_effects;
pub use effects::track_effects;
pub use effects::Strictness;
pub use capabilities::compute_capabilities;
pub use capabilities::verify_capabilities;
pub use capabilities::CapabilitySet;
pub use exports::collect_exports;
pub use exports::type_to_type_ref;
pub use seed_imports::seed_imports;

Modules§

capabilities
Capability computation — CAP-AIR pass.
checker
Bidirectional type inference engine — T-AIR pass.
effects
Effect tracking — E-AIR pass.
exports
Export collection pass — extracts public declarations into the [ModuleRegistry].
ownership
Ownership analysis — O-AIR pass.
seed_imports
Seeds the type checker with type information from imported modules.
traits
Trait resolution — ImplTable construction, impl/method dispatch, coherence checking, associated-type resolution, and supertrait obligations.
vocab
Catalog of annotations and strictness levels recognized by the type system.

Structs§

EffectRef
A reference to an algebraic effect, identified by its fully-qualified name.
FnType
A function type: parameter types, return type, and algebraic-effect set.
GenericType
A generic type application: a named type constructor applied to type args.
NamedType
A user-defined named type (record, enum, class).
Predicate
A predicate expression in a refined type.
StructuralConstraints
Structural constraints for a flexible (sketch-mode) type.
Substitution
A partial map from TypeVarIds to Types.

Enums§

PrimitiveType
The set of primitive (built-in scalar) types in Bock.
Type
The type of an Bock value.
TypeError
An error produced by type unification.

Functions§

types_equal
Check structural equivalence of two types under a substitution.
unify
Unify two types under the given substitution, extending the substitution in place when a type variable is bound.

Type Aliases§

TypeVarId
Unique identifier for a type-inference variable.