pub struct SheetDiagnostics {Show 13 fields
pub cell_names: IndexMap<String, (CellId, TypeShape)>,
pub output_names: IndexMap<String, CellId>,
pub requirement_names: HashMap<RequirementId, String>,
pub requirement_labels: HashMap<RequirementId, SourceLabel>,
pub method_spans: HashMap<(RelationshipId, usize), SourceSpan>,
pub relationship_spans: HashMap<RelationshipId, SourceSpan>,
pub cell_spans: HashMap<CellId, SourceSpan>,
pub sources: Vec<SourceId>,
pub anonymous_source: Option<SourceId>,
pub instance_origins: Vec<InstanceOrigin>,
pub method_origins: HashMap<(RelationshipId, usize), MethodOrigin>,
pub cell_origins: HashMap<CellId, Vec<CellOrigin>>,
pub cell_shapes: HashMap<CellId, TypeShape>,
}Expand description
Retains source and native provenance without owning or borrowing a Sheet.
The snapshot owns names, spans, source identities, requirement labels, and expansion provenance. Its immutable source owners and authored records may share backing storage with the parsed model.
§Examples
let diagnostics = adam_lang::ParsedSheet::new().diagnostics();
assert!(diagnostics.sources().is_empty());Fields§
§cell_names: IndexMap<String, (CellId, TypeShape)>Public root cell names and their IDs and complete shapes, in declaration order.
output_names: IndexMap<String, CellId>Public output names and their IDs, in declaration order.
requirement_names: HashMap<RequirementId, String>Explicit requirement names keyed by runtime requirement ID.
requirement_labels: HashMap<RequirementId, SourceLabel>Requirement IDs mapped to authored source labels, including unnamed checks.
method_spans: HashMap<(RelationshipId, usize), SourceSpan>Root-local method spans keyed by relationship ID and method index.
relationship_spans: HashMap<RelationshipId, SourceSpan>Root-local relationship spans keyed by relationship ID.
cell_spans: HashMap<CellId, SourceSpan>Root-local declaration spans keyed by cell ID.
sources: Vec<SourceId>Retained source owners in insertion order.
anonymous_source: Option<SourceId>Anonymous convenience source used for caller-selected display names.
instance_origins: Vec<InstanceOrigin>Parent-linked native occurrence provenance.
method_origins: HashMap<(RelationshipId, usize), MethodOrigin>Authored method origins keyed by runtime relationship and method index.
cell_origins: HashMap<CellId, Vec<CellOrigin>>Authored cell origins keyed by runtime cell ID.
cell_shapes: HashMap<CellId, TypeShape>Complete shapes for root and private cells.
Implementations§
Source§impl SheetDiagnostics
impl SheetDiagnostics
Sourcepub fn locate_error(&self, error: &Error) -> Vec<SourceLabel>
pub fn locate_error(&self, error: &Error) -> Vec<SourceLabel>
Resolves an error to owning definition and invocation labels.
- Complexity: O(o + m + c + k + p × a + q × a + l²) time and O(o + m + c + k + l) space for occurrences o, methods m, public cells c, conditionals k, candidate cell origins p, visited occurrence/ancestor records q, local authored items a, and returned labels l.
§Examples
use adam_lang::{AdamParser, TypeRegistry};
let mut parsed = AdamParser::new(TypeRegistry::new(), cel_parser::OpLookup::new())
.parse_str("sheet s { cell x: i32 = 0; cell y: i32; relationship { y := 10i32 / x; } }")?;
let diagnostics = parsed.diagnostics();
let error = parsed.propagate().unwrap_err();
assert!(!diagnostics.locate_error(&error).is_empty());Sourcepub fn sources(&self) -> &[SourceId]
pub fn sources(&self) -> &[SourceId]
Borrows retained source owners in their original insertion order.
§Examples
use adam_lang::{AdamParser, TypeRegistry};
let parsed = AdamParser::new(TypeRegistry::new(), cel_parser::OpLookup::new())
.parse_str("sheet s { cell x: i32 = 1; }")?;
assert_eq!(parsed.diagnostics().sources().len(), 1);Sourcepub fn anonymous_source(&self) -> Option<&SourceId>
pub fn anonymous_source(&self) -> Option<&SourceId>
Borrows the anonymous convenience source used for caller-selected display names.
§Examples
use adam_lang::{AdamParser, TypeRegistry};
let parsed = AdamParser::new(TypeRegistry::new(), cel_parser::OpLookup::new())
.parse_str("sheet s { cell x: i32 = 1; }")?;
assert_eq!(parsed.diagnostics().anonymous_source().unwrap().file_name(), "<input>");