pub fn check_sheet(
sheet: &Sheet,
registry: &TypeRegistry,
lookup: &OpLookup,
) -> Vec<ParseError>Expand description
Checks sheet against registered types and operation/record metadata, returning diagnostics.
Never fails — an absent Adam annotation, an unresolved identifier, an Adam cell/source/out
annotation registry doesn’t resolve, or a custom call without metadata falls back to
[cel_parser::Ty::Any] and are silently skipped, not reported. CEL array annotations inside
expressions use the same registry-backed CEL resolver, so unknown leaf names such as
[]: [Missing] are still reported. Known custom annotations retain their complete leaf
descriptors. Constructors and members use lookup’s schemas/signatures, not value names;
unknown constructors and incompatible known fields/operands produce diagnostics.
- Complexity: proportional to checking every expression with
[
check_expr_with_type_resolver], plus O(n) sheet traversal and registry snapshot costs.
§Examples
use adam_lang::{AdamAstParser, TypeRegistry, check_sheet};
let sheet = AdamAstParser::new()
.parse_str("sheet s { cell x: i32 = 1.0; }")
.unwrap();
let diagnostics = check_sheet(&sheet, &TypeRegistry::new(), &cel_parser::OpLookup::new());
assert_eq!(diagnostics.len(), 1, "1.0 defaults to f64, mismatching the i32 annotation");use adam_lang::{AdamAstParser, TypeRegistry, check_sheet};
let sheet = AdamAstParser::new()
.parse_str("sheet s { out values := [0, 1]: [f64]; }")
.unwrap();
let diagnostics = check_sheet(&sheet, &TypeRegistry::new(), &cel_parser::OpLookup::new());
assert_eq!(diagnostics.len(), 1);
assert_eq!(
diagnostics[0].message(),
"array elements must match the annotation exactly: expected `f64`, found `i32`"
);use adam_lang::{AdamAstParser, TypeRegistry, check_sheet};
let sheet = AdamAstParser::new()
.parse_str("sheet s { out values := []: [Missing]; }")
.unwrap();
let diagnostics = check_sheet(&sheet, &TypeRegistry::new(), &cel_parser::OpLookup::new());
assert_eq!(diagnostics.len(), 1);
assert_eq!(diagnostics[0].message(), "unknown type `Missing`");