docs: explain match assertions and annotation type distinctions
This commit is contained in:
@@ -210,7 +210,7 @@ fn typed_method_storage_cannot_diverge_from_class_dispatch() {
|
||||
// 能力声明失败应保持定义版本和声明集合不变。
|
||||
let version = store.change_version(class).unwrap();
|
||||
assert!(matches!(
|
||||
// 存储冲突消除后能力声明才允许提交。
|
||||
// 当前后端仍有遮蔽字段,能力声明必须在状态提交前失败。
|
||||
store.implement_trait(class, capability),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
));
|
||||
@@ -236,18 +236,22 @@ fn typed_method_storage_cannot_diverge_from_class_dispatch() {
|
||||
store.supports(proxy, capability),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
));
|
||||
// 后端已出现遮蔽方法的冲突字段时,即使只读属性查询也必须拒绝不合法的能力存储。
|
||||
assert!(matches!(
|
||||
store.get_attr(proxy, "check"),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
));
|
||||
// 绑定方法入口不能绕过同一存储校验,不能先创建可调用绑定再放过冲突。
|
||||
assert!(matches!(
|
||||
store.bind_attr(proxy, "check"),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
));
|
||||
// 直接方法契约检查也拒绝代理后端冲突,防止跳过属性查找后绕过门禁。
|
||||
assert!(matches!(
|
||||
store.check_method_contract_call(function, proxy, false),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
));
|
||||
// 显式实例存储检查应给出同类能力违规,保持各调用入口的检查一致。
|
||||
assert!(matches!(
|
||||
store.check_typed_instance_storage(proxy),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
@@ -289,6 +293,7 @@ fn typed_method_storage_cannot_diverge_from_class_dispatch() {
|
||||
Value::Bool(true)
|
||||
);
|
||||
assert!(store.supports(reflective, capability).unwrap());
|
||||
// 带反射检查的载荷第一次非法写入仍须拒绝,递归防护不能误跳过最外层约束。
|
||||
assert!(matches!(
|
||||
store.set_attr(reflective, "check", Value::Nil),
|
||||
Err(VmError::TraitViolation { .. })
|
||||
|
||||
Reference in New Issue
Block a user