check Command Design Document
yaoxiang check is the static analysis tool for the YaoXiang compiler, providing type checking, cross-file analysis, and incremental checking capabilities.
Design Principles
- Zero False Positives: Every reported error must be a genuine error
- Cross-File Awareness: Correctly detect cross-module type errors and undefined references
- Incrementality First: Watch mode only re-checks affected files
- Self-Documenting: Error codes, message templates, and help text are all managed through i18n
Document Navigation
- Diagnostic System — Error code system, Diagnostic data structure, Emitter output
- Cross-File Analysis — Shared type environment, dependency graph, topological sort
- Incremental Checking — CheckSession, affected_modules, watch mode
Boundaries with Other Systems
| System | Responsibilities | Relationship with check |
|---|---|---|
Compiler (yaoxiang build) | Full compilation (parsing → type checking → codegen) | check only does first two steps |
| LSP | Editor integration (completions, go-to, diagnostics) | check diagnostics are reusable |
Formatter (yaoxiang fmt) | Code style | Independent, runs in parallel in CI |
