From 32859c48d3c92bb8790a552ea3364dfbdff43e71 Mon Sep 17 00:00:00 2001 From: cflmy Date: Wed, 18 Nov 2026 13:40:24 +0800 Subject: [PATCH] test(modular): source-grounded independent composition accepts pure forwarding and rejects branches --- src/knowledge/composition.rs | 98 +++++++++++++++++++++++++++++++++++- 1 file changed, 97 insertions(+), 1 deletion(-) diff --git a/src/knowledge/composition.rs b/src/knowledge/composition.rs index 5a3717e..edb6fb2 100644 --- a/src/knowledge/composition.rs +++ b/src/knowledge/composition.rs @@ -9,7 +9,7 @@ use anyhow::{Context,Result}; use serde_json::{json,Value}; use sha2::{Digest,Sha256}; use crate::{ - ast::{Arg,CallExpr,Expr,Function,Literal,Stmt}, + ast::{CallExpr,Expr,Function,Literal,Stmt}, prove::driver::{Toolchain,compile_import_module}, sema::ir::{Compilation,SemanticArtifact,BoundCall} }; @@ -186,3 +186,99 @@ pub fn prove(compiled:&Compilation,out:&Path,toolchain:&Toolchain)->Result 0 + **v = [调用](math.math.exact(`n`))** +2. * + **v = 0** + +*v* +"#).unwrap(); + let changed=crate::sema::ir::compile_project( + &crate::sema::ir::CompileOptions::for_path(&root).unwrap()).unwrap(); + let guarded=changed.semantics.bound_calls.iter().find(|x| + x.call_site=="math.math.exact").unwrap(); + assert!(candidate(&changed,guarded).is_none()); + fs::remove_dir_all(root).unwrap(); + } +}