feat(contract): Phase 2 渐进式契约层 —— 契约表提取 + 四边界校验 + marqdo check 防漂移(T2.1–T2.5)
- src/contract.rs: 类型词汇(渐进标注)、参数/返回/字段三形状契约表解析、合并、四边界校验诊断 - src/parse/mod.rs: extract_function_contract —— 位置+形状双重判定,在升参推断之前提取; 绑定表/普通文档表绝不吃(P1 零回归),契约表从 body 移除(元数据永不执行) - src/interp.rs: 四边界校验 —— 调用实参(3 条调用路径)/返回/表绑定/字段访问 - src/check.rs + marqdo check [--json]: 漂移双向互查、未知类型名(附建议)、错位契约 - src/load.rs: label_error 保留结构化诊断(错误出口唯一,不拍平成字符串) - T2.4: 全部契约诊断带 doc_anchor/doc_quote/contract_ref - tests/contracts.rs 12 例全绿;全量回归零失败(含 262 gold) Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
97fda7aa10
commit
7a449c40b1
17 files changed
+1586
-6
No files matched your search
@@ -61,6 +61,10 @@ pub struct Function {
|
||||
pub base: Option<String>,
|
||||
/// Prose `` `名` `` never read/assigned on the executable surface (not params).
|
||||
pub dead_binds: Vec<String>,
|
||||
/// 渐进式契约(T2.1):形参/返回/对象字段契约(附着在文档表上,升参推断前提取)。
|
||||
pub contract: Option<crate::contract::Contract>,
|
||||
/// 集合契约(T2.1):变量名 → 字段契约(紧邻 `` `名` = `` 绑定之前的文档表)。
|
||||
pub var_contracts: HashMap<String, crate::contract::Contract>,
|
||||
}
|
||||
|
||||
impl Function {
|
||||
|
||||
Reference in new issue
Block a user