Expand description
Per-fn shape recognition — typed facts over resolved HIR.
Stage 1 of issue #232 (0.23 “Shape”). This module is the
recognition-only layer: walks ResolvedFnDef bodies, builds
Facts per fn, emits multi-label archetype classifications,
computes call-graph SCCs. No ModuleShape vector / Kind /
Layer / renderer here — those live one tier up in
aver::diagnostics::shape (presentation) or
aver::codegen::proof_lower (meaning), and the future Stage 6
patterns / relations (WrapperOverRecursion, ResultPipeline,
…) land here next to the primitives they’re built from.
Structs§
- Facts
- FnRecognition
- Per-fn recognition output: precedence-picked primary archetype + the full multi-label set the classifier fired on.
- Program
Shape - Whole-program shape facts produced by
analyze_program.
Enums§
- Archetype
- Per-fn archetype label. Multi-label per fn —
classifyreturns aVec<Archetype>;primary_labelpicks one by the precedence declared inArchetype::all. Stringified only at presentation boundaries (renderer, JSON, LSP hover). - Module
Pattern - A
ModulePatternis a recognized structural fact about a whole module’s surface — the level above per-fn archetypes — carrying the typed payload downstream consumers need to act on it.
Functions§
- analyze_
program - Build a
ProgramShapeover the post-resolver fn snapshot in one pass. Caller picks which fns participate (typically everyResolvedTopLevel::FnDefof the entry module, sometimes plus dep-module fns when a cross-module analysis needs the broader view). - analyze_
program_ with_ modules - Same as
analyze_programbut also detects module-level patterns (ModulePattern::RefinementSmartConstructor, …) by walking the sourceitemsand dep modules. Callers that have both the resolved-fn snapshot and the source items should prefer this. - classify
- collect_
inductable_ sum_ types - Walk entry items + dep modules and collect the names of sum types
that pass the proof-export induction eligibility check: directly
self-referential in at least one variant, and not indirectly
recursive through nested generics that the per-variant emit
would have to give up on. Mirrors the inline scan that
proof_lower::detect_induction_targetused to perform so the detector can read fromProgramShape.inductable_sum_typesand avoid re-walking the AST. - compute_
sccs - detect_
module_ patterns - Walk entry items + dep modules and emit every typed
ModulePatternwe can recognize. Used byanalyze_program_with_modulesto populateProgramShape.patterns. - extract_
facts - primary_
label - type_
is_ result