check Command Design Document
yx check is the YaoXiang compiler's static checking tool, providing type checking, cross-file analysis, and incremental checking functionality.
Design Principles
- Zero false positives: Every reported error must be a real error
- Cross-file awareness: Correctly detect cross-module type errors and undefined references
- Incremental 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 | Responsibility | Relationship with check |
|---|---|---|
Compiler (yx build) | Complete compilation (parse → type check → code generation) | check only does the first two steps |
| LSP | Editor integration (completion, jump, diagnostics) | check's diagnostics are reusable |
Formatter (yx format) | Code style | Independent, used in parallel in CI |
