command: Operand carries a source span

Each WHERE-expression Operand now records the byte span of the
terminal it was built from — the precise per-literal highlight
target for an expression WARNING (finishing ADR-0027 §2's
highlight/hint wiring). parse_operand captures MatchedItem::span;
the RowFilter::eq convenience constructor uses Operand::NO_SPAN.

PartialEq is hand-written to ignore the span — it is editor
metadata, so Command equality stays whitespace- and
position-independent, which the Expr test corpus relies on.
No behaviour change; 1100 tests still pass, clippy clean.
This commit is contained in:
claude@clouddev1
2026-05-19 09:20:52 +00:00
parent 39b92a7558
commit 426e80185f
4 changed files with 94 additions and 27 deletions
+11 -3
View File
@@ -542,7 +542,13 @@ fn predicate_warnings(
}
const fn is_null_literal(operand: &Operand) -> bool {
matches!(operand, Operand::Literal(crate::dsl::value::Value::Null))
matches!(
operand,
Operand::Literal {
value: crate::dsl::value::Value::Null,
..
}
)
}
/// If one operand is a known column and the other a non-null
@@ -556,8 +562,10 @@ fn pair_type_mismatch(
columns: &[crate::completion::TableColumn],
) -> Option<String> {
let (column, literal) = match (a, b) {
(Operand::Column(c), Operand::Literal(v))
| (Operand::Literal(v), Operand::Column(c)) => (c, v),
(Operand::Column { name: c, .. }, Operand::Literal { value: v, .. })
| (Operand::Literal { value: v, .. }, Operand::Column { name: c, .. }) => {
(c, v)
}
_ => return None,
};
// `null` fits any column; `= NULL` is flagged separately.