check Command Design Document
yx check is the static checking entry point of the YaoXiang compiler. It is not a lightweight path that only performs parsing and type checking: a single check runs the complete frontend and middle-end stage table, but does not produce executable artifacts.
Entry Point
| Layer | Location | Key Symbol |
|---|---|---|
| Orchestration | src/frontend/module/orchestrator.rs | check_project(entry, config) |
| Driver | src/driver/program.rs | ProgramKind::Check → CHECK_STAGES |
| Driver Arm | src/driver/arms.rs | The Check form of each stage |
check_project constructs Program { kind: Check } and runs the Driver once. It returns Vec<(file, diagnostics)>; discovered files have an entry even when they have no diagnostics. Vendor, discovery, and parsing failures still hard-abort with OrchestratorError (the existing behavior in 4.10.1).
Actual Stage Table
CHECK_STAGES (src/driver/program.rs) contains 12 stages:
VendorConsistency— vendor lock and workspace consistencyDiscovery— rebuild the unit set along theusegraphParsing— lex + parseRegistry— module registrationRoleClassification— project role classificationTypecheck— type checking for each unitDeadCodeAnalysis— dead code analysis (project scope)ProofExecution— compile-time proof execution (RFC-027)GlobalSlotAlloc— global slot allocationIrGeneration— AST → ModuleIR (in memory only)Linking— merging onlyMonomorphization— monomorphization (the Check form consumes the IR)
Artifact boundary: After IrGeneration, the IR is not emitted, written to disk, used to produce .42, or used to generate a snapshot (DriverOutcome.module is always None); a successful check is silent.
Boundaries with Other Commands
| Command | What It Does | Difference from check |
|---|---|---|
yx check | The 12 stages above | Does not produce executable artifacts; the IR only serves diagnostics and subsequent checking stages |
yx build / yx run | The same stage table + code generation + backend | Produces .42 and executes it |
yx lsp | ProgramKind::Lsp: a single compilation produces diagnostics and semantic data | Editor-oriented; diagnostics are filtered to the target file |
yx format | Performs only lexing and formatting | Shares no stages with check |
Nonexistent Capabilities
The following capabilities are not implemented, so do not assume they exist based on older documentation:
- The
--watchflag: TheChecksubcommand only has arguments such aspaths/--exclude; there is no watch mode. - Incremental checking:
CheckSession/ModuleDependencyGraph/ModuleCache/HotReloaderhave zero matches in the repository; everycheckis a full pass. - Cross-file analysis with an independent
Compilerfor each file:check_single_moduledoes not exist. Cross-file capabilities come from the registry and shared environment insrc/frontend/module/.
Diagnostics and Error Codes
For the error code system, the Diagnostic data structure, and Emitter output, see Diagnostic System.
