Skip to main content

Module analysis

Module analysis 

Source
Expand description

Compile-time analysis passes for the LOGOS compilation pipeline.

This module provides static analysis that runs after parsing but before code generation. These passes detect errors that would otherwise manifest as confusing Rust borrow checker errors.

§Analysis Passes

PassModuleDescription
EscapeescapeDetects zone-local values escaping their scope
OwnershipownershipLinear type enforcement (use-after-move)
Discoverydiscover_with_importsMulti-file type discovery

§Pass Ordering

Parser Output (AST)
       │
       ▼
┌──────────────┐
│ Escape Check │ ← Catches zone violations (fast, simple)
└──────────────┘
       │
       ▼
┌─────────────────┐
│ Ownership Check │ ← Catches use-after-move (control-flow aware)
└─────────────────┘
       │
       ▼
   Code Generation

§Re-exports

This module re-exports types from logicaffeine_language::analysis for convenience, including:

Re-exports§

pub use dimension_check::DimensionChecker;
pub use dimension_check::DimensionError;
pub use escape::EscapeChecker;
pub use escape::EscapeError;
pub use escape::EscapeErrorKind;
pub use ownership::OwnershipChecker;
pub use ownership::OwnershipError;
pub use ownership::OwnershipErrorKind;
pub use ownership::OwnershipFinding;
pub use ownership::VarState;
pub use types::LogosType;
pub use types::TypeEnv;
pub use types::FnSig;
pub use types::RustNames;
pub use check::check_program;
pub use check::check_program_collect;
pub use check::IndexedTypeError;

Modules§

callgraph
check
Bidirectional type checker for the LOGOS compilation pipeline.
dependencies
dimension_check
Dimension-aware static analysis — rejects dimension-incoherent quantity arithmetic at COMPILE time, before any code is generated. 2 meters + 1 gram is a type error, not a runtime panic: a length and a mass have no common dimension, so adding them cannot mean anything.
escape
Escape analysis for zone safety.
liveness
ownership
Native ownership analysis for use-after-move detection.
policy
readonly
registry
types
Type inference pass for the LOGOS compilation pipeline.
unify
Unification engine for the bidirectional type checker.

Structs§

CapabilityDef
A capability definition: A User can publish the Document if...
Dependency
A dependency declaration found in the document’s abstract.
DiscoveryPass
Discovery pass that scans tokens before main parsing to build a TypeRegistry.
DiscoveryResult
Result of running the discovery pass
FieldDef
Field definition within a struct
PolicyRegistry
Registry for security policies defined in ## Policy blocks.
PredicateDef
A predicate definition: A User is admin if the user's role equals "admin".
TypeRegistry
VariantDef
Phase 33: Variant definition for sum types

Enums§

FieldType
Type reference for struct fields (avoids circular deps with ast::TypeExpr)
PolicyCondition
Condition in a policy definition. Represents the predicate logic for security rules.
TypeDef

Functions§

discover_with_imports
Recursive discovery with module imports.
scan_dependencies
Scans the first paragraph (Abstract) of a LOGOS file for [Alias](URI) links.