Expand description
Bynk’s semantic-analysis layer — the crate between bynk-syntax and the
emitter.
Holds name resolution (resolver), type checking (checker), the registries
the checker dispatches and the LSP reads (kernel_methods, builtin_names),
the first-party embedded sources (firstparty), actor analysis (actors),
and the captured analysis tables written during resolution/checking:
the binding index, inlay hints, expr_types, and locals. These tables
are produced here and queried by the IDE layer (bynk-ide, a later slice):
captured tables live in bynk-check, queries live above it (ADR 0102, and
the crate-decomposition track’s check↔IDE seam).
Extracted from bynkc as slice 3 of the crate-decomposition track. Behaviour
is unchanged; bynkc depends on this crate and re-exports its modules so its
public API and the emitter/project layers above are untouched.
P4.1 (#1115) added this crate’s first project-level orchestration:
project_model (discovery→parse→group→resolve, shared with bynk-emit’s
run_checks), check_pipeline (the per-file resolve+check core, also
shared), and analysis (ProjectAnalysis and the new
analyse_project entry point bynk-ide will call once P4.2 repoints it).
context_checks — the per-file context/capability/provider/service/agent
validation, previously bynk-emit’s validate.rs — moved here in the
same slice, for the same reason: project_model’s and check_pipeline’s
shared pipeline needs it, and duplicating it into a second copy is exactly
what this crate’s extraction discipline exists to avoid.
Re-exports§
pub use firstparty::Platform;
Modules§
- actors
- v0.45 actor contracts (the actors-foundations slice).
- analysis
- The project-level analysis entry point (P4.1, #1115): discovery
(
bynk-project) → parse → resolve → check, returning thebynk-ide-facing analogue ofbynk-emit’sProjectAnalysis— without ever emitting. - builtin_
names - Centralised string literals for the language’s built-in vocabulary (refactor track item 8, v0.29.11). Built-in type/method names were compared as bare string literals scattered across the checker, emitter, and project modules; a typo was a silent never-match. One edit point per name now.
- check_
pipeline - The shared per-unit/per-file resolve-check core, used by both
bynk-emit’scheck_unit_files(Mode::BuildandMode::Analyse) and this crate’s owncrate::analysis::analyse_project. - checker
- Type checker and refinement validator (spec §§5–6, v0.1 §4.2, v0.2 §4.2).
- context_
checks - contract
- v0.177 (#643): the canonical normal form of a cross-context contract, and its hash.
- expr_
types - v0.30.2 (ADR 0063): the expression-type sink.
- firstparty
- First-party standard adapters embedded in the toolchain (v0.17 §4.2).
- hints
- v0.27 (ADR 0056): the inlay-hint sink.
- icu
- message-bundles slice 3 (#878): the ICU MessageFormat placeholder
mini-parser, plus the plain-
{name}template scanner (split_template) it dispatches from. Self-contained andbynk-syntax-free by design (Decision B) — the whole ICU sub-grammar ({name, plural, one {…} other {…}},{name, select, …},{name, number[, style]},{name, date[, style]}) lives entirely inside amessagestemplate’sStringcontent, parsed here as plain&strand consumed by both the checker (bynk-emit/src/project/validate.rs) and the emitter (emit_message_entry_renderer). Nobynk-syntaxgrammar/lexer/AST change backs this — a template stays one opaqueStringall the way through parsing. - index
- v0.25: the project-wide binding index (ADR 0053).
- kernel_
methods - v0.30.2 (ADR 0063): the enumerable kernel-method registry.
- locals
- v0.31 (ADR 0064): the local-binding sink.
- project_
model - Project-wide orchestration: discovery → parse → group → resolve, shared
between
bynk-emit’srun_checks(bothMode::BuildandMode::Analyse) and this crate’s owncrate::analysis::analyse_project. - requirements
- v0.99 (ADR — agent capability provenance): the capability-requirement ledger.
- resolver
- Name resolution (spec §5.1, v0.1 §4.1, v0.2 §4.1).
- schema_
registry - Events track, slice 3c (#980): the cross-build schema registry’s
reconciliation logic — verifying a project’s live event shapes against a
committed
bynk.schema.lock, keyed by qualified event name, storing each event’s field shape (name, type, whether the field has a default) and its current schema version. Every build reconciles the live shape against the stored one and either leaves the version alone, bumps it (a purely additive change), or fails the build (a change that isn’t safely additive). - secrets
bynk.Secretsread-name checking (v0.173, ADR 0196 D1).- store_
ops - #611: the enumerable storage-operation registry.
- symbols
- test_
suites - Test/integration-suite checking (P5.4,
design/tracks/semantics-in-the-checker.md§6) — closes category 7 ofbynk-check/src/analysis.rs’s own residual-gap accounting, the last of the seven.bynk-emit/src/project/tests_emit.rsheldprocess_tests/process_integration_tests, real production code (not fixture noise, despite the filename) checking + emittingsuite/test integrationbodies — but it ran only insidebynk-emit::run_checks(Mode::Analyseincluded), never insidebynk_check::analysis::analyse_project, the entry point the LSP now uses. That gap meant no diagnostics and noRefSinkbindings (go-to-definition/find-references) for anything inside a test file, in the editor — seeanalysis.rs’s own module doc for the full accounting this closes. - websocket
- v0.104 (real-time track slice 3b): shared analysis of a
from websocketon openhandler for the Workers wire path. - wire
- #855: the wire-contract IR — the shape a Bynk type takes crossing a context boundary, derived once from the AST + type table so both the emitter’s codec generation and the editor’s “wire contract” peek render the same derivation instead of two hand-synchronised ones.
- wire_
default