docs: explain match assertions and annotation type distinctions
This commit is contained in:
@@ -26,6 +26,7 @@ fn function_bodies_accept_method_statements_and_optional_trailing_return() {
|
||||
.body
|
||||
.statements
|
||||
.iter()
|
||||
// 两个调用都应是普通 Expression 语句,不能被误识别为返回或绑定。
|
||||
.all(|s| matches!(s.kind, StmtKind::Expression(_)))
|
||||
);
|
||||
assert!(parse_ast("function empty(): Unit {}", ParseMode::Module).is_ok());
|
||||
@@ -258,6 +259,7 @@ fn json_interfaces_reject_unknown_fields_schema_changes_and_invalid_ranges() {
|
||||
kind: ExprKind::Name("値".into()),
|
||||
span: Span::new(1, 3),
|
||||
});
|
||||
// 结构范围虽非逆序,起点切断三字节日文字符,仍须在提供原文的校验阶段失败。
|
||||
assert!(matches!(
|
||||
AstDocument::new(root).unwrap().validate_source("値"),
|
||||
Err(AstError::InvalidSpan(_))
|
||||
|
||||
Reference in New Issue
Block a user