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 assemble::assemble_project;
pub use assemble::assemble_project_with_deps;
pub use assemble::check_scopes;
pub use assemble::AssembledProgram;
pub use assemble::DefKind;
pub use assemble::DefSite;
pub use assemble::Located;
pub use assemble::Provenance;
pub use assemble::ScopeInfo;
pub use assemble::Segment;
pub use assemble::SourceMap;
pub use check::check_program;
pub use check::check_program_collect;
pub use check::check_program_located;
pub use check::infer_instantiations;
pub use check::root_binding_types;
pub use check::CallInstance;
pub use check::IndexedTypeError;
pub use check::Instantiations;
pub use check::LocatedTypeError;
pub use check::Site;
pub use dimension_check::DimensionChecker;
pub use dimension_check::DimensionError;
pub use escape::EscapeChecker;
pub use escape::EscapeError;
pub use escape::EscapeErrorKind;
pub use import_hygiene::lint_imports;
pub use import_hygiene::lint_imports_with_deps;
pub use import_hygiene::ImportLint;
pub use import_hygiene::ImportLintKind;
pub use import_hygiene::LintSeverity;
pub use known_calls::check_unknown_calls;
pub use known_calls::check_unknown_calls_with_exports;
pub use known_calls::proven_module_exports;
pub use known_calls::refuse_retired_calls;
pub use ownership::MaybeGivenIn;
pub use ownership::OwnershipChecker;
pub use ownership::OwnershipError;
pub use ownership::OwnershipErrorKind;
pub use ownership::OwnershipFinding;
pub use ownership::VarState;
pub use types::FnSig;
pub use types::LogosType;
pub use types::RustNames;
pub use types::TypeEnv;

Modules§

assemble
Source-level assembly of a multi-file / multi-directory LOGOS project.
callgraph
check
Bidirectional type checker for the LOGOS compilation pipeline.
defined_real
Which functions may define a real number: the real number whose digits in base 3 are f, the real number approximated by f.
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.
import_hygiene
Import-hygiene lints — the pit-of-success guardrails that keep a project’s import blocks honest. An UNRESOLVABLE import is already a hard error at assembly (with a “did you mean” suggestion from the loader); this pass finds the problems that ASSEMBLE FINE but are still mistakes: an import that is never used, the same module imported twice, and a module importing itself.
known_calls
Definition-time resolution of CALLED NAMES — a call to a name that exists NOWHERE in the program is a check error, not a native-build E0425 or a runtime surprise.
liveness
ownership
Native ownership analysis for use-after-move detection.
pipes
Which function parameters carry a pipe.
policy
readonly
registry
relay
Whether a program’s pages talk to the relay — and so whether the backend serving them answers /_relay itself.
tower
Which values of a program the exact extension reaches: the bindings, function results and parameters that can hold an infinitesimal, a hyperreal, an infinite integer, an algebraic number, a computable real, an ordinal, a residue-dependent value or a provisional answer.
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.
first_section_header
A file’s first ## section header outside a ``` fence, as its 1-based line and its text: the line above which an Import must stand to import anything.
misplaced_imports
Every Import sentence below a file’s first ## header, each with its byte span. That is where scan_dependencies does not read, so such a sentence imports nothing: the module is never spliced and the program runs on without it. A caller refuses each at its own line. A line inside a
scan_dependencies
Scans the first paragraph (Abstract) of a LOGOS file for [Alias](URI) links.