Skip to main content

Module diagnostics

Module diagnostics 

Source
Expand description

Python’s semantic diagnostics: proof-gated unresolved-name reporting.

Every candidate this pass reaches leaves one typed outcome in the SemanticDiagnosticReport: a resolution, a complete absence proof, or a typed reason why absence could not be proven. A candidate is never dropped in silence, and an error is only ever published behind a SemanticAbsenceProof over a surface that was complete.

The analyzer facts this needs are the PythonSource the import resolver already takes, a BoundedDefinitionLookup for “is this fqn indexed”, and a PythonEnvironmentSurface for “what do the activated environment packs prove about this imported module”. analyzer/python/diagnostics.rs in brokk-bifrost-analysis keeps the downcast that produces all three: this crate cannot name the semantic-model overlay those answers come from.

What this pass judges:

  • every bare-name reference, against the file’s lexical surface and the workspace index, which are both complete and workspace-local;
  • every import declaration, against the retained environment surface;
  • an attribute read through a module binder (os.path.join), which is the one receiver whose owner Python’s syntax proves without type inference.

An attribute on any other receiver is not a candidate here: proving that value.method is absent needs a proven receiver type, which this pass does not have.

Structs§

UnacquiredPythonEnvironment
An environment that has acquired nothing. Every boundary is unknown, which is the honest answer for an analyzer no host has activated packs on.

Enums§

PythonEnvironmentBoundary
What the analyzer’s retained environment evidence proves about one name a Python file reaches across an import boundary.

Constants§

MAX_PYTHON_SEMANTIC_DIAGNOSTICS
PYTHON_SEMANTIC_DIAGNOSTIC_SOURCE
PYTHON_UNRECOGNIZED_SYMBOL

Traits§

PythonEnvironmentSurface
The retained Python environment surface a diagnostic request may read.

Functions§

collect_python_semantic_diagnostics
Collect Python semantic diagnostics and the proof behind each one.