Skip to main content

Module context_checks

Module context_checks 

Source

Functions§

build_capability_op_info
#926: build a checker-facing CapabilityOpInfo from a capability op’s AST, with the op’s own type parameters (if any) resolved as Ty::Var rather than ground types — a call site substitutes a concrete Ty for each before checking. Shared by every site that reconstructs CapabilityInfo from a CapabilityDecl (local capabilities, test/property bodies targeting a context) so the vars-in-scope treatment can’t drift.
check_context_constraints
Enforce v0.4 construction rules: types owned by a consumed context can be referenced (held, passed, read for transparent exports) but cannot be constructed. This catches OtherType { ... }, OtherType.of(...), OtherType.unsafe(...), and OtherType.Variant(...) expressions where OtherType is from a consumed context.
check_context_declarations
Check capability/provider/service/agent declaration bodies for a context (or adapter) unit. Mutates typed to extend the expr_types map with bindings observed in the new bodies.
reject_fn_types
ts_type_ref_display
Render a type-ref in the same form the user wrote it, for diagnostics.
type_ref_is_held
v0.20a: function types are confined to non-boundary positions — fn/lambda parameters, returns, and locals. Walk a type reference and reject any function type found in a position that would serialise, persist, or cross a boundary (bynk.types.function_at_boundary). v0.102 (§2.9): true if a type is or wraps a held resource (Connection), looking through Option/Effect — the shapes a held value legitimately takes: an Option[Connection] cell value, an Effect[Connection] capability return, a bare Connection handler parameter.
type_ref_to_display
A short bynk-source-level rendering of a type reference for a diagnostic message — not the TS-facing ts_type_ref family, which renders the erased/emitted shape rather than what the author wrote.
validate_store_field_value_types
v0.102 (§2.9.3): validate one agent store field’s value types, applying the held-resource storage rules. Held values are admitted in Cell[Option[Connection]] / Map[K, Connection] (an exception to the serialisable-value rule — hibernation preserves them, not JSON), and rejected in Set/Log/Cache. Non-held value types fall through to the ordinary boundary check.