Skip to main content

Module check_pipeline

Module check_pipeline 

Source
Expand description

The shared per-unit/per-file resolve-check core, used by both bynk-emit’s check_unit_files (Mode::Build and Mode::Analyse) and this crate’s own crate::analysis::analyse_project.

P4.1 (#1115), the same extract, don't duplicate move as crate::project_model: check_unit_files’s per-file body is identical for both modes except for four record_analyse_types call sites (the error-path exits) and the final “Analyse mode always stops here, Build mode falls through to certify+emit_unit” branch. This module owns everything up to (not including) that branch — check_file_core returns Some(TypedCommons) only on the fully-clean, non-blocked path, so a caller that wants to emit knows exactly when it may. The four error-path recordings are unconditional here now (previously gated on mode == Mode::Analyse) — behaviour-preserving for the Mode::Build caller, which never took that branch anyway (mode == Mode::Analyse gated it), and whose exprs sink compile_project’s ProjectOutput never exposes.

What stayed in bynk-emit: Mode itself (meaningless here — this crate’s own entry point has exactly one behaviour), certify+emit_unit (real emission), and the decision of whether to record the clean-path types (each caller does that itself with the Some(TypedCommons) this module hands back — bynk-emit’s Mode::Build caller skips it, Mode::Analyse and this crate’s own entry point both call record_analyse_types).

Structs§

FileCheckResult
The clean-path output of check_file_core: the typed, fully-checked unit plus the per-file cross-context info that produced it — a Mode::Build caller needs both to reach certify+emit_unit (emit_unit takes cross_context_for_file as its own argument, so this avoids making the caller recompute it from ctx/unit_info a second time).
UnitCheckCtx
v0.29.4: build_cross_context_info (and its combined_types_for helper) is a general map-based function — the test-emission path calls it with synthetic harness maps, not unit_info — so it keeps its parallel-map signature. The per-file core only has unit_info, so this materialises the four views that one call needs, once per unit ahead of the file loop — but only for a context/adapter, build_cross_context_info’s only caller. UnitTable owns every declaration body in the unit, so for every other unit kind (including the seven injected first-party commons) this would otherwise be a whole-project deep clone, performed and discarded, once per unit.

Functions§

check_file_core
The shared resolve+check+context-checks core for one file, factored out of check_unit_files (see this module’s own doc comment). Returns Some(FileCheckResult) only on the fully-clean, non-blocked path — the signal a Mode::Build caller uses to know it may proceed to certify+emit_unit. Every error/blocked exit records best-effort partial types unconditionally (see record_analyse_types) and returns None.
prepare_unit_check_ctx
Build the per-unit prelude check_file_core shares across every file in the unit — see UnitCheckCtx’s own doc comment.
record_analyse_types
Record a file’s (possibly partial) expression types into the Analyse-mode sink. Called at every per-file exit in the check loop so .-member completion and signature help get the receiver’s type even when a later check phase errors for the file (ADR 0094). A no-op-shaped wrapper, factored out so the four error-path exits (now unconditional, see this module’s own doc comment) and every clean-path caller share one call.