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 algebraSubstitution— a type-variable-to-type mapping with path compressionunify— Hindley-Milner unification with occurs checkTypeChecker— 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 —
ImplTableconstruction, impl/method dispatch, coherence checking, associated-type resolution, and supertrait obligations. - vocab
- Catalog of annotations and strictness levels recognized by the type system.
Structs§
- Effect
Ref - A reference to an algebraic effect, identified by its fully-qualified name.
- FnType
- A function type: parameter types, return type, and algebraic-effect set.
- Generic
Type - A generic type application: a named type constructor applied to type args.
- Named
Type - A user-defined named type (record, enum, class).
- Predicate
- A predicate expression in a refined type.
- Structural
Constraints - Structural constraints for a flexible (sketch-mode) type.
- Substitution
- A partial map from
TypeVarIds toTypes.
Enums§
- Primitive
Type - The set of primitive (built-in scalar) types in Bock.
- Type
- The type of an Bock value.
- Type
Error - 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§
- Type
VarId - Unique identifier for a type-inference variable.